scsi: pmcraid: Use pci_dev_id() to simplify the code
authorZheng Zengkai <zhengzengkai@huawei.com>
Fri, 11 Aug 2023 11:13:10 +0000 (19:13 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 21 Aug 2023 21:13:56 +0000 (17:13 -0400)
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>
Link: https://lore.kernel.org/r/20230811111310.32364-1-zhengzengkai@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/pmcraid.c

index 9415a481947048d2874599b58c2e6925d84c5688..50dc30051f221f537332ee3022d4d746b3108ae9 100644 (file)
@@ -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,