diff mbox series

[-next] scsi: pmcraid: Use pci_dev_id() to simplify the code

Message ID 20230811111310.32364-1-zhengzengkai@huawei.com
State New
Headers show
Series [-next] scsi: pmcraid: Use pci_dev_id() to simplify the code | expand

Commit Message

Zheng Zengkai Aug. 11, 2023, 11:13 a.m. UTC
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 manually. Use pci_dev_id() to
simplify the code a little bit.

Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
---
 drivers/scsi/pmcraid.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Martin K. Petersen Aug. 21, 2023, 9:14 p.m. UTC | #1
Zheng,

> 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 manually. Use pci_dev_id() to
> simplify the code a little bit.

Applied to 6.6/scsi-staging, thanks!
Martin K. Petersen Aug. 25, 2023, 1:13 a.m. UTC | #2
On Fri, 11 Aug 2023 19:13:10 +0800, Zheng Zengkai 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 manually. Use pci_dev_id() to
> simplify the code a little bit.
> 
> 

Applied to 6.6/scsi-queue, thanks!

[1/1] scsi: pmcraid: Use pci_dev_id() to simplify the code
      https://git.kernel.org/mkp/scsi/c/5d344c5eb415
diff mbox series

Patch

diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 9415a4819470..50dc30051f22 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3584,8 +3584,7 @@  static ssize_t pmcraid_show_adapter_id(
 	struct Scsi_Host *shost = class_to_shost(dev);
 	struct pmcraid_instance *pinstance =
 		(struct pmcraid_instance *)shost->hostdata;
-	u32 adapter_id = (pinstance->pdev->bus->number << 8) |
-		pinstance->pdev->devfn;
+	u32 adapter_id = pci_dev_id(pinstance->pdev);
 	u32 aen_group = pmcraid_event_family.id;
 
 	return snprintf(buf, PAGE_SIZE,