scsi: megaraid_sas: Use pci_dev_id() to simplify the code
authorJialin Zhang <zhangjialin11@huawei.com>
Tue, 15 Aug 2023 02:54:18 +0000 (10:54 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 21 Aug 2023 20:47:44 +0000 (16:47 -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: Jialin Zhang <zhangjialin11@huawei.com>
Link: https://lore.kernel.org/r/20230815025419.3523236-3-zhangjialin11@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid/megaraid_sas_base.c

index 050eed8e26846f4855c6fe0953240b2e3627d1d8..b9d46dcb521094fa9afc66aa09f7f9e8e73a7b4a 100644 (file)
@@ -7518,7 +7518,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
         */
        instance->pdev = pdev;
        instance->host = host;
-       instance->unique_id = pdev->bus->number << 8 | pdev->devfn;
+       instance->unique_id = pci_dev_id(pdev);
        instance->init_id = MEGASAS_DEFAULT_INIT_ID;
 
        megasas_set_adapter_type(instance);