All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Kukjin Kim <kgene@kernel.org>,
	Mark Brown <broonie@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ARM: samsung: improve static dma_mask definition
Date: Thu, 12 May 2016 10:38:31 +0200	[thread overview]
Message-ID: <1463042333-281444-1-git-send-email-arnd@arndb.de> (raw)

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

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: samsung: improve static dma_mask definition
Date: Thu, 12 May 2016 10:38:31 +0200	[thread overview]
Message-ID: <1463042333-281444-1-git-send-email-arnd@arndb.de> (raw)

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

             reply	other threads:[~2016-05-12  8:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12  8:38 Arnd Bergmann [this message]
2016-05-12  8:38 ` [PATCH] ARM: samsung: improve static dma_mask definition Arnd Bergmann
2016-05-18 15:01 ` Krzysztof Kozlowski
2016-05-18 15:01   ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1463042333-281444-1-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.