linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: magnetometer: Only declare ACPI table when ACPI is enable
@ 2017-06-27  0:25 Matthias Kaehlcke
  2017-06-29 12:51 ` Linus Walleij
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Kaehlcke @ 2017-06-27  0:25 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Linus Walleij
  Cc: linux-iio, linux-kernel, dianders, Matthias Kaehlcke

Don't inflate the kernel size with data that isn't used. The conditional
declaration also fixes the following warning when building with clang:

drivers/iio/magnetometer/ak8975.c:704:36: error: variable 'ak_acpi_match'
  is not needed and will not be emitted
  [-Werror,-Wunneeded-internal-declaration]

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
 drivers/iio/magnetometer/ak8975.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index 825369fb1c57..4ff883942f7b 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -784,6 +784,7 @@ static const struct iio_info ak8975_info = {
 	.driver_module = THIS_MODULE,
 };
 
+#ifdef CONFIG_ACPI
 static const struct acpi_device_id ak_acpi_match[] = {
 	{"AK8975", AK8975},
 	{"AK8963", AK8963},
@@ -793,6 +794,7 @@ static const struct acpi_device_id ak_acpi_match[] = {
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, ak_acpi_match);
+#endif
 
 static const char *ak8975_match_acpi_device(struct device *dev,
 					    enum asahi_compass_chipset *chipset)
-- 
2.13.1.611.g7e3b11ae1-goog

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

* Re: [PATCH] iio: magnetometer: Only declare ACPI table when ACPI is enable
  2017-06-27  0:25 [PATCH] iio: magnetometer: Only declare ACPI table when ACPI is enable Matthias Kaehlcke
@ 2017-06-29 12:51 ` Linus Walleij
  2017-07-01 12:11   ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2017-06-29 12:51 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel, Doug Anderson

On Tue, Jun 27, 2017 at 2:25 AM, Matthias Kaehlcke <mka@chromium.org> wrote:

> Don't inflate the kernel size with data that isn't used. The conditional
> declaration also fixes the following warning when building with clang:
>
> drivers/iio/magnetometer/ak8975.c:704:36: error: variable 'ak_acpi_match'
>   is not needed and will not be emitted
>   [-Werror,-Wunneeded-internal-declaration]
>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH] iio: magnetometer: Only declare ACPI table when ACPI is enable
  2017-06-29 12:51 ` Linus Walleij
@ 2017-07-01 12:11   ` Jonathan Cameron
  2017-07-06 16:42     ` Matthias Kaehlcke
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2017-07-01 12:11 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Matthias Kaehlcke, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel, Doug Anderson

On Thu, 29 Jun 2017 14:51:56 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Tue, Jun 27, 2017 at 2:25 AM, Matthias Kaehlcke <mka@chromium.org> wrote:
> 
> > Don't inflate the kernel size with data that isn't used. The conditional
> > declaration also fixes the following warning when building with clang:
> >
> > drivers/iio/magnetometer/ak8975.c:704:36: error: variable 'ak_acpi_match'
> >   is not needed and will not be emitted
> >   [-Werror,-Wunneeded-internal-declaration]
> >
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>  
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Yours,
> Linus Walleij
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.

I'm curious though... Can the compiler not optimize this away? 
I'd always assumed the main reason for these warnings was that the
presence of unused data might represent a bug rather than it actually
making any difference to the size...

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

* Re: [PATCH] iio: magnetometer: Only declare ACPI table when ACPI is enable
  2017-07-01 12:11   ` Jonathan Cameron
@ 2017-07-06 16:42     ` Matthias Kaehlcke
  0 siblings, 0 replies; 4+ messages in thread
From: Matthias Kaehlcke @ 2017-07-06 16:42 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Linus Walleij, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel, Doug Anderson

El Sat, Jul 01, 2017 at 01:11:12PM +0100 Jonathan Cameron ha dit:

> On Thu, 29 Jun 2017 14:51:56 +0200
> Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> > On Tue, Jun 27, 2017 at 2:25 AM, Matthias Kaehlcke <mka@chromium.org> wrote:
> > 
> > > Don't inflate the kernel size with data that isn't used. The conditional
> > > declaration also fixes the following warning when building with clang:
> > >
> > > drivers/iio/magnetometer/ak8975.c:704:36: error: variable 'ak_acpi_match'
> > >   is not needed and will not be emitted
> > >   [-Werror,-Wunneeded-internal-declaration]
> > >
> > > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>  
> > 
> > Acked-by: Linus Walleij <linus.walleij@linaro.org>
> > 
> > Yours,
> > Linus Walleij
> Applied to the togreg branch of iio.git and pushed out as testing
> for the autobuilders to play with it.

Thanks!

> I'm curious though... Can the compiler not optimize this away? 
> I'd always assumed the main reason for these warnings was that the
> presence of unused data might represent a bug rather than it actually
> making any difference to the size...

clang actually optimizes it away: "variable 'ak_acpi_match' is not
needed and will not be emitted", my argument about inflating the
kernel size is not valid.

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

end of thread, other threads:[~2017-07-06 16:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27  0:25 [PATCH] iio: magnetometer: Only declare ACPI table when ACPI is enable Matthias Kaehlcke
2017-06-29 12:51 ` Linus Walleij
2017-07-01 12:11   ` Jonathan Cameron
2017-07-06 16:42     ` Matthias Kaehlcke

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