Skip to content

Commit cf4f219

Browse files
author
Michal Marek
committed
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 <[email protected]> [chipidea] Signed-off-by: Michal Marek <[email protected]>
1 parent 0046a46 commit cf4f219

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

drivers/misc/ibmasm/ibmasm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void ibmasmfs_unregister(void);
211211
void ibmasmfs_add_sp(struct service_processor *sp);
212212

213213
/* uart */
214-
#ifdef CONFIG_SERIAL_8250
214+
#if IS_ENABLED(CONFIG_SERIAL_8250)
215215
void ibmasm_register_uart(struct service_processor *sp);
216216
void ibmasm_unregister_uart(struct service_processor *sp);
217217
#else

drivers/usb/chipidea/otg_fsm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
/* SSEND time before SRP */
6363
#define TB_SSEND_SRP (1500) /* minimum 1.5 sec, section:5.1.2 */
6464

65-
#ifdef CONFIG_USB_OTG_FSM
65+
#if IS_ENABLED(CONFIG_USB_OTG_FSM)
6666

6767
int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci);
6868
int ci_otg_fsm_work(struct ci_hdrc *ci);

fs/logfs/logfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ static inline int logfs_get_sb_bdev(struct logfs_super *s,
485485
#endif
486486

487487
/* dev_mtd.c */
488-
#ifdef CONFIG_MTD
488+
#if IS_ENABLED(CONFIG_MTD)
489489
int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr);
490490
#else
491491
static inline int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)

scripts/Makefile.build

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,14 @@ endif
372372
# <composite-object>-objs := <list of .o files>
373373
# or
374374
# <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
375378
link_multi_deps = \
376379
$(filter $(addprefix $(obj)/, \
377380
$($(subst $(obj)/,,$(@:.o=-objs))) \
378-
$($(subst $(obj)/,,$(@:.o=-y)))), $^)
381+
$($(subst $(obj)/,,$(@:.o=-y))) \
382+
$($(subst $(obj)/,,$(@:.o=-m)))), $^)
379383

380384
quiet_cmd_link_multi-y = LD $@
381385
cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
@@ -390,7 +394,7 @@ $(call multi_depend, $(multi-used-y), .o, -objs -y)
390394
$(multi-used-m): FORCE
391395
$(call if_changed,link_multi-m)
392396
@{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod)
393-
$(call multi_depend, $(multi-used-m), .o, -objs -y)
397+
$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
394398

395399
targets += $(multi-used-y) $(multi-used-m)
396400

scripts/Makefile.lib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ subdir-ym := $(sort $(subdir-y) $(subdir-m))
4848

4949
# if $(foo-objs) exists, foo.o is a composite object
5050
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))))
5252
multi-used := $(multi-used-y) $(multi-used-m)
5353
single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m)))
5454

@@ -67,7 +67,7 @@ obj-dirs := $(dir $(multi-objs) $(obj-y))
6767

6868
# Replace multi-part objects by their individual parts, look at local dir only
6969
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)))
7171

7272
# Add subdir path
7373

0 commit comments

Comments
 (0)