Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: Allow to specify composite modules with modname-m

This allows to write

drm-$(CONFIG_AGP) += drm_agpsupport.o

without having to handle CONFIG_AGP=y vs. CONFIG_AGP=m. Only support
this syntax for modules, since built-in code depending on something
modular cannot work and init/Makefile actually relies on the current
semantics. There are a few drivers which adapted to the current
semantics out of necessity; these are fixed to also work when the
respective subsystem is modular.

Acked-by: Peter Chen <peter.chen@freescale.com> [chipidea]
Signed-off-by: Michal Marek <mmarek@suse.com>

+11 -7
+1 -1
drivers/misc/ibmasm/ibmasm.h
··· 211 211 void ibmasmfs_add_sp(struct service_processor *sp); 212 212 213 213 /* uart */ 214 - #ifdef CONFIG_SERIAL_8250 214 + #if IS_ENABLED(CONFIG_SERIAL_8250) 215 215 void ibmasm_register_uart(struct service_processor *sp); 216 216 void ibmasm_unregister_uart(struct service_processor *sp); 217 217 #else
+1 -1
drivers/usb/chipidea/otg_fsm.h
··· 62 62 /* SSEND time before SRP */ 63 63 #define TB_SSEND_SRP (1500) /* minimum 1.5 sec, section:5.1.2 */ 64 64 65 - #ifdef CONFIG_USB_OTG_FSM 65 + #if IS_ENABLED(CONFIG_USB_OTG_FSM) 66 66 67 67 int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci); 68 68 int ci_otg_fsm_work(struct ci_hdrc *ci);
+1 -1
fs/logfs/logfs.h
··· 485 485 #endif 486 486 487 487 /* dev_mtd.c */ 488 - #ifdef CONFIG_MTD 488 + #if IS_ENABLED(CONFIG_MTD) 489 489 int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr); 490 490 #else 491 491 static inline int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)
+6 -2
scripts/Makefile.build
··· 372 372 # <composite-object>-objs := <list of .o files> 373 373 # or 374 374 # <composite-object>-y := <list of .o files> 375 + # or 376 + # <composite-object>-m := <list of .o files> 377 + # The -m syntax only works if <composite object> is a module 375 378 link_multi_deps = \ 376 379 $(filter $(addprefix $(obj)/, \ 377 380 $($(subst $(obj)/,,$(@:.o=-objs))) \ 378 - $($(subst $(obj)/,,$(@:.o=-y)))), $^) 381 + $($(subst $(obj)/,,$(@:.o=-y))) \ 382 + $($(subst $(obj)/,,$(@:.o=-m)))), $^) 379 383 380 384 quiet_cmd_link_multi-y = LD $@ 381 385 cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) ··· 394 390 $(multi-used-m): FORCE 395 391 $(call if_changed,link_multi-m) 396 392 @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod) 397 - $(call multi_depend, $(multi-used-m), .o, -objs -y) 393 + $(call multi_depend, $(multi-used-m), .o, -objs -y -m) 398 394 399 395 targets += $(multi-used-y) $(multi-used-m) 400 396
+2 -2
scripts/Makefile.lib
··· 48 48 49 49 # if $(foo-objs) exists, foo.o is a composite object 50 50 multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) 51 - multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) 51 + multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) 52 52 multi-used := $(multi-used-y) $(multi-used-m) 53 53 single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) 54 54 ··· 67 67 68 68 # Replace multi-part objects by their individual parts, look at local dir only 69 69 real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) 70 - real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) 70 + real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) 71 71 72 72 # Add subdir path 73 73