habanalabs: small code refactoring
authorKoby Elbaz <kelbaz@habana.ai>
Thu, 3 Jun 2021 10:18:20 +0000 (13:18 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Fri, 18 Jun 2021 12:23:41 +0000 (15:23 +0300)
Use datatype defines instead of hard coded values,
and rename set_fixed_properties function.

Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/device.c
drivers/misc/habanalabs/gaudi/gaudi.c
drivers/misc/habanalabs/goya/goya.c
drivers/misc/habanalabs/goya/goyaP.h

index 0056282cec943d5a225aad1e1b08e110c7f62a9e..46fcab1bf873f04f19da1162d773a15af328fd9e 100644 (file)
@@ -1395,7 +1395,7 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
 
        dev_info(hdev->dev, "Found %s device with %lluGB DRAM\n",
                hdev->asic_name,
-               hdev->asic_prop.dram_size / 1024 / 1024 / 1024);
+               hdev->asic_prop.dram_size / SZ_1G);
 
        rc = hl_vm_init(hdev);
        if (rc) {
index 9b4bd38c2986704ed8e9bfed031c16a5f936aa54..f8bf30e48bba18704720fb5e8ffe38f174773fb2 100644 (file)
@@ -410,7 +410,7 @@ static inline void set_default_power_values(struct hl_device *hdev)
        }
 }
 
-static int gaudi_get_fixed_properties(struct hl_device *hdev)
+static int gaudi_set_fixed_properties(struct hl_device *hdev)
 {
        struct asic_fixed_properties *prop = &hdev->asic_prop;
        u32 num_sync_stream_queues = 0;
@@ -655,9 +655,9 @@ static int gaudi_early_init(struct hl_device *hdev)
        u32 fw_boot_status;
        int rc;
 
-       rc = gaudi_get_fixed_properties(hdev);
+       rc = gaudi_set_fixed_properties(hdev);
        if (rc) {
-               dev_err(hdev->dev, "Failed to get fixed properties\n");
+               dev_err(hdev->dev, "Failed setting fixed properties\n");
                return rc;
        }
 
index bcefc372a68950c380749f13960490f530dd96b4..6d63930b7a10a1975b91c7b0f6499fb52e7413c2 100644 (file)
@@ -355,7 +355,7 @@ static int goya_mmu_set_dram_default_page(struct hl_device *hdev);
 static int goya_mmu_add_mappings_for_device_cpu(struct hl_device *hdev);
 static void goya_mmu_prepare(struct hl_device *hdev, u32 asid);
 
-int goya_get_fixed_properties(struct hl_device *hdev)
+int goya_set_fixed_properties(struct hl_device *hdev)
 {
        struct asic_fixed_properties *prop = &hdev->asic_prop;
        int i;
@@ -587,7 +587,7 @@ static int goya_early_init(struct hl_device *hdev)
        u32 fw_boot_status, val;
        int rc;
 
-       rc = goya_get_fixed_properties(hdev);
+       rc = goya_set_fixed_properties(hdev);
        if (rc) {
                dev_err(hdev->dev, "Failed to get fixed properties\n");
                return rc;
index ef8c6c8b5c8dc780077850fd460a76ab359de395..0b05da614729d93c738b6e81237c6293e47d2d08 100644 (file)
@@ -168,7 +168,7 @@ struct goya_device {
        u8              device_cpu_mmu_mappings_done;
 };
 
-int goya_get_fixed_properties(struct hl_device *hdev);
+int goya_set_fixed_properties(struct hl_device *hdev);
 int goya_mmu_init(struct hl_device *hdev);
 void goya_init_dma_qmans(struct hl_device *hdev);
 void goya_init_mme_qmans(struct hl_device *hdev);