lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1a155116-9476-88f9-75e4-405570cd70e0@huawei.com>
Date:   Mon, 14 Aug 2023 22:28:03 +0800
From:   Yicong Yang <yangyicong@...wei.com>
To:     Xiongfeng Wang <wangxiongfeng2@...wei.com>,
        <jonathan.cameron@...wei.com>
CC:     "suzuki.poulose@....com" <suzuki.poulose@....com>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        <linux-kernel@...r.kernel.org>, <yangyingliang@...wei.com>,
        <yangyicong@...ilicon.com>, <alexander.shishkin@...ux.intel.com>
Subject: Re: [PATCH] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the
 code

On 2023/8/8 11:08, Xiongfeng Wang wrote:
> PCI core API pci_dev_id() can be used to get the BDF number for a pci
> device. We don't need to compose it mannually using PCI_DEVID(). Use
> pci_dev_id() to simplify the code a little bit.
> 
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@...wei.com>

Reviewed-by: Yicong Yang <yangyicong@...ilicon.com>

> ---
>  drivers/hwtracing/ptt/hisi_ptt.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c
> index ba081b6d2435..49ea1b0f7489 100644
> --- a/drivers/hwtracing/ptt/hisi_ptt.c
> +++ b/drivers/hwtracing/ptt/hisi_ptt.c
> @@ -618,13 +618,13 @@ static int hisi_ptt_notifier_call(struct notifier_block *nb, unsigned long actio
>  	if (!root_port)
>  		return 0;
>  
> -	port_devid = PCI_DEVID(root_port->bus->number, root_port->devfn);
> +	port_devid = pci_dev_id(root_port);
>  	if (port_devid < hisi_ptt->lower_bdf ||
>  	    port_devid > hisi_ptt->upper_bdf)
>  		return 0;
>  
>  	info.is_port = pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT;
> -	info.devid = PCI_DEVID(pdev->bus->number, pdev->devfn);
> +	info.devid = pci_dev_id(pdev);
>  
>  	switch (action) {
>  	case BUS_NOTIFY_ADD_DEVICE:
> @@ -664,7 +664,7 @@ static int hisi_ptt_init_filters(struct pci_dev *pdev, void *data)
>  	if (!root_port)
>  		return 0;
>  
> -	port_devid = PCI_DEVID(root_port->bus->number, root_port->devfn);
> +	port_devid = pci_dev_id(root_port);
>  	if (port_devid < hisi_ptt->lower_bdf ||
>  	    port_devid > hisi_ptt->upper_bdf)
>  		return 0;
> @@ -674,7 +674,7 @@ static int hisi_ptt_init_filters(struct pci_dev *pdev, void *data)
>  	 * should be partial initialized and users would know which filter fails
>  	 * through the log. Other functions of PTT device are still available.
>  	 */
> -	filter = hisi_ptt_alloc_add_filter(hisi_ptt, PCI_DEVID(pdev->bus->number, pdev->devfn),
> +	filter = hisi_ptt_alloc_add_filter(hisi_ptt, pci_dev_id(pdev),
>  					    pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT);
>  	if (!filter)
>  		return -ENOMEM;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ