Skip to contentSkip to conversation

mtd: omap_elm: print interrupt resource using %pr

PATCH Applied Arnd Bergmann 2 participants 2 messages Dec 18, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mtd: omap_elm: print interrupt resource using %pr

When CONFIG_LPAE is set on ARM, resource_size_t is 64-bit wide and we get a warning about an incorrect format string for printing the interrupt number in elm_probe:

drivers/mtd/nand/omap_elm.c: In function 'elm_probe':
drivers/mtd/nand/omap_elm.c:417:23: warning: format '%i' expects argument of type 'int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Wformat=]

This patch avoids the type mismatch by printing the interrupt as a resource using the %pr format string.

---
v2: pass correct pointer

drivers/mtd/nand/omap_elm.c +1 -1
index 235ec7992b4c..a3f32f939cc1 100644
@@ -414,7 +414,7 @@ static int elm_probe(struct platform_device *pdev)
 	ret = devm_request_irq(&pdev->dev, irq->start, elm_isr, 0,
 			pdev->name, info);
 	if (ret) {
-		dev_err(&pdev->dev, "failure requesting irq %i\n", irq->start);
+		dev_err(&pdev->dev, "failure requesting %pr\n", irq);
 		return ret;
 	}
 
Applied
#1 lore raw
Quoted 19 lines · Arnd Bergmann

When CONFIG_LPAE is set on ARM, resource_size_t is 64-bit wide and we get a warning about an incorrect format string for printing the interrupt number in elm_probe:

drivers/mtd/nand/omap_elm.c: In function 'elm_probe':
drivers/mtd/nand/omap_elm.c:417:23: warning: format '%i' expects argument of type 'int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Wformat=]

This patch avoids the type mismatch by printing the interrupt as a resource using the %pr format string.

---
v2: pass correct pointer

drivers/mtd/nand/omap_elm.c +0 -0
index 235ec7992b4c..a3f32f939cc1 100644

drivers/mtd/nand/omap_elm.c static int elm_probe(struct platform_device *pdev) · line 417

Quoted 5 lines
drivers/mtd/nand/omap_elm.c +1 -1
@@ -414,7 +414,7 @@ static int elm_probe(struct platform_device *pdev)
 	ret = devm_request_irq(&pdev->dev, irq->start, elm_isr, 0,
 			pdev->name, info);
 	if (ret) {
-		dev_err(&pdev->dev, "failure requesting irq %i\n", irq->start);
+		dev_err(&pdev->dev, "failure requesting %pr\n", irq);

FWIW, the printk documentation isn't very specific about the formatting for %pr. After drilling down to resource_string() in lib/vsprintf.c, it looks like there is special case handling for various resrouce types, even though the documentation only shows IORESOURCE_MEM types.

Applied to l2-mtd.git.

Quoted 4 lines
drivers/mtd/nand/omap_elm.c +0 -0
 		return ret;
 	}