]> git.baikalelectronics.ru Git - kernel.git/commitdiff
habanalabs: use %pa to print pci bar size
authorOded Gabbay <ogabbay@kernel.org>
Mon, 27 Jun 2022 08:30:43 +0000 (11:30 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Tue, 12 Jul 2022 06:09:26 +0000 (09:09 +0300)
PCI bar size is resource_size_t so we should use %pa to make it work
correctly on all architectures.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/goya/goya.c

index 05d9817985d99ed7d0316a090c83d26186ac26b7..8fa0b86ccb6bdcb8a0d49e269e2085540164183d 100644 (file)
@@ -801,6 +801,7 @@ static int gaudi_early_init(struct hl_device *hdev)
 {
        struct asic_fixed_properties *prop = &hdev->asic_prop;
        struct pci_dev *pdev = hdev->pdev;
+       resource_size_t pci_bar_size;
        u32 fw_boot_status;
        int rc;
 
@@ -811,24 +812,20 @@ static int gaudi_early_init(struct hl_device *hdev)
        }
 
        /* Check BAR sizes */
-       if (pci_resource_len(pdev, SRAM_BAR_ID) != SRAM_BAR_SIZE) {
-               dev_err(hdev->dev,
-                       "Not " HL_NAME "? BAR %d size %llu, expecting %llu\n",
-                       SRAM_BAR_ID,
-                       (unsigned long long) pci_resource_len(pdev,
-                                                       SRAM_BAR_ID),
-                       SRAM_BAR_SIZE);
+       pci_bar_size = pci_resource_len(pdev, SRAM_BAR_ID);
+
+       if (pci_bar_size != SRAM_BAR_SIZE) {
+               dev_err(hdev->dev, "Not " HL_NAME "? BAR %d size %pa, expecting %llu\n",
+                       SRAM_BAR_ID, &pci_bar_size, SRAM_BAR_SIZE);
                rc = -ENODEV;
                goto free_queue_props;
        }
 
-       if (pci_resource_len(pdev, CFG_BAR_ID) != CFG_BAR_SIZE) {
-               dev_err(hdev->dev,
-                       "Not " HL_NAME "? BAR %d size %llu, expecting %llu\n",
-                       CFG_BAR_ID,
-                       (unsigned long long) pci_resource_len(pdev,
-                                                               CFG_BAR_ID),
-                       CFG_BAR_SIZE);
+       pci_bar_size = pci_resource_len(pdev, CFG_BAR_ID);
+
+       if (pci_bar_size != CFG_BAR_SIZE) {
+               dev_err(hdev->dev, "Not " HL_NAME "? BAR %d size %pa, expecting %llu\n",
+                       CFG_BAR_ID, &pci_bar_size, CFG_BAR_SIZE);
                rc = -ENODEV;
                goto free_queue_props;
        }
index 9bde01de4fcfca71c6dfb8df0a268337c942f3d0..3255d2044c6cfbeea8c002556f1664d63525ab56 100644 (file)
@@ -608,6 +608,7 @@ static int goya_early_init(struct hl_device *hdev)
 {
        struct asic_fixed_properties *prop = &hdev->asic_prop;
        struct pci_dev *pdev = hdev->pdev;
+       resource_size_t pci_bar_size;
        u32 fw_boot_status, val;
        int rc;
 
@@ -618,24 +619,20 @@ static int goya_early_init(struct hl_device *hdev)
        }
 
        /* Check BAR sizes */
-       if (pci_resource_len(pdev, SRAM_CFG_BAR_ID) != CFG_BAR_SIZE) {
-               dev_err(hdev->dev,
-                       "Not " HL_NAME "? BAR %d size %llu, expecting %llu\n",
-                       SRAM_CFG_BAR_ID,
-                       (unsigned long long) pci_resource_len(pdev,
-                                                       SRAM_CFG_BAR_ID),
-                       CFG_BAR_SIZE);
+       pci_bar_size = pci_resource_len(pdev, SRAM_CFG_BAR_ID);
+
+       if (pci_bar_size != CFG_BAR_SIZE) {
+               dev_err(hdev->dev, "Not " HL_NAME "? BAR %d size %pa, expecting %llu\n",
+                       SRAM_CFG_BAR_ID, &pci_bar_size, CFG_BAR_SIZE);
                rc = -ENODEV;
                goto free_queue_props;
        }
 
-       if (pci_resource_len(pdev, MSIX_BAR_ID) != MSIX_BAR_SIZE) {
-               dev_err(hdev->dev,
-                       "Not " HL_NAME "? BAR %d size %llu, expecting %llu\n",
-                       MSIX_BAR_ID,
-                       (unsigned long long) pci_resource_len(pdev,
-                                                               MSIX_BAR_ID),
-                       MSIX_BAR_SIZE);
+       pci_bar_size = pci_resource_len(pdev, MSIX_BAR_ID);
+
+       if (pci_bar_size != MSIX_BAR_SIZE) {
+               dev_err(hdev->dev, "Not " HL_NAME "? BAR %d size %pa, expecting %llu\n",
+                       MSIX_BAR_ID, &pci_bar_size, MSIX_BAR_SIZE);
                rc = -ENODEV;
                goto free_queue_props;
        }