Skip to contentSkip to conversation

i2c: pmcmsp: Use proper printk format for resource_size_t

PATCH Applied Krzysztof Kozlowski 2 participants 9 messages Jan 14, 2020 – Jan 15, 2020

Subsystems (2)

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 i2c: pmcmsp: Use proper printk format for resource_size_t

resource_size_t should be printed with its own size-independent format to fix warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):

drivers/i2c/busses/i2c-pmcmsp.c: In function ‘pmcmsptwi_probe’:
drivers/i2c/busses/i2c-pmcmsp.c:276:25: warning:
format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘resource_size_t {aka long long unsigned int}’ [-Wformat=]

---

Changes since v1:
1. Use %pap, not %pa[p].

---
 drivers/i2c/busses/i2c-pmcmsp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-pmcmsp.c +3 -3
index 4fde74eb34a7..9a2acf09f1cf 100644
@@ -274,8 +274,8 @@ static int pmcmsptwi_probe(struct platform_device *pldev)
 	if (!request_mem_region(res->start, resource_size(res),
 				pldev->name)) {
 		dev_err(&pldev->dev,
-			"Unable to get memory/io address region 0x%08x\n",
-			res->start);
+			"Unable to get memory/io address region %pap\n",
+			&(res->start));
 		rc = -EBUSY;
 		goto ret_err;
 	}
@@ -285,7 +285,7 @@ static int pmcmsptwi_probe(struct platform_device *pldev)
 						resource_size(res));
 	if (!pmcmsptwi_data.iobase) {
 		dev_err(&pldev->dev,
-			"Unable to ioremap address 0x%08x\n", res->start);
+			"Unable to ioremap address %pap\n", &(res->start));
 		rc = -EIO;
 		goto ret_unreserve;
 	}
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/4 i2c: pnx: Use proper printk format for resource_size_t

resource_size_t should be printed with its own size-independent format to fix warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):

drivers/i2c/busses/i2c-pnx.c: In function ‘i2c_pnx_probe’:
drivers/i2c/busses/i2c-pnx.c:737:47: warning:
format ‘%x’ expects argument of type ‘unsigned int’,
but argument 5 has type ‘resource_size_t {aka long long unsigned int}’ [-Wformat=]

---

Changes since v1:
1. Use %pap, not %pa[p].

---
 drivers/i2c/busses/i2c-pnx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-pnx.c +2 -2
index 6e0e546ef83f..79bb1c68d485 100644
@@ -734,8 +734,8 @@ static int i2c_pnx_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto out_clock;
 
-	dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
-		alg_data->adapter.name, res->start, alg_data->irq);
+	dev_dbg(&pdev->dev, "%s: Master at %pap, irq %d.\n",
+		alg_data->adapter.name, &(res->start), alg_data->irq);
 
 	return 0;
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 3/4 i2c: highlander: Use proper printk format for iomem pointer

In reply to Krzysztof Kozlowski

iomem pointers should be printed with pointer format to hide the actual value and fix warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):

drivers/i2c/busses/i2c-highlander.c: In function ‘highlander_i2c_smbus_xfer’:
drivers/i2c/busses/i2c-highlander.c:325:22: warning:
format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]

---

Changes since v1:
1. None

---
 drivers/i2c/busses/i2c-highlander.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-highlander.c +1 -1
index abfe3094c047..803dad70e2a7 100644
@@ -322,7 +322,7 @@ static int highlander_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr,
 		tmp |= (SMMR_MODE0 | SMMR_MODE1);
 		break;
 	default:
-		dev_err(dev->dev, "unsupported xfer size %d\n", dev->buf_len);
+		dev_err(dev->dev, "unsupported xfer size %zu\n", dev->buf_len);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.7.4
#3 lore raw

Re: [PATCH v2 3/4] i2c: highlander: Use proper printk format for iomem pointer

Quoted 10 lines · Krzysztof Kozlowski

iomem pointers should be printed with pointer format to hide the actual value and fix warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):

drivers/i2c/busses/i2c-highlander.c: In function ‘highlander_i2c_smbus_xfer’:
drivers/i2c/busses/i2c-highlander.c:325:22: warning:
format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]

Wrong commit message. buf_len is size_t and not an iomem pointer.

Quoted 24 lines

---

Changes since v1:
1. None

---
 drivers/i2c/busses/i2c-highlander.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-highlander.c +1 -1
index abfe3094c047..803dad70e2a7 100644
@@ -322,7 +322,7 @@ static int highlander_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr,
 		tmp |= (SMMR_MODE0 | SMMR_MODE1);
 		break;
 	default:
-		dev_err(dev->dev, "unsupported xfer size %d\n", dev->buf_len);
+		dev_err(dev->dev, "unsupported xfer size %zu\n", dev->buf_len);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.7.4

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw

Re: [PATCH v2 3/4] i2c: highlander: Use proper printk format for iomem pointer

Quoted 5 lines · Wolfram Sang
Quoted 4 lines · Krzysztof Kozlowski

iomem pointers should be printed with pointer format to hide the actual value and fix warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):

Quoted 8 lines
Quoted 6 lines

drivers/i2c/busses/i2c-highlander.c: In function ‘highlander_i2c_smbus_xfer’:
drivers/i2c/busses/i2c-highlander.c:325:22: warning:
format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘size_t {aka long unsigned int}’ [-Wformat=]

Wrong commit message. buf_len is size_t and not an iomem pointer.

I'll fix it up.

Best regards,
Krzysztof

#5 lore raw

PATCH v2 4/4 i2c: stu300: Use proper printk format for iomem pointer

In reply to Krzysztof Kozlowski

iomem pointers should be printed with pointer format to hide the actual value and fix warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):

drivers/i2c/busses/i2c-stu300.c: In function ‘stu300_wait_while_busy’:
drivers/i2c/busses/i2c-stu300.c:446:76: warning:
cast from pointer to integer of different size [-Wpointer-to-int-cast]

---

Changes since v1:
1. Add Linus' review tag.

---
 drivers/i2c/busses/i2c-stu300.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-stu300.c +1 -1
index 8c3e2d409d63..42e0a53e7fa4 100644
@@ -444,7 +444,7 @@ static int stu300_wait_while_busy(struct stu300_dev *dev)
 		       "Attempt: %d\n", i+1);
 
 		dev_err(&dev->pdev->dev, "base address = "
-			"0x%08x, reinit hardware\n", (u32) dev->virtbase);
+			"0x%p, reinit hardware\n", dev->virtbase);
 
 		(void) stu300_init_hw(dev);
 	}
Signature · 1 line
2.7.4
Applied
#6 lore raw

Re: [PATCH v2 4/4] i2c: stu300: Use proper printk format for iomem pointer

Quoted 11 lines · Krzysztof Kozlowski

iomem pointers should be printed with pointer format to hide the actual value and fix warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):

drivers/i2c/busses/i2c-stu300.c: In function ‘stu300_wait_while_busy’:
drivers/i2c/busses/i2c-stu300.c:446:76: warning:
cast from pointer to integer of different size [-Wpointer-to-int-cast]

Applied to for-next, thanks!

#7 lore raw
In reply to Krzysztof Kozlowski

drivers/i2c/busses/i2c-pmcmsp.c static int pmcmsptwi_probe(struct platform_device *pldev) · line 278

Quoted 3 lines
drivers/i2c/busses/i2c-pmcmsp.c +2 -0
+			"Unable to get memory/io address region %pap\n",
+			&(res->start));

My first thought was "parens not needed"; not because I like being picky but because it doesn't look more readable to me.

checkpatch agrees:

CHECK: Unnecessary parentheses around res->start
#30: FILE: drivers/i2c/busses/i2c-pmcmsp.c:278:
+ &(res->start));

#8 lore raw

drivers/i2c/busses/i2c-pmcmsp.c static int pmcmsptwi_probe(struct platform_device *pldev) · line 278

Quoted 12 lines · Wolfram Sang

drivers/i2c/busses/i2c-pmcmsp.c static int pmcmsptwi_probe(struct platform_device *pldev) · line 278

Quoted 3 lines
drivers/i2c/busses/i2c-pmcmsp.c +2 -0
+			"Unable to get memory/io address region %pap\n",
+			&(res->start));

My first thought was "parens not needed"; not because I like being picky but because it doesn't look more readable to me.

checkpatch agrees:

CHECK: Unnecessary parentheses around res->start
#30: FILE: drivers/i2c/busses/i2c-pmcmsp.c:278:

drivers/i2c/busses/i2c-pmcmsp.c +1 -0
+			&(res->start));

Indeed... let me send v3.

Best regards,
Krzysztof