Skip to contentSkip to conversation

spi: fix spi-atmel.c printk format warnings

PATCH Applied Randy Dunlap 4 participants 5 messages Mar 21, 2014

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

PATCH 1/1 spi: fix spi-atmel.c printk format warnings

From: Randy Dunlap <[email protected]>

Fix printk format warning by using %p extension 'ad' for dma_addr_t.

drivers/spi/spi-atmel.c:1228:3: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t' [-Wformat] drivers/spi/spi-atmel.c:1228:3: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'dma_addr_t' [-Wformat]

Cc Wenyou Yang <[email protected]>
Cc Nicolas Ferre <[email protected]>
---
 drivers/spi/spi-atmel.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

I thought that a patch for this was already posted but I can't find it... Applies to mainline.

drivers/spi/spi-atmel.c +3 -3
@@ -1226,10 +1226,10 @@ static int atmel_spi_transfer_one_messag
 
 	list_for_each_entry(xfer, &msg->transfers, transfer_list) {
 		dev_dbg(&spi->dev,
-			"  xfer %p: len %u tx %p/%08x rx %p/%08x\n",
+			"  xfer %p: len %u tx %p/%pad rx %p/%pad\n",
 			xfer, xfer->len,
-			xfer->tx_buf, xfer->tx_dma,
-			xfer->rx_buf, xfer->rx_dma);
+			xfer->tx_buf, &xfer->tx_dma,
+			xfer->rx_buf, &xfer->rx_dma);
 	}
 
 msg_done:
Acked-by on v1 1/1
#1 lore raw

On 21/03/2014 16:53, Randy Dunlap :

Quoted 10 lines

From: Randy Dunlap <[email protected]>

Fix printk format warning by using %p extension 'ad' for dma_addr_t.

drivers/spi/spi-atmel.c:1228:3: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t' [-Wformat] drivers/spi/spi-atmel.c:1228:3: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'dma_addr_t' [-Wformat]

Cc Wenyou Yang <[email protected]>
Cc Nicolas Ferre <[email protected]>
Quoted 25 lines
---
 drivers/spi/spi-atmel.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

I thought that a patch for this was already posted but I can't find it... Applies to mainline.

drivers/spi/spi-atmel.c +3 -3
@@ -1226,10 +1226,10 @@ static int atmel_spi_transfer_one_messag
 
 	list_for_each_entry(xfer, &msg->transfers, transfer_list) {
 		dev_dbg(&spi->dev,
-			"  xfer %p: len %u tx %p/%08x rx %p/%08x\n",
+			"  xfer %p: len %u tx %p/%pad rx %p/%pad\n",
 			xfer, xfer->len,
-			xfer->tx_buf, xfer->tx_dma,
-			xfer->rx_buf, xfer->rx_dma);
+			xfer->tx_buf, &xfer->tx_dma,
+			xfer->rx_buf, &xfer->rx_dma);
 	}
 
 msg_done:
Signature · 5 lines
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

rfc: vsprintf and phys_addr_t and dma_addr_t via %pa (was Re: [PATCH] spi: fix spi-atmel.c printk format warnings)

In reply to Randy Dunlap

(Adding Stepan Moskovchenko who added %pa to vsprintf)

Quoted 1 line · Randy Dunlap

Fix printk format warning by using %p extension 'ad' for dma_addr_t.

Hey Randy, Stepan and everyone else as well.

One of the things I'd like to get straightened out before too many of these dma_addr_t conversions are done is whether or not it should be prefixed by 0x.

%pad is not a direct replacement for %08x or %016x. It changes the output.

Right now, all phys_addr_t and dma_addr_t types emitted using %pa[pd] are "SPECIAL", meaning these are prefixed with "0x".

No other pointer/address types have that "0x" prefix.

I'd prefer to remove the "SPECIAL" from the %pa extension so that the output form of pointer/address types are consistent.

This would change several output lines already using %pa.

I don't think that's bad, but maybe others do.

Thoughts?

---
 lib/vsprintf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/vsprintf.c +3 -3
index 185b6d3..28fee91 100644
@@ -1161,18 +1161,18 @@ char *address_val(char *buf, char *end, const void *addr,
 {
 	unsigned long long num;
 
-	spec.flags |= SPECIAL | SMALL | ZEROPAD;
+	spec.flags |= SMALL | ZEROPAD;
 	spec.base = 16;
 
 	switch (fmt[1]) {
 	case 'd':
 		num = *(const dma_addr_t *)addr;
-		spec.field_width = sizeof(dma_addr_t) * 2 + 2;
+		spec.field_width = sizeof(dma_addr_t) * 2;
 		break;
 	case 'p':
 	default:
 		num = *(const phys_addr_t *)addr;
-		spec.field_width = sizeof(phys_addr_t) * 2 + 2;
+		spec.field_width = sizeof(phys_addr_t) * 2;
 		break;
 	}
 
Quoted 27 lines

drivers/spi/spi-atmel.c:1228:3: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t' [-Wformat] drivers/spi/spi-atmel.c:1228:3: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'dma_addr_t' [-Wformat]

Cc Wenyou Yang <[email protected]>
Cc Nicolas Ferre <[email protected]>
---
 drivers/spi/spi-atmel.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

I thought that a patch for this was already posted but I can't find it... Applies to mainline.

drivers/spi/spi-atmel.c +3 -3
@@ -1226,10 +1226,10 @@ static int atmel_spi_transfer_one_messag
 
 	list_for_each_entry(xfer, &msg->transfers, transfer_list) {
 		dev_dbg(&spi->dev,
-			"  xfer %p: len %u tx %p/%08x rx %p/%08x\n",
+			"  xfer %p: len %u tx %p/%pad rx %p/%pad\n",
 			xfer, xfer->len,
-			xfer->tx_buf, xfer->tx_dma,
-			xfer->rx_buf, xfer->rx_dma);
+			xfer->tx_buf, &xfer->tx_dma,
+			xfer->rx_buf, &xfer->rx_dma);
 	}
author Acked-by
#3 lore raw

Re: rfc: vsprintf and phys_addr_t and dma_addr_t via %pa (was Re: [PATCH] spi: fix spi-atmel.c printk format warnings)

Quoted 18 lines · Joe Perches

(Adding Stepan Moskovchenko who added %pa to vsprintf)

Quoted 1 line · Randy Dunlap

Fix printk format warning by using %p extension 'ad' for dma_addr_t.

Hey Randy, Stepan and everyone else as well.

One of the things I'd like to get straightened out before too many of these dma_addr_t conversions are done is whether or not it should be prefixed by 0x.

%pad is not a direct replacement for %08x or %016x. It changes the output.

Right now, all phys_addr_t and dma_addr_t types emitted using %pa[pd] are "SPECIAL", meaning these are prefixed with "0x".

Quoted 5 lines

No other pointer/address types have that "0x" prefix.

I'd prefer to remove the "SPECIAL" from the %pa extension so that the output form of pointer/address types are consistent.

I agree.

for Joe's patch:

Quoted 68 lines

This would change several output lines already using %pa.

I don't think that's bad, but maybe others do.

Thoughts?

---
 lib/vsprintf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/vsprintf.c +3 -3
index 185b6d3..28fee91 100644
@@ -1161,18 +1161,18 @@ char *address_val(char *buf, char *end, const void *addr,
 {
 	unsigned long long num;
 
-	spec.flags |= SPECIAL | SMALL | ZEROPAD;
+	spec.flags |= SMALL | ZEROPAD;
 	spec.base = 16;
 
 	switch (fmt[1]) {
 	case 'd':
 		num = *(const dma_addr_t *)addr;
-		spec.field_width = sizeof(dma_addr_t) * 2 + 2;
+		spec.field_width = sizeof(dma_addr_t) * 2;
 		break;
 	case 'p':
 	default:
 		num = *(const phys_addr_t *)addr;
-		spec.field_width = sizeof(phys_addr_t) * 2 + 2;
+		spec.field_width = sizeof(phys_addr_t) * 2;
 		break;
 	}
 
Quoted 19 lines

drivers/spi/spi-atmel.c:1228:3: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t' [-Wformat] drivers/spi/spi-atmel.c:1228:3: warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'dma_addr_t' [-Wformat]

Cc Wenyou Yang <[email protected]>
Cc Nicolas Ferre <[email protected]>
---
 drivers/spi/spi-atmel.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

I thought that a patch for this was already posted but I can't find it... Applies to mainline.

drivers/spi/spi-atmel.c +0 -0
@@ -1226,10 +1226,10 @@ static int atmel_spi_transfer_one_messag
 

drivers/spi/spi-atmel.c static int atmel_spi_transfer_one_messag · line 1233

Quoted 10 lines
drivers/spi/spi-atmel.c +3 -3
 	list_for_each_entry(xfer, &msg->transfers, transfer_list) {
 		dev_dbg(&spi->dev,
-			"  xfer %p: len %u tx %p/%08x rx %p/%08x\n",
+			"  xfer %p: len %u tx %p/%pad rx %p/%pad\n",
 			xfer, xfer->len,
-			xfer->tx_buf, xfer->tx_dma,
-			xfer->rx_buf, xfer->rx_dma);
+			xfer->tx_buf, &xfer->tx_dma,
+			xfer->rx_buf, &xfer->rx_dma);
 	}

--

Signature · 5 lines
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer Applied
#4 lore raw
In reply to Randy Dunlap
Quoted 3 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

Fix printk format warning by using %p extension 'ad' for dma_addr_t.

Applied, thanks. Please try to use subject lines matching the style for the subsystem.