mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ACPI: Fix build errors due objects compiled unconditionally
@ 2015-11-20 17:35 Javier Martinez Canillas
  2015-12-09 23:13 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Javier Martinez Canillas @ 2015-11-20 17:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Hanjun Guo, Rafael J. Wysocki, linux-acpi, Arnd Bergmann,
	Al Stone, Len Brown, Javier Martinez Canillas

If the CONFIG_ACPI Kconfig symbol is not enabled and a partial build is
attempted, compile errors will happen due missing types and identifiers.

This can be easily reproduced with the following commands:

$ export CROSS_COMPILE="arm-linux-gnueabihf-" ARCH=arm
$ make allmodconfig
$ make M=drivers/acpi/
  CC      drivers/acpi//tables.o
drivers/acpi//tables.c:235:3: warning: 'struct acpi_subtable_proc' declared inside parameter list
   unsigned int max_entries)
   ^
drivers/acpi//tables.c:235:3: warning: its scope is only this definition or declaration, which is probably not what you want
drivers/acpi//tables.c: In function 'acpi_parse_entries_array':
drivers/acpi//tables.c:269:4: error: invalid use of undefined type 'struct acpi_subtable_proc'
...
scripts/Makefile.build:258: recipe for target 'drivers/acpi//tables.o' failed
make[1]: *** [drivers/acpi//tables.o] Error 1
Makefile:1401: recipe for target '_module_drivers/acpi/' failed
make: *** [_module_drivers/acpi/] Error 2

This is because objects are tried to be built unconditionally even when
CONFIG_ACPI is not enabled. This is usually not a problem since arches'
Kconfig sources drivers/acpi/Kconfig directly and also selects ACPI but
the Makefile should conditionally build the objects as well to prevent
these build errors.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---
Hello,

I posted this patch first as an RFC more than a month ago [0]
and got no feedback, so I'm resending without the RFC tag.

[0]: https://lkml.org/lkml/2015/10/12/859

Best regards,
Javier

 drivers/acpi/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 675eaf337178..73ec23ca7db1 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -8,13 +8,13 @@ ccflags-$(CONFIG_ACPI_DEBUG)	+= -DACPI_DEBUG_OUTPUT
 #
 # ACPI Boot-Time Table Parsing
 #
-obj-y				+= tables.o
+obj-$(CONFIG_ACPI)		+= tables.o
 obj-$(CONFIG_X86)		+= blacklist.o
 
 #
 # ACPI Core Subsystem (Interpreter)
 #
-obj-y				+= acpi.o \
+obj-$(CONFIG_ACPI)		+= acpi.o \
 					acpica/
 
 # All the builtin files are in the "acpi." module_param namespace.
@@ -66,10 +66,10 @@ obj-$(CONFIG_ACPI_FAN)		+= fan.o
 obj-$(CONFIG_ACPI_VIDEO)	+= video.o
 obj-$(CONFIG_ACPI_PCI_SLOT)	+= pci_slot.o
 obj-$(CONFIG_ACPI_PROCESSOR)	+= processor.o
-obj-y				+= container.o
+obj-$(CONFIG_ACPI)		+= container.o
 obj-$(CONFIG_ACPI_THERMAL)	+= thermal.o
 obj-$(CONFIG_ACPI_NFIT)		+= nfit.o
-obj-y				+= acpi_memhotplug.o
+obj-$(CONFIG_ACPI)		+= acpi_memhotplug.o
 obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o
 obj-$(CONFIG_ACPI_BATTERY)	+= battery.o
 obj-$(CONFIG_ACPI_SBS)		+= sbshc.o
-- 
2.4.3


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

* Re: [PATCH] ACPI: Fix build errors due objects compiled unconditionally
  2015-11-20 17:35 [PATCH] ACPI: Fix build errors due objects compiled unconditionally Javier Martinez Canillas
@ 2015-12-09 23:13 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2015-12-09 23:13 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, Hanjun Guo, linux-acpi, Arnd Bergmann, Al Stone, Len Brown

On Friday, November 20, 2015 02:35:02 PM Javier Martinez Canillas wrote:
> If the CONFIG_ACPI Kconfig symbol is not enabled and a partial build is
> attempted, compile errors will happen due missing types and identifiers.
> 
> This can be easily reproduced with the following commands:
> 
> $ export CROSS_COMPILE="arm-linux-gnueabihf-" ARCH=arm
> $ make allmodconfig
> $ make M=drivers/acpi/
>   CC      drivers/acpi//tables.o
> drivers/acpi//tables.c:235:3: warning: 'struct acpi_subtable_proc' declared inside parameter list
>    unsigned int max_entries)
>    ^
> drivers/acpi//tables.c:235:3: warning: its scope is only this definition or declaration, which is probably not what you want
> drivers/acpi//tables.c: In function 'acpi_parse_entries_array':
> drivers/acpi//tables.c:269:4: error: invalid use of undefined type 'struct acpi_subtable_proc'
> ...
> scripts/Makefile.build:258: recipe for target 'drivers/acpi//tables.o' failed
> make[1]: *** [drivers/acpi//tables.o] Error 1
> Makefile:1401: recipe for target '_module_drivers/acpi/' failed
> make: *** [_module_drivers/acpi/] Error 2
> 
> This is because objects are tried to be built unconditionally even when
> CONFIG_ACPI is not enabled. This is usually not a problem since arches'
> Kconfig sources drivers/acpi/Kconfig directly and also selects ACPI but
> the Makefile should conditionally build the objects as well to prevent
> these build errors.
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

OK, I think this shouldn't hurt anyone.

Queued up for 4.5, thanks!

Rafael


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

end of thread, other threads:[~2015-12-09 22:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20 17:35 [PATCH] ACPI: Fix build errors due objects compiled unconditionally Javier Martinez Canillas
2015-12-09 23:13 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®