linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] crypto: sahara: fix 64-bit dma_addr_t compilation
@ 2015-12-08 15:23 Arnd Bergmann
  2015-12-08 15:24 ` [PATCH 2/2] crypto: sahara: fix debug output for 64-bit dma_addr_t Arnd Bergmann
  2015-12-11  3:00 ` [PATCH 1/2] crypto: sahara: fix 64-bit dma_addr_t compilation Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2015-12-08 15:23 UTC (permalink / raw)
  To: Herbert Xu, linux-crypto; +Cc: David S. Miller, linux-kernel, linux-arm-kernel

The sahara hardware uses DMA descriptors with 32-bit addresses, but
dma_addr_t is variable size depending on whether we want to support
any devices that use 64-bit DMA addresses in hardware.
This means that the definition of the DMA descriptor structure is wrong,
and we helpfully get a compiler warning about them too:

drivers/crypto/sahara.c:423:372: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]

This changes the definition of the sahara_hw_desc and sahara_hw_link
structures to only contain fixed-length members, which is required
to make the driver work on ARM LPAE mode, and avoids most of the
gcc warnings we get.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/crypto/sahara.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index cc738f3592a3..38bf12ae5589 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -130,18 +130,18 @@
 #define SAHARA_REG_IDAR		0x20
 
 struct sahara_hw_desc {
-	u32		hdr;
-	u32		len1;
-	dma_addr_t	p1;
-	u32		len2;
-	dma_addr_t	p2;
-	dma_addr_t	next;
+	u32	hdr;
+	u32	len1;
+	u32	p1;
+	u32	len2;
+	u32	p2;
+	u32	next;
 };
 
 struct sahara_hw_link {
-	u32		len;
-	dma_addr_t	p;
-	dma_addr_t	next;
+	u32	len;
+	u32	p;
+	u32	next;
 };
 
 struct sahara_ctx {
-- 
2.1.0.rc2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] crypto: sahara: fix debug output for 64-bit dma_addr_t
  2015-12-08 15:23 [PATCH 1/2] crypto: sahara: fix 64-bit dma_addr_t compilation Arnd Bergmann
@ 2015-12-08 15:24 ` Arnd Bergmann
  2015-12-11  3:00 ` [PATCH 1/2] crypto: sahara: fix 64-bit dma_addr_t compilation Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2015-12-08 15:24 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-crypto, David S. Miller, linux-kernel, linux-arm-kernel

The sahara_dump_descriptors and sahara_dump_links functions attempt
to print a dma_addr_t value with a 0x%08x format string, which
produces a warning when dma_addr_t is 64-bit wide:

drivers/crypto/sahara.c:419:120: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]

This changes the code to use the %pad format string that is meant
for dma_addr_t, which avoids the warning and gives us the correct
output in all configurations.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/crypto/sahara.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index 38bf12ae5589..6c4f91c5e6b3 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -416,8 +416,8 @@ static void sahara_dump_descriptors(struct sahara_dev *dev)
 		return;
 
 	for (i = 0; i < SAHARA_MAX_HW_DESC; i++) {
-		dev_dbg(dev->device, "Descriptor (%d) (0x%08x):\n",
-			i, dev->hw_phys_desc[i]);
+		dev_dbg(dev->device, "Descriptor (%d) (%pad):\n",
+			i, &dev->hw_phys_desc[i]);
 		dev_dbg(dev->device, "\thdr = 0x%08x\n", dev->hw_desc[i]->hdr);
 		dev_dbg(dev->device, "\tlen1 = %u\n", dev->hw_desc[i]->len1);
 		dev_dbg(dev->device, "\tp1 = 0x%08x\n", dev->hw_desc[i]->p1);
@@ -437,8 +437,8 @@ static void sahara_dump_links(struct sahara_dev *dev)
 		return;
 
 	for (i = 0; i < SAHARA_MAX_HW_LINK; i++) {
-		dev_dbg(dev->device, "Link (%d) (0x%08x):\n",
-			i, dev->hw_phys_link[i]);
+		dev_dbg(dev->device, "Link (%d) (%pad):\n",
+			i, &dev->hw_phys_link[i]);
 		dev_dbg(dev->device, "\tlen = %u\n", dev->hw_link[i]->len);
 		dev_dbg(dev->device, "\tp = 0x%08x\n", dev->hw_link[i]->p);
 		dev_dbg(dev->device, "\tnext = 0x%08x\n",
-- 
2.1.0.rc2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] crypto: sahara: fix 64-bit dma_addr_t compilation
  2015-12-08 15:23 [PATCH 1/2] crypto: sahara: fix 64-bit dma_addr_t compilation Arnd Bergmann
  2015-12-08 15:24 ` [PATCH 2/2] crypto: sahara: fix debug output for 64-bit dma_addr_t Arnd Bergmann
@ 2015-12-11  3:00 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2015-12-11  3:00 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-crypto, David S. Miller, linux-kernel, linux-arm-kernel

On Tue, Dec 08, 2015 at 04:23:51PM +0100, Arnd Bergmann wrote:
> The sahara hardware uses DMA descriptors with 32-bit addresses, but
> dma_addr_t is variable size depending on whether we want to support
> any devices that use 64-bit DMA addresses in hardware.
> This means that the definition of the DMA descriptor structure is wrong,
> and we helpfully get a compiler warning about them too:
> 
> drivers/crypto/sahara.c:423:372: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]
> 
> This changes the definition of the sahara_hw_desc and sahara_hw_link
> structures to only contain fixed-length members, which is required
> to make the driver work on ARM LPAE mode, and avoids most of the
> gcc warnings we get.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Both patches applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-11  3:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08 15:23 [PATCH 1/2] crypto: sahara: fix 64-bit dma_addr_t compilation Arnd Bergmann
2015-12-08 15:24 ` [PATCH 2/2] crypto: sahara: fix debug output for 64-bit dma_addr_t Arnd Bergmann
2015-12-11  3:00 ` [PATCH 1/2] crypto: sahara: fix 64-bit dma_addr_t compilation Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).