mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the code
@ 2023-08-08  3:08 Xiongfeng Wang
  2023-08-08  8:32 ` Yang Yingliang
  2023-08-14 14:28 ` Yicong Yang
  0 siblings, 2 replies; 4+ messages in thread
From: Xiongfeng Wang @ 2023-08-08  3:08 UTC (permalink / raw)
  To: yangyicong, jonathan.cameron, alexander.shishkin
  Cc: linux-kernel, yangyingliang, wangxiongfeng2

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@huawei.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;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the code
  2023-08-08  3:08 [PATCH] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the code Xiongfeng Wang
@ 2023-08-08  8:32 ` Yang Yingliang
  2023-08-14 14:28 ` Yicong Yang
  1 sibling, 0 replies; 4+ messages in thread
From: Yang Yingliang @ 2023-08-08  8:32 UTC (permalink / raw)
  To: Xiongfeng Wang, yangyicong, jonathan.cameron, alexander.shishkin
  Cc: linux-kernel


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@huawei.com>
Reviewed-by: Yang Yingliang <yangyingliang@huawei.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the code
  2023-08-08  3:08 [PATCH] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the code Xiongfeng Wang
  2023-08-08  8:32 ` Yang Yingliang
@ 2023-08-14 14:28 ` Yicong Yang
  2023-08-14 23:51   ` Suzuki K Poulose
  1 sibling, 1 reply; 4+ messages in thread
From: Yicong Yang @ 2023-08-14 14:28 UTC (permalink / raw)
  To: Xiongfeng Wang, jonathan.cameron
  Cc: suzuki.poulose, Mathieu Poirier, linux-kernel, yangyingliang,
	yangyicong, alexander.shishkin

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@huawei.com>

Reviewed-by: Yicong Yang <yangyicong@hisilicon.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;
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the code
  2023-08-14 14:28 ` Yicong Yang
@ 2023-08-14 23:51   ` Suzuki K Poulose
  0 siblings, 0 replies; 4+ messages in thread
From: Suzuki K Poulose @ 2023-08-14 23:51 UTC (permalink / raw)
  To: Yicong Yang, Xiongfeng Wang, jonathan.cameron
  Cc: Mathieu Poirier, linux-kernel, yangyingliang, yangyicong,
	alexander.shishkin

On 14/08/2023 15:28, Yicong Yang wrote:
> 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@huawei.com>
> 
> Reviewed-by: Yicong Yang <yangyicong@hisilicon.com>

Thanks Yicong Yang, for looping me in.

In the future, please Cc me for any patches may need to be picked
up via coresight tree. For now:


Applied, thanks!

[1/1] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the code
       https://git.kernel.org/coresight/c/484281bd5b98

Best regards,
--
Suzuki K Poulose <suzuki.poulose@arm.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;
>>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-14 23:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-08  3:08 [PATCH] hwtracing: hisi_ptt: Use pci_dev_id() to simplify the code Xiongfeng Wang
2023-08-08  8:32 ` Yang Yingliang
2023-08-14 14:28 ` Yicong Yang
2023-08-14 23:51   ` Suzuki K Poulose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®