linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: samsung: improve static dma_mask definition
@ 2016-05-12  8:38 Arnd Bergmann
  2016-05-18 15:01 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2016-05-12  8:38 UTC (permalink / raw)
  To: linux-arm-kernel

When no DMA master devices are part of the kernel configuration,
we get a warning about the unused dma mask definition:

arch/arm/plat-samsung/devs.c:71:12: error: 'samsung_device_dma_mask' defined but not used [-Werror=unused-variable]
 static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);

We could simply mark this as __maybe_unused to shut up that warning,
but a nicer solution seems to be to have a separate mask for each
device. The advantage is that a driver that happens to call
dma_set_mask() on one device doesn't implicitly change the mask
for the other devices as well. This is more of a theoretical
problem, as obviously nothing does it for the devices in this
file (or they would have always been broken), but it feels
cleaner that way.

The definition works by creating an array in place so we can take
the address of it and let the compiler generate a hidden symbol
for it at compile time.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/plat-samsung/devs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index 84baa16f4c0b..e93aa6734147 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -68,7 +68,7 @@
 #include <linux/platform_data/asoc-s3c.h>
 #include <linux/platform_data/spi-s3c64xx.h>
 
-static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);
+#define samsung_device_dma_mask (*((u64[]) { DMA_BIT_MASK(32) }))
 
 /* AC97 */
 #ifdef CONFIG_CPU_S3C2440
-- 
2.7.0

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

end of thread, other threads:[~2016-05-18 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-12  8:38 [PATCH] ARM: samsung: improve static dma_mask definition Arnd Bergmann
2016-05-18 15:01 ` Krzysztof Kozlowski

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).