Skip to contentSkip to conversation

habanalabs: use %pad for printing a dma_addr_t

PATCH Applied Arnd Bergmann 2 participants 3 messages Jul 8, 2019 – Jul 9, 2019 Char and misc drivers

lore
Share & tools
lore

Arnd Bergmann

author maintainer
#0 lore raw

PATCH 1/1 habanalabs: use %pad for printing a dma_addr_t

dma_addr_t might be different sizes depending on the configuration, so we cannot print it as %llx:

drivers/misc/habanalabs/goya/goya.c: In function 'goya_sw_init':
drivers/misc/habanalabs/goya/goya.c:698:21: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'dma_addr_t' {aka 'unsigned int'} [-Werror=format=]

Use the special %pad format string. This requires passing the argument by reference.

Fixes 2a51558c8c7f ("habanalabs: remove DMA mask hack for Goya")
---
 drivers/misc/habanalabs/goya/goya.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/goya/goya.c +2 -2
index 75294ec65257..60e509f64051 100644
@@ -695,8 +695,8 @@ static int goya_sw_init(struct hl_device *hdev)
 		goto free_dma_pool;
 	}
 
-	dev_dbg(hdev->dev, "cpu accessible memory at bus address 0x%llx\n",
-		hdev->cpu_accessible_dma_address);
+	dev_dbg(hdev->dev, "cpu accessible memory at bus address %pad\n",
+		&hdev->cpu_accessible_dma_address);
 
 	hdev->cpu_accessible_dma_pool = gen_pool_create(ilog2(32), -1);
 	if (!hdev->cpu_accessible_dma_pool) {
Signature · 1 line
2.20.0
Reviewed-by on v1 1/1 Applied
#1 lore raw
Quoted 32 lines · Arnd Bergmann

dma_addr_t might be different sizes depending on the configuration, so we cannot print it as %llx:

drivers/misc/habanalabs/goya/goya.c: In function 'goya_sw_init':
drivers/misc/habanalabs/goya/goya.c:698:21: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'dma_addr_t' {aka 'unsigned int'} [-Werror=format=]

Use the special %pad format string. This requires passing the argument by reference.

Fixes 2a51558c8c7f ("habanalabs: remove DMA mask hack for Goya")
---
 drivers/misc/habanalabs/goya/goya.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/goya/goya.c +2 -3
index 75294ec65257..60e509f64051 100644
@@ -695,8 +695,8 @@ static int goya_sw_init(struct hl_device *hdev)
                goto free_dma_pool;
        }
 
-       dev_dbg(hdev->dev, "cpu accessible memory at bus address 0x%llx\n",
-               hdev->cpu_accessible_dma_address);
+       dev_dbg(hdev->dev, "cpu accessible memory at bus address %pad\n",
+               &hdev->cpu_accessible_dma_address);
 
        hdev->cpu_accessible_dma_pool = gen_pool_create(ilog2(32), -1);
        if (!hdev->cpu_accessible_dma_pool) {
--
Quoted 2 lines

2.20.0

This patch is:

Thanks! applied to -next

#2 lore raw
Quoted 38 lines · Oded Gabbay
Quoted 32 lines · Arnd Bergmann

dma_addr_t might be different sizes depending on the configuration, so we cannot print it as %llx:

drivers/misc/habanalabs/goya/goya.c: In function 'goya_sw_init':
drivers/misc/habanalabs/goya/goya.c:698:21: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'dma_addr_t' {aka 'unsigned int'} [-Werror=format=]

Use the special %pad format string. This requires passing the argument by reference.

Fixes 2a51558c8c7f ("habanalabs: remove DMA mask hack for Goya")
---
 drivers/misc/habanalabs/goya/goya.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/habanalabs/goya/goya.c +2 -3
index 75294ec65257..60e509f64051 100644
@@ -695,8 +695,8 @@ static int goya_sw_init(struct hl_device *hdev)
                goto free_dma_pool;
        }
 
-       dev_dbg(hdev->dev, "cpu accessible memory at bus address 0x%llx\n",
-               hdev->cpu_accessible_dma_address);
+       dev_dbg(hdev->dev, "cpu accessible memory at bus address %pad\n",
+               &hdev->cpu_accessible_dma_address);
 
        hdev->cpu_accessible_dma_pool = gen_pool_create(ilog2(32), -1);
        if (!hdev->cpu_accessible_dma_pool) {
--
Quoted 2 lines

2.20.0

This patch is:

Quoted 3 lines

Thanks! applied to -next

Sorry, meant -fixes of course.