iio: magnetometer: Only declare ACPI table when ACPI is enable
PATCH 1/1 iio: magnetometer: Only declare ACPI table when ACPI is enable
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]
--- drivers/iio/magnetometer/ak8975.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/magnetometer/ak8975.c +2 -0
@@ -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)
Signature · 1 line
2.13.1.611.g7e3b11ae1-goog
Quoted 8 lines · 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 <[email protected]>
Yours,
Linus Walleij
Jonathan Cameron
maintainerQuoted 9 lines · On Thu, 29 Jun 2017 14:51:56 +0200 Linus Walleij <[email protected]>…
Quoted 7 lines · 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]
Quoted 6 lines
Quoted 1 line
Signed-off-by Matthias Kaehlcke <[email protected]>Acked-by Linus Walleij <[email protected]>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...
El Sat, Jul 01, 2017 at 01:11:12PM +0100 Jonathan Cameron ha dit:
Quoted 12 lines
Quoted 9 lines · On Thu, 29 Jun 2017 14:51:56 +0200 Linus Walleij <[email protected]>…
Quoted 7 lines · 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]
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Matthias Kaehlcke <[email protected]>Acked-by Linus Walleij <[email protected]>Yours,
Linus WalleijApplied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks!
Quoted 4 lines
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.