kbuild: build modules from code in multiple directories.
Subsystems (3)
cover kbuild: build modules from code in multiple directories.
This set of patches makes it possible to build a module from code in multiple directories without needing to list files from one directory in the Makefile of another directory.
The code was developed for lustre (which is now out-of-tree :-( ) but can be useful elsewhere, such as for xfs and btrfs and others.
In fs/xfs/Makefile the section:
xfs-y += $(addprefix libxfs/, \ xfs_ag.o \ xfs_alloc.o \ .....
could become
xfs-y += libxfs/
and then in fs/xfs/libxfs/Makefile we would have
modobj-$(CONFIG_XFS_FS) += xfs_ag.o \ xfs_alloc.o \ .....
A similar process could move filenames for scrub/* from the fs/xfs/Makefile to fs/xfs/scrub/Makefile
Apart from improving modularity, this means that partial makes such as:
make fs/xfs/libxfs/
or
make fs/xfs/scrub/attr.s
can work.
Comments and review most welcome.
Thanks,
NeilBrown
---
NeilBrown (5):
kbuild: detect directories in components of a module.
kbuild: treat a directory listed in a composite object as foo/mod.a
kbuild: support building of per-directory mod.a
kbuild: disable KBUILD_MODNAME when building for mod.a
kbuild: Add documentation for modobj-m
Documentation/kbuild/makefiles.txt | 65 ++++++++++++++++++++++++++++++++++-- scripts/Makefile.build | 57 ++++++++++++++++++++++---------- scripts/Makefile.lib | 63 ++++++++++++++++++++++------------- 3 files changed, 141 insertions(+), 44 deletions(-)
--
Signature
PATCH 1/5 kbuild: detect directories in components of a module.
This is a first step in a larger change and so can only be fully understood in the larger context.
This patch changes the code for extracting directories from a list of objects to extract them from real-obj-X instead of obj-X.
This should not cause any change in behaviour yet as listing directories as components of an object is not currently supported and will cause an error. A future patch will give a useful meaning to directories listed in componsite objects.
A consequence of this change is that any subsequent use of obj-y or obj-m will still have directories listed in it.
There are no subsequent uses of obj-y and only 2 of obj-m.
1/ obj-m is included as a dependency of __build. subdir-ym, which
contains all the directories mentioned in obj-m, is also a dependency, so this won't change the set of final dependencies.
2/ Any rule that builds a directory listed in obj-m will find that
quite_modtag has the value '[M]'. As quiet_modtag is not used when descending into directories, this is of no consequence.
--- scripts/Makefile.lib | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
scripts/Makefile.lib +19 -19
@@ -25,36 +25,36 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) # and -m subdirs. Just put -y's first. modorder := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko)) +# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object +multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) +multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) +multi-used := $(multi-used-y) $(multi-used-m) +single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) + +# Replace multi-part objects by their individual parts, +# including built-in.a from subdirectories +real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) +real-obj-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))) + # Handle objects in subdirs # --------------------------------------------------------------------------- -# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.a +# o if we encounter foo/ in $(real-obj-y), replace it by foo/built-in.a # and add the directory to the list of dirs to descend into: $(subdir-y) -# o if we encounter foo/ in $(obj-m), remove it from $(obj-m) +# o if we encounter foo/ in $(real-obj-m), remove it from $(real-obj-m) # and add the directory to the list of dirs to descend into: $(subdir-m) -__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) +__subdir-y := $(patsubst %/,%,$(filter %/, $(real-obj-y))) subdir-y += $(__subdir-y) -__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) +__subdir-m := $(patsubst %/,%,$(filter %/, $(real-obj-m))) subdir-m += $(__subdir-m) -obj-y := $(patsubst %/, %/built-in.a, $(obj-y)) -obj-m := $(filter-out %/, $(obj-m)) +real-obj-y := $(patsubst %/, %/built-in.a, $(real-obj-y)) +real-obj-m := $(filter-out %/, $(real-obj-m)) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m)) -# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object -multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) -multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) -multi-used := $(multi-used-y) $(multi-used-m) -single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) - -# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to +# $(subdir-obj-y) is the list of objects in $(real-obj-y) which uses dir/ to # tell kbuild to descend -subdir-obj-y := $(filter %/built-in.a, $(obj-y)) - -# Replace multi-part objects by their individual parts, -# including built-in.a from subdirectories -real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) -real-obj-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))) +subdir-obj-y := $(filter %/built-in.a, $(real-obj-y)) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
PATCH 2/5 kbuild: treat a directory listed in a composite object as foo/mod.a
In reply to NeilBrownCurrently a directory is not permitted in a composite object.
This patch changes kbuild so that a directory it assumed to mean the file "mod.a" in that directory.
The file cannot, yet, be created, so this does not yet affect behaviour.
There are several parts to this.
1/ strip out all the directories from obj-m so that
the directories that appear in real-obj-m must be parts of composite objects
2/ translate those directories from foo/ to foo/mod.a
at the same time that obj-y directories becomes foo/built-in.a
3/ hold list of directories needed for modules in subdir-obj-m
so that we can descend into them as required.
4/ We need a little "dance" in "Rule to link composite objects"
where we strip the mod.a back off - so we can filter against the foo-{objs,y,m} macros, then add it back on for declaring dependencies.
As part of this, multi_depend gains an extra argument being the name to append to any directory.
--- scripts/Makefile.build | 15 ++++++++------- scripts/Makefile.lib | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 11 deletions(-)
scripts/Makefile.build +8 -7
@@ -416,8 +416,9 @@ endif $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE $(call if_changed_rule,as_o_S) -targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) $(real-obj-m) $(lib-y) -targets += $(extra-y) $(MAKECMDGOALS) $(always) +targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) +targets += $(filter-out $(subdir-obj-m), $(real-obj-m)) +targets += $(lib-y) $(extra-y) $(MAKECMDGOALS) $(always) # Linker scripts preprocessor (.lds.S -> .lds) # ---------------------------------------------------------------------------
@@ -441,7 +442,7 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler # --------------------------------------------------------------------------- # To build objects in subdirs, we need to descend into the directories -$(sort $(subdir-obj-y)): $(subdir-ym) ; +$(sort $(subdir-obj-y) $(subdir-obj-m)): $(subdir-ym) ; # # Rule to compile a set of .o files into one .o file
@@ -521,16 +522,16 @@ link_multi_deps = \ $(filter $(addprefix $(obj)/, \ $($(subst $(obj)/,,$(@:.o=-objs))) \ $($(subst $(obj)/,,$(@:.o=-y))) \ -$($(subst $(obj)/,,$(@:.o=-m)))), $^) +$($(subst $(obj)/,,$(@:.o=-m)))), $(patsubst %/mod.a,%/,$^)) quiet_cmd_link_multi-m = LD [M] $@ -cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) +cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(patsubst %/, --whole-archive %/mod.a --no-whole-archive ,$(link_multi_deps)) $(cmd_secanalysis) $(multi-used-m): FORCE $(call if_changed,link_multi-m) - @{ echo $(@:.o=.ko); echo $(link_multi_deps); \ + @{ echo $(@:.o=.ko); echo $(patsubst %/,%/mod.a,$(link_multi_deps)); \ $(cmd_undef_syms); } > $(MODVERDIR)/$(@F:.o=.mod) -$(call multi_depend, $(multi-used-m), .o, -objs -y -m) +$(call multi_depend, $(multi-used-m), .o, -objs -y -m,mod.a) targets += $(multi-used-m) targets := $(filter-out $(PHONY), $(targets))
scripts/Makefile.lib +15 -4
@@ -12,6 +12,13 @@ KBUILD_CFLAGS += $(subdir-ccflags-y) # Figure out what we need to build from the various variables # =========================================================================== +# Directories in obj-m only cause that directory to be descended, which +# is exactly what happens for directories in obj-y. So move all +# directories from obj-m to obj-y. Then we will know that any directory +# in real-obj-m is a component of some other object. +obj-y := $(obj-y) $(filter %/, $(obj-m)) +obj-m := $(filter-out %/, $(obj-m)) + # When an object is listed to be built compiled-in and modular, # only build the compiled-in version obj-m := $(filter-out $(obj-y),$(obj-m))
@@ -40,14 +47,14 @@ real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) # --------------------------------------------------------------------------- # o if we encounter foo/ in $(real-obj-y), replace it by foo/built-in.a # and add the directory to the list of dirs to descend into: $(subdir-y) -# o if we encounter foo/ in $(real-obj-m), remove it from $(real-obj-m) +# o if we encounter foo/ in $(real-obj-m), replace it by foo/mod.a # and add the directory to the list of dirs to descend into: $(subdir-m) __subdir-y := $(patsubst %/,%,$(filter %/, $(real-obj-y))) subdir-y += $(__subdir-y) __subdir-m := $(patsubst %/,%,$(filter %/, $(real-obj-m))) subdir-m += $(__subdir-m) real-obj-y := $(patsubst %/, %/built-in.a, $(real-obj-y)) -real-obj-m := $(filter-out %/, $(real-obj-m)) +real-obj-m := $(patsubst %/, %/mod.a, $(real-obj-m)) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m))
@@ -55,6 +62,9 @@ subdir-ym := $(sort $(subdir-y) $(subdir-m)) # $(subdir-obj-y) is the list of objects in $(real-obj-y) which uses dir/ to # tell kbuild to descend subdir-obj-y := $(filter %/built-in.a, $(real-obj-y)) +# $(subdir-obj-m) is the list of objects in $(real-obj-m) which uses dir/ to +# tell kbuild to descend +subdir-obj-m := $(filter %/mod.a, $(real-obj-m)) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
@@ -70,6 +80,7 @@ modorder := $(addprefix $(obj)/,$(modorder)) obj-m := $(addprefix $(obj)/,$(obj-m)) lib-y := $(addprefix $(obj)/,$(lib-y)) subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) +subdir-obj-m := $(addprefix $(obj)/,$(subdir-obj-m)) real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) single-used-m := $(addprefix $(obj)/,$(single-used-m))
@@ -172,11 +183,11 @@ dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ # Useful for describing the dependency of composite objects # Usage: -# $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add) +# $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add, object_in_directories) define multi_depend $(foreach m, $(notdir $1), \ $(eval $(obj)/$m: \ - $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s))))))) + $(addprefix $(obj)/, $(patsubst %/,%/$4,$(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))) endef # LEX
kbuild test robot
build botRe: [PATCH 2/5] kbuild: treat a directory listed in a composite object as foo/mod.a
Thank you for the patch! Yet something to improve:
Hi NeilBrown,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on kbuild/for-next]
[also build test ERROR on v4.18-rc1 next-20180618]
[cannot apply to mmarek/for-next mmarek/rc-fixes]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/NeilBrown/kbuild-build-modules-from-code-in-multiple-directories/20180618-130250 base: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next config: x86_64-randconfig-in0-06170623 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/isdn/hardware/mISDN/hfcsusb.o: In function `release_hw':
>> drivers/isdn/hardware/mISDN/hfcsusb.c:1757: undefined reference to `l1_event' >> drivers/isdn/hardware/mISDN/hfcsusb.c:1759: undefined reference to `mISDN_unregister_device' >> drivers/isdn/hardware/mISDN/hfcsusb.c:1760: undefined reference to `mISDN_freebchannel' drivers/isdn/hardware/mISDN/hfcsusb.c:1761: undefined reference to `mISDN_freebchannel' >> drivers/isdn/hardware/mISDN/hfcsusb.c:1762: undefined reference to `mISDN_freedchannel' drivers/isdn/hardware/mISDN/hfcsusb.o: In function `deactivate_bchannel': >> drivers/isdn/hardware/mISDN/hfcsusb.c:1788: undefined reference to `mISDN_clear_bchannel' drivers/isdn/hardware/mISDN/hfcsusb.o: In function `ph_state_te': drivers/isdn/hardware/mISDN/hfcsusb.c:611: undefined reference to `l1_event' drivers/isdn/hardware/mISDN/hfcsusb.o: In function `channel_bctrl': >> drivers/isdn/hardware/mISDN/hfcsusb.c:808: undefined reference to `mISDN_ctrl_bchannel' drivers/isdn/hardware/mISDN/hfcsusb.o: In function `tx_iso_complete': >> drivers/isdn/hardware/mISDN/hfcsusb.c:1345: undefined reference to `get_next_dframe' >> drivers/isdn/hardware/mISDN/hfcsusb.c:1348: undefined reference to `get_next_bframe' drivers/isdn/hardware/mISDN/hfcsusb.o: In function `hfcsusb_rx_frame': >> drivers/isdn/hardware/mISDN/hfcsusb.c:850: undefined reference to `bchannel_get_rxbuf' >> drivers/isdn/hardware/mISDN/hfcsusb.c:919: undefined reference to `recv_Dchannel' >> drivers/isdn/hardware/mISDN/hfcsusb.c:921: undefined reference to `recv_Bchannel' >> drivers/isdn/hardware/mISDN/hfcsusb.c:924: undefined reference to `recv_Echannel' drivers/isdn/hardware/mISDN/hfcsusb.c:943: undefined reference to `recv_Bchannel' drivers/isdn/hardware/mISDN/hfcsusb.o: In function `hfcusb_l2l1D': >> drivers/isdn/hardware/mISDN/hfcsusb.c:301: undefined reference to `dchannel_senddata' >> drivers/isdn/hardware/mISDN/hfcsusb.c:305: undefined reference to `queue_ch_frame' drivers/isdn/hardware/mISDN/hfcsusb.c:360: undefined reference to `l1_event' drivers/isdn/hardware/mISDN/hfcsusb.o: In function `setup_instance': >> drivers/isdn/hardware/mISDN/hfcsusb.c:1843: undefined reference to `mISDN_initdchannel' drivers/isdn/hardware/mISDN/hfcsusb.c:1852: undefined reference to `mISDN_initdchannel' >> drivers/isdn/hardware/mISDN/hfcsusb.c:1861: undefined reference to `mISDN_initbchannel' >> drivers/isdn/hardware/mISDN/hfcsusb.c:1887: undefined reference to `mISDN_register_device' drivers/isdn/hardware/mISDN/hfcsusb.c:1898: undefined reference to `mISDN_freebchannel' drivers/isdn/hardware/mISDN/hfcsusb.c:1899: undefined reference to `mISDN_freebchannel' drivers/isdn/hardware/mISDN/hfcsusb.c:1900: undefined reference to `mISDN_freedchannel' drivers/isdn/hardware/mISDN/hfcsusb.o: In function `hfcusb_l2l1B': >> drivers/isdn/hardware/mISDN/hfcsusb.c:224: undefined reference to `bchannel_senddata' drivers/isdn/hardware/mISDN/hfcsusb.o: In function `open_dchannel': >> drivers/isdn/hardware/mISDN/hfcsusb.c:454: undefined reference to `create_l1'
vim +1757 drivers/isdn/hardware/mISDN/hfcsusb.c
69f52adb Karsten Keil 2009-01-09 1739
69f52adb Karsten Keil 2009-01-09 1740 static void
69f52adb Karsten Keil 2009-01-09 1741 release_hw(struct hfcsusb *hw)
69f52adb Karsten Keil 2009-01-09 1742 {
69f52adb Karsten Keil 2009-01-09 1743 if (debug & DBG_HFC_CALL_TRACE)
69f52adb Karsten Keil 2009-01-09 1744 printk(KERN_DEBUG "%s: %s\n", hw->name, __func__);
69f52adb Karsten Keil 2009-01-09 1745
69f52adb Karsten Keil 2009-01-09 1746 /*
69f52adb Karsten Keil 2009-01-09 1747 * stop all endpoints gracefully
69f52adb Karsten Keil 2009-01-09 1748 * TODO: mISDN_core should generate CLOSE_CHANNEL
69f52adb Karsten Keil 2009-01-09 1749 * signals after calling mISDN_unregister_device()
69f52adb Karsten Keil 2009-01-09 1750 */
69f52adb Karsten Keil 2009-01-09 1751 hfcsusb_stop_endpoint(hw, HFC_CHAN_D);
69f52adb Karsten Keil 2009-01-09 1752 hfcsusb_stop_endpoint(hw, HFC_CHAN_B1);
69f52adb Karsten Keil 2009-01-09 1753 hfcsusb_stop_endpoint(hw, HFC_CHAN_B2);
69f52adb Karsten Keil 2009-01-09 1754 if (hw->fifos[HFCUSB_PCM_RX].pipe)
69f52adb Karsten Keil 2009-01-09 1755 hfcsusb_stop_endpoint(hw, HFC_CHAN_E);
69f52adb Karsten Keil 2009-01-09 1756 if (hw->protocol == ISDN_P_TE_S0)
69f52adb Karsten Keil 2009-01-09 @1757 l1_event(hw->dch.l1, CLOSE_CHANNEL);
69f52adb Karsten Keil 2009-01-09 1758
69f52adb Karsten Keil 2009-01-09 @1759 mISDN_unregister_device(&hw->dch.dev);
69f52adb Karsten Keil 2009-01-09 @1760 mISDN_freebchannel(&hw->bch[1]);
69f52adb Karsten Keil 2009-01-09 @1761 mISDN_freebchannel(&hw->bch[0]);
69f52adb Karsten Keil 2009-01-09 @1762 mISDN_freedchannel(&hw->dch);
69f52adb Karsten Keil 2009-01-09 1763
69f52adb Karsten Keil 2009-01-09 1764 if (hw->ctrl_urb) {
69f52adb Karsten Keil 2009-01-09 1765 usb_kill_urb(hw->ctrl_urb);
69f52adb Karsten Keil 2009-01-09 1766 usb_free_urb(hw->ctrl_urb);
69f52adb Karsten Keil 2009-01-09 1767 hw->ctrl_urb = NULL;
69f52adb Karsten Keil 2009-01-09 1768 }
69f52adb Karsten Keil 2009-01-09 1769
69f52adb Karsten Keil 2009-01-09 1770 if (hw->intf)
69f52adb Karsten Keil 2009-01-09 1771 usb_set_intfdata(hw->intf, NULL);
69f52adb Karsten Keil 2009-01-09 1772 list_del(&hw->list);
69f52adb Karsten Keil 2009-01-09 1773 kfree(hw);
69f52adb Karsten Keil 2009-01-09 1774 hw = NULL;
69f52adb Karsten Keil 2009-01-09 1775 }
69f52adb Karsten Keil 2009-01-09 1776
69f52adb Karsten Keil 2009-01-09 1777 static void
69f52adb Karsten Keil 2009-01-09 1778 deactivate_bchannel(struct bchannel *bch)
69f52adb Karsten Keil 2009-01-09 1779 {
69f52adb Karsten Keil 2009-01-09 1780 struct hfcsusb *hw = bch->hw;
69f52adb Karsten Keil 2009-01-09 1781 u_long flags;
69f52adb Karsten Keil 2009-01-09 1782
69f52adb Karsten Keil 2009-01-09 1783 if (bch->debug & DEBUG_HW)
69f52adb Karsten Keil 2009-01-09 1784 printk(KERN_DEBUG "%s: %s: bch->nr(%i)\n",
69f52adb Karsten Keil 2009-01-09 1785 hw->name, __func__, bch->nr);
69f52adb Karsten Keil 2009-01-09 1786
69f52adb Karsten Keil 2009-01-09 1787 spin_lock_irqsave(&hw->lock, flags);
fb286f04 Karsten Keil 2009-07-09 @1788 mISDN_clear_bchannel(bch);
69f52adb Karsten Keil 2009-01-09 1789 spin_unlock_irqrestore(&hw->lock, flags);
69f52adb Karsten Keil 2009-01-09 1790 hfcsusb_setup_bch(bch, ISDN_P_NONE);
37952cfa Martin Bachem 2012-05-15 1791 hfcsusb_stop_endpoint(hw, bch->nr - 1);
69f52adb Karsten Keil 2009-01-09 1792 }
69f52adb Karsten Keil 2009-01-09 1793
69f52adb Karsten Keil 2009-01-09 1794 /*
69f52adb Karsten Keil 2009-01-09 1795 * Layer 1 B-channel hardware access
69f52adb Karsten Keil 2009-01-09 1796 */
69f52adb Karsten Keil 2009-01-09 1797 static int
69f52adb Karsten Keil 2009-01-09 1798 hfc_bctrl(struct mISDNchannel *ch, u_int cmd, void *arg)
69f52adb Karsten Keil 2009-01-09 1799 {
69f52adb Karsten Keil 2009-01-09 1800 struct bchannel *bch = container_of(ch, struct bchannel, ch);
69f52adb Karsten Keil 2009-01-09 1801 int ret = -EINVAL;
69f52adb Karsten Keil 2009-01-09 1802
69f52adb Karsten Keil 2009-01-09 1803 if (bch->debug & DEBUG_HW)
69f52adb Karsten Keil 2009-01-09 1804 printk(KERN_DEBUG "%s: cmd:%x %p\n", __func__, cmd, arg);
69f52adb Karsten Keil 2009-01-09 1805
69f52adb Karsten Keil 2009-01-09 1806 switch (cmd) {
69f52adb Karsten Keil 2009-01-09 1807 case HW_TESTRX_RAW:
69f52adb Karsten Keil 2009-01-09 1808 case HW_TESTRX_HDLC:
69f52adb Karsten Keil 2009-01-09 1809 case HW_TESTRX_OFF:
69f52adb Karsten Keil 2009-01-09 1810 ret = -EINVAL;
69f52adb Karsten Keil 2009-01-09 1811 break;
69f52adb Karsten Keil 2009-01-09 1812
69f52adb Karsten Keil 2009-01-09 1813 case CLOSE_CHANNEL:
69f52adb Karsten Keil 2009-01-09 1814 test_and_clear_bit(FLG_OPEN, &bch->Flags);
69f52adb Karsten Keil 2009-01-09 1815 deactivate_bchannel(bch);
69f52adb Karsten Keil 2009-01-09 1816 ch->protocol = ISDN_P_NONE;
69f52adb Karsten Keil 2009-01-09 1817 ch->peer = NULL;
69f52adb Karsten Keil 2009-01-09 1818 module_put(THIS_MODULE);
69f52adb Karsten Keil 2009-01-09 1819 ret = 0;
69f52adb Karsten Keil 2009-01-09 1820 break;
69f52adb Karsten Keil 2009-01-09 1821 case CONTROL_CHANNEL:
69f52adb Karsten Keil 2009-01-09 1822 ret = channel_bctrl(bch, arg);
69f52adb Karsten Keil 2009-01-09 1823 break;
69f52adb Karsten Keil 2009-01-09 1824 default:
69f52adb Karsten Keil 2009-01-09 1825 printk(KERN_WARNING "%s: unknown prim(%x)\n",
69f52adb Karsten Keil 2009-01-09 1826 __func__, cmd);
69f52adb Karsten Keil 2009-01-09 1827 }
69f52adb Karsten Keil 2009-01-09 1828 return ret;
69f52adb Karsten Keil 2009-01-09 1829 }
69f52adb Karsten Keil 2009-01-09 1830
69f52adb Karsten Keil 2009-01-09 1831 static int
69f52adb Karsten Keil 2009-01-09 1832 setup_instance(struct hfcsusb *hw, struct device *parent)
69f52adb Karsten Keil 2009-01-09 1833 {
69f52adb Karsten Keil 2009-01-09 1834 u_long flags;
69f52adb Karsten Keil 2009-01-09 1835 int err, i;
69f52adb Karsten Keil 2009-01-09 1836
69f52adb Karsten Keil 2009-01-09 1837 if (debug & DBG_HFC_CALL_TRACE)
69f52adb Karsten Keil 2009-01-09 1838 printk(KERN_DEBUG "%s: %s\n", hw->name, __func__);
69f52adb Karsten Keil 2009-01-09 1839
69f52adb Karsten Keil 2009-01-09 1840 spin_lock_init(&hw->ctrl_lock);
69f52adb Karsten Keil 2009-01-09 1841 spin_lock_init(&hw->lock);
69f52adb Karsten Keil 2009-01-09 1842
69f52adb Karsten Keil 2009-01-09 @1843 mISDN_initdchannel(&hw->dch, MAX_DFRAME_LEN_L1, ph_state);
69f52adb Karsten Keil 2009-01-09 1844 hw->dch.debug = debug & 0xFFFF;
69f52adb Karsten Keil 2009-01-09 1845 hw->dch.hw = hw;
69f52adb Karsten Keil 2009-01-09 1846 hw->dch.dev.Dprotocols = (1 << ISDN_P_TE_S0) | (1 << ISDN_P_NT_S0);
69f52adb Karsten Keil 2009-01-09 1847 hw->dch.dev.D.send = hfcusb_l2l1D;
69f52adb Karsten Keil 2009-01-09 1848 hw->dch.dev.D.ctrl = hfc_dctrl;
69f52adb Karsten Keil 2009-01-09 1849
69f52adb Karsten Keil 2009-01-09 1850 /* enable E-Channel logging */
69f52adb Karsten Keil 2009-01-09 1851 if (hw->fifos[HFCUSB_PCM_RX].pipe)
69f52adb Karsten Keil 2009-01-09 @1852 mISDN_initdchannel(&hw->ech, MAX_DFRAME_LEN_L1, NULL);
69f52adb Karsten Keil 2009-01-09 1853
69f52adb Karsten Keil 2009-01-09 1854 hw->dch.dev.Bprotocols = (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK)) |
69f52adb Karsten Keil 2009-01-09 1855 (1 << (ISDN_P_B_HDLC & ISDN_P_B_MASK));
69f52adb Karsten Keil 2009-01-09 1856 hw->dch.dev.nrbchan = 2;
69f52adb Karsten Keil 2009-01-09 1857 for (i = 0; i < 2; i++) {
69f52adb Karsten Keil 2009-01-09 1858 hw->bch[i].nr = i + 1;
69f52adb Karsten Keil 2009-01-09 1859 set_channelmap(i + 1, hw->dch.dev.channelmap);
69f52adb Karsten Keil 2009-01-09 1860 hw->bch[i].debug = debug;
034005a0 Karsten Keil 2012-05-15 @1861 mISDN_initbchannel(&hw->bch[i], MAX_DATA_MEM, poll >> 1);
69f52adb Karsten Keil 2009-01-09 1862 hw->bch[i].hw = hw;
69f52adb Karsten Keil 2009-01-09 1863 hw->bch[i].ch.send = hfcusb_l2l1B;
69f52adb Karsten Keil 2009-01-09 1864 hw->bch[i].ch.ctrl = hfc_bctrl;
69f52adb Karsten Keil 2009-01-09 1865 hw->bch[i].ch.nr = i + 1;
69f52adb Karsten Keil 2009-01-09 1866 list_add(&hw->bch[i].ch.list, &hw->dch.dev.bchannels);
69f52adb Karsten Keil 2009-01-09 1867 }
69f52adb Karsten Keil 2009-01-09 1868
69f52adb Karsten Keil 2009-01-09 1869 hw->fifos[HFCUSB_B1_TX].bch = &hw->bch[0];
69f52adb Karsten Keil 2009-01-09 1870 hw->fifos[HFCUSB_B1_RX].bch = &hw->bch[0];
69f52adb Karsten Keil 2009-01-09 1871 hw->fifos[HFCUSB_B2_TX].bch = &hw->bch[1];
69f52adb Karsten Keil 2009-01-09 1872 hw->fifos[HFCUSB_B2_RX].bch = &hw->bch[1];
69f52adb Karsten Keil 2009-01-09 1873 hw->fifos[HFCUSB_D_TX].dch = &hw->dch;
69f52adb Karsten Keil 2009-01-09 1874 hw->fifos[HFCUSB_D_RX].dch = &hw->dch;
69f52adb Karsten Keil 2009-01-09 1875 hw->fifos[HFCUSB_PCM_RX].ech = &hw->ech;
69f52adb Karsten Keil 2009-01-09 1876 hw->fifos[HFCUSB_PCM_TX].ech = &hw->ech;
69f52adb Karsten Keil 2009-01-09 1877
69f52adb Karsten Keil 2009-01-09 1878 err = setup_hfcsusb(hw);
69f52adb Karsten Keil 2009-01-09 1879 if (err)
69f52adb Karsten Keil 2009-01-09 1880 goto out;
69f52adb Karsten Keil 2009-01-09 1881
69f52adb Karsten Keil 2009-01-09 1882 snprintf(hw->name, MISDN_MAX_IDLEN - 1, "%s.%d", DRIVER_NAME,
69f52adb Karsten Keil 2009-01-09 1883 hfcsusb_cnt + 1);
69f52adb Karsten Keil 2009-01-09 1884 printk(KERN_INFO "%s: registered as '%s'\n",
69f52adb Karsten Keil 2009-01-09 1885 DRIVER_NAME, hw->name);
69f52adb Karsten Keil 2009-01-09 1886
69f52adb Karsten Keil 2009-01-09 @1887 err = mISDN_register_device(&hw->dch.dev, parent, hw->name);
69f52adb Karsten Keil 2009-01-09 1888 if (err)
69f52adb Karsten Keil 2009-01-09 1889 goto out;
69f52adb Karsten Keil 2009-01-09 1890
69f52adb Karsten Keil 2009-01-09 1891 hfcsusb_cnt++;
69f52adb Karsten Keil 2009-01-09 1892 write_lock_irqsave(&HFClock, flags);
69f52adb Karsten Keil 2009-01-09 1893 list_add_tail(&hw->list, &HFClist);
69f52adb Karsten Keil 2009-01-09 1894 write_unlock_irqrestore(&HFClock, flags);
69f52adb Karsten Keil 2009-01-09 1895 return 0;
69f52adb Karsten Keil 2009-01-09 1896
69f52adb Karsten Keil 2009-01-09 1897 out:
69f52adb Karsten Keil 2009-01-09 1898 mISDN_freebchannel(&hw->bch[1]);
69f52adb Karsten Keil 2009-01-09 1899 mISDN_freebchannel(&hw->bch[0]);
69f52adb Karsten Keil 2009-01-09 1900 mISDN_freedchannel(&hw->dch);
69f52adb Karsten Keil 2009-01-09 1901 kfree(hw);
69f52adb Karsten Keil 2009-01-09 1902 return err;
69f52adb Karsten Keil 2009-01-09 1903 }
69f52adb Karsten Keil 2009-01-09 1904 :::::: The code at line 1757 was first introduced by commit :::::: 69f52adb2d534afc41fcc658f155e01f0b322f9e mISDN: Add HFC USB driver
:::::: TO: Karsten Keil <[email protected]>
:::::: CC: Karsten Keil <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 2/5] kbuild: treat a directory listed in a composite object as foo/mod.a
Quoted 3 lines · kbuild test robot
Hi NeilBrown,
Thank you for the patch! Yet something to improve:
Thank you for your testing and problem report! Yet something to improve:-)
This bug is caused by the combination CONFIG_MISDN_HFCUSB=y and CONFIG_MISDN=m and appears to have nothing to do with my patch.
I suspect drivers/isdn/hardware/mISDN/Kconfig needs
@@ -35,6 +35,7 @@ config MISDN_HFCMULTI_8xx
config MISDN_HFCUSB
tristate "Support for HFC-S USB based TAs" depends on USB
+ depends on MISDN
help
Enable support for USB ISDN TAs with Cologne Chip AG's HFC-S USB ISDN Controller
or similar.
Thanks,
NeilBrown
(config file excerpt for Karsten:CONFIG_MISDN=mCONFIG_MISDN_DSP=mCONFIG_MISDN_L1OIP=mCONFIG_MISDN_HFCPCI=m
# CONFIG_MISDN_HFCMULTI is not setCONFIG_MISDN_HFCUSB=yCONFIG_MISDN_AVMFRITZ=mCONFIG_MISDN_SPEEDFAX=mCONFIG_MISDN_INFINEON=mCONFIG_MISDN_W6692=m
# CONFIG_MISDN_NETJET is not setCONFIG_MISDN_IPAC=mCONFIG_MISDN_ISAR=m
)
Quoted 232 lines
[auto build test ERROR on kbuild/for-next]
[also build test ERROR on v4.18-rc1 next-20180618]
[cannot apply to mmarek/for-next mmarek/rc-fixes]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/NeilBrown/kbuild-build-modules-from-code-in-multiple-directories/20180618-130250 base: https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next config: x86_64-randconfig-in0-06170623 (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64All errors (new ones prefixed by >>):
drivers/isdn/hardware/mISDN/hfcsusb.o: In function `release_hw':Quoted 3 lines
Quoted 3 lines
drivers/isdn/hardware/mISDN/hfcsusb.c:1757: undefined reference tol1_event' drivers/isdn/hardware/mISDN/hfcsusb.c:1759: undefined reference tomISDN_unregister_device'drivers/isdn/hardware/mISDN/hfcsusb.c:1760: undefined reference to `mISDN_freebchannel'
drivers/isdn/hardware/mISDN/hfcsusb.c:1761: undefined reference to `mISDN_freebchannel'Quoted 1 line
Quoted 1 line
drivers/isdn/hardware/mISDN/hfcsusb.c:1762: undefined reference to `mISDN_freedchannel'
drivers/isdn/hardware/mISDN/hfcsusb.o: In function `deactivate_bchannel':Quoted 1 line
Quoted 1 line
drivers/isdn/hardware/mISDN/hfcsusb.c:1788: undefined reference to `mISDN_clear_bchannel'
drivers/isdn/hardware/mISDN/hfcsusb.o: In function `ph_state_te':
drivers/isdn/hardware/mISDN/hfcsusb.c:611: undefined reference tol1_event' drivers/isdn/hardware/mISDN/hfcsusb.o: In functionchannel_bctrl':Quoted 1 line
Quoted 1 line
drivers/isdn/hardware/mISDN/hfcsusb.c:808: undefined reference to `mISDN_ctrl_bchannel'
drivers/isdn/hardware/mISDN/hfcsusb.o: In function `tx_iso_complete':Quoted 2 lines
Quoted 2 lines
drivers/isdn/hardware/mISDN/hfcsusb.c:1345: undefined reference toget_next_dframe' drivers/isdn/hardware/mISDN/hfcsusb.c:1348: undefined reference toget_next_bframe'
drivers/isdn/hardware/mISDN/hfcsusb.o: In function `hfcsusb_rx_frame':Quoted 4 lines
Quoted 4 lines
drivers/isdn/hardware/mISDN/hfcsusb.c:850: undefined reference tobchannel_get_rxbuf' drivers/isdn/hardware/mISDN/hfcsusb.c:919: undefined reference torecv_Dchannel'drivers/isdn/hardware/mISDN/hfcsusb.c:921: undefined reference torecv_Bchannel' drivers/isdn/hardware/mISDN/hfcsusb.c:924: undefined reference torecv_Echannel'
drivers/isdn/hardware/mISDN/hfcsusb.c:943: undefined reference torecv_Bchannel' drivers/isdn/hardware/mISDN/hfcsusb.o: In functionhfcusb_l2l1D':Quoted 2 lines
Quoted 2 lines
drivers/isdn/hardware/mISDN/hfcsusb.c:301: undefined reference todchannel_senddata' drivers/isdn/hardware/mISDN/hfcsusb.c:305: undefined reference toqueue_ch_frame'
drivers/isdn/hardware/mISDN/hfcsusb.c:360: undefined reference tol1_event' drivers/isdn/hardware/mISDN/hfcsusb.o: In functionsetup_instance':Quoted 1 line
Quoted 1 line
drivers/isdn/hardware/mISDN/hfcsusb.c:1843: undefined reference to `mISDN_initdchannel'
drivers/isdn/hardware/mISDN/hfcsusb.c:1852: undefined reference to `mISDN_initdchannel'Quoted 2 lines
Quoted 2 lines
drivers/isdn/hardware/mISDN/hfcsusb.c:1861: undefined reference tomISDN_initbchannel' drivers/isdn/hardware/mISDN/hfcsusb.c:1887: undefined reference tomISDN_register_device'
drivers/isdn/hardware/mISDN/hfcsusb.c:1898: undefined reference tomISDN_freebchannel' drivers/isdn/hardware/mISDN/hfcsusb.c:1899: undefined reference tomISDN_freebchannel'drivers/isdn/hardware/mISDN/hfcsusb.c:1900: undefined reference tomISDN_freedchannel' drivers/isdn/hardware/mISDN/hfcsusb.o: In functionhfcusb_l2l1B':Quoted 1 line
Quoted 1 line
drivers/isdn/hardware/mISDN/hfcsusb.c:224: undefined reference to `bchannel_senddata'
drivers/isdn/hardware/mISDN/hfcsusb.o: In function `open_dchannel':Quoted 1 line
Quoted 1 line
drivers/isdn/hardware/mISDN/hfcsusb.c:454: undefined reference to `create_l1'vim +1757
drivers/isdn/hardware/mISDN/hfcsusb.c69f52adb Karsten Keil 2009-01-09 1739 69f52adb Karsten Keil 2009-01-09 1740 static void 69f52adb Karsten Keil 2009-01-09 1741 release_hw(struct hfcsusb *hw) 69f52adb Karsten Keil 2009-01-09 1742 { 69f52adb Karsten Keil 2009-01-09 1743 if (debug & DBG_HFC_CALL_TRACE) 69f52adb Karsten Keil 2009-01-09 1744 printk(KERN_DEBUG "%s: %s\n", hw->name, __func__); 69f52adb Karsten Keil 2009-01-09 1745 69f52adb Karsten Keil 2009-01-09 1746 /* 69f52adb Karsten Keil 2009-01-09 1747 * stop all endpoints gracefully 69f52adb Karsten Keil 2009-01-09 1748 * TODO: mISDN_core should generate CLOSE_CHANNEL 69f52adb Karsten Keil 2009-01-09 1749 * signals after calling mISDN_unregister_device() 69f52adb Karsten Keil 2009-01-09 1750 */ 69f52adb Karsten Keil 2009-01-09 1751 hfcsusb_stop_endpoint(hw, HFC_CHAN_D); 69f52adb Karsten Keil 2009-01-09 1752 hfcsusb_stop_endpoint(hw, HFC_CHAN_B1); 69f52adb Karsten Keil 2009-01-09 1753 hfcsusb_stop_endpoint(hw, HFC_CHAN_B2); 69f52adb Karsten Keil 2009-01-09 1754 if (hw->fifos[HFCUSB_PCM_RX].pipe) 69f52adb Karsten Keil 2009-01-09 1755 hfcsusb_stop_endpoint(hw, HFC_CHAN_E); 69f52adb Karsten Keil 2009-01-09 1756 if (hw->protocol == ISDN_P_TE_S0) 69f52adb Karsten Keil 2009-01-09 @1757 l1_event(hw->dch.l1, CLOSE_CHANNEL); 69f52adb Karsten Keil 2009-01-09 1758 69f52adb Karsten Keil 2009-01-09 @1759 mISDN_unregister_device(&hw->dch.dev); 69f52adb Karsten Keil 2009-01-09 @1760 mISDN_freebchannel(&hw->bch[1]); 69f52adb Karsten Keil 2009-01-09 @1761 mISDN_freebchannel(&hw->bch[0]); 69f52adb Karsten Keil 2009-01-09 @1762 mISDN_freedchannel(&hw->dch); 69f52adb Karsten Keil 2009-01-09 1763 69f52adb Karsten Keil 2009-01-09 1764 if (hw->ctrl_urb) { 69f52adb Karsten Keil 2009-01-09 1765 usb_kill_urb(hw->ctrl_urb); 69f52adb Karsten Keil 2009-01-09 1766 usb_free_urb(hw->ctrl_urb); 69f52adb Karsten Keil 2009-01-09 1767 hw->ctrl_urb = NULL; 69f52adb Karsten Keil 2009-01-09 1768 } 69f52adb Karsten Keil 2009-01-09 1769 69f52adb Karsten Keil 2009-01-09 1770 if (hw->intf) 69f52adb Karsten Keil 2009-01-09 1771 usb_set_intfdata(hw->intf, NULL); 69f52adb Karsten Keil 2009-01-09 1772 list_del(&hw->list); 69f52adb Karsten Keil 2009-01-09 1773 kfree(hw); 69f52adb Karsten Keil 2009-01-09 1774 hw = NULL; 69f52adb Karsten Keil 2009-01-09 1775 } 69f52adb Karsten Keil 2009-01-09 1776 69f52adb Karsten Keil 2009-01-09 1777 static void 69f52adb Karsten Keil 2009-01-09 1778 deactivate_bchannel(struct bchannel *bch) 69f52adb Karsten Keil 2009-01-09 1779 { 69f52adb Karsten Keil 2009-01-09 1780 struct hfcsusb *hw = bch->hw; 69f52adb Karsten Keil 2009-01-09 1781 u_long flags; 69f52adb Karsten Keil 2009-01-09 1782 69f52adb Karsten Keil 2009-01-09 1783 if (bch->debug & DEBUG_HW) 69f52adb Karsten Keil 2009-01-09 1784 printk(KERN_DEBUG "%s: %s: bch->nr(%i)\n", 69f52adb Karsten Keil 2009-01-09 1785 hw->name, __func__, bch->nr); 69f52adb Karsten Keil 2009-01-09 1786 69f52adb Karsten Keil 2009-01-09 1787 spin_lock_irqsave(&hw->lock, flags); fb286f04 Karsten Keil 2009-07-09 @1788 mISDN_clear_bchannel(bch); 69f52adb Karsten Keil 2009-01-09 1789 spin_unlock_irqrestore(&hw->lock, flags); 69f52adb Karsten Keil 2009-01-09 1790 hfcsusb_setup_bch(bch, ISDN_P_NONE); 37952cfa Martin Bachem 2012-05-15 1791 hfcsusb_stop_endpoint(hw, bch->nr - 1); 69f52adb Karsten Keil 2009-01-09 1792 } 69f52adb Karsten Keil 2009-01-09 1793 69f52adb Karsten Keil 2009-01-09 1794 /* 69f52adb Karsten Keil 2009-01-09 1795 * Layer 1 B-channel hardware access 69f52adb Karsten Keil 2009-01-09 1796 */ 69f52adb Karsten Keil 2009-01-09 1797 static int 69f52adb Karsten Keil 2009-01-09 1798 hfc_bctrl(struct mISDNchannel *ch, u_int cmd, void *arg) 69f52adb Karsten Keil 2009-01-09 1799 { 69f52adb Karsten Keil 2009-01-09 1800 struct bchannel *bch = container_of(ch, struct bchannel, ch); 69f52adb Karsten Keil 2009-01-09 1801 int ret = -EINVAL; 69f52adb Karsten Keil 2009-01-09 1802 69f52adb Karsten Keil 2009-01-09 1803 if (bch->debug & DEBUG_HW) 69f52adb Karsten Keil 2009-01-09 1804 printk(KERN_DEBUG "%s: cmd:%x %p\n", __func__, cmd, arg); 69f52adb Karsten Keil 2009-01-09 1805 69f52adb Karsten Keil 2009-01-09 1806 switch (cmd) { 69f52adb Karsten Keil 2009-01-09 1807 case HW_TESTRX_RAW: 69f52adb Karsten Keil 2009-01-09 1808 case HW_TESTRX_HDLC: 69f52adb Karsten Keil 2009-01-09 1809 case HW_TESTRX_OFF: 69f52adb Karsten Keil 2009-01-09 1810 ret = -EINVAL; 69f52adb Karsten Keil 2009-01-09 1811 break; 69f52adb Karsten Keil 2009-01-09 1812 69f52adb Karsten Keil 2009-01-09 1813 case CLOSE_CHANNEL: 69f52adb Karsten Keil 2009-01-09 1814 test_and_clear_bit(FLG_OPEN, &bch->Flags); 69f52adb Karsten Keil 2009-01-09 1815 deactivate_bchannel(bch); 69f52adb Karsten Keil 2009-01-09 1816 ch->protocol = ISDN_P_NONE; 69f52adb Karsten Keil 2009-01-09 1817 ch->peer = NULL; 69f52adb Karsten Keil 2009-01-09 1818 module_put(THIS_MODULE); 69f52adb Karsten Keil 2009-01-09 1819 ret = 0; 69f52adb Karsten Keil 2009-01-09 1820 break; 69f52adb Karsten Keil 2009-01-09 1821 case CONTROL_CHANNEL: 69f52adb Karsten Keil 2009-01-09 1822 ret = channel_bctrl(bch, arg); 69f52adb Karsten Keil 2009-01-09 1823 break; 69f52adb Karsten Keil 2009-01-09 1824 default: 69f52adb Karsten Keil 2009-01-09 1825 printk(KERN_WARNING "%s: unknown prim(%x)\n", 69f52adb Karsten Keil 2009-01-09 1826 __func__, cmd); 69f52adb Karsten Keil 2009-01-09 1827 } 69f52adb Karsten Keil 2009-01-09 1828 return ret; 69f52adb Karsten Keil 2009-01-09 1829 } 69f52adb Karsten Keil 2009-01-09 1830 69f52adb Karsten Keil 2009-01-09 1831 static int 69f52adb Karsten Keil 2009-01-09 1832 setup_instance(struct hfcsusb *hw, struct device *parent) 69f52adb Karsten Keil 2009-01-09 1833 { 69f52adb Karsten Keil 2009-01-09 1834 u_long flags; 69f52adb Karsten Keil 2009-01-09 1835 int err, i; 69f52adb Karsten Keil 2009-01-09 1836 69f52adb Karsten Keil 2009-01-09 1837 if (debug & DBG_HFC_CALL_TRACE) 69f52adb Karsten Keil 2009-01-09 1838 printk(KERN_DEBUG "%s: %s\n", hw->name, __func__); 69f52adb Karsten Keil 2009-01-09 1839 69f52adb Karsten Keil 2009-01-09 1840 spin_lock_init(&hw->ctrl_lock); 69f52adb Karsten Keil 2009-01-09 1841 spin_lock_init(&hw->lock); 69f52adb Karsten Keil 2009-01-09 1842 69f52adb Karsten Keil 2009-01-09 @1843 mISDN_initdchannel(&hw->dch, MAX_DFRAME_LEN_L1, ph_state); 69f52adb Karsten Keil 2009-01-09 1844 hw->dch.debug = debug & 0xFFFF; 69f52adb Karsten Keil 2009-01-09 1845 hw->dch.hw = hw; 69f52adb Karsten Keil 2009-01-09 1846 hw->dch.dev.Dprotocols = (1 << ISDN_P_TE_S0) | (1 << ISDN_P_NT_S0); 69f52adb Karsten Keil 2009-01-09 1847 hw->dch.dev.D.send = hfcusb_l2l1D; 69f52adb Karsten Keil 2009-01-09 1848 hw->dch.dev.D.ctrl = hfc_dctrl; 69f52adb Karsten Keil 2009-01-09 1849 69f52adb Karsten Keil 2009-01-09 1850 /* enable E-Channel logging */ 69f52adb Karsten Keil 2009-01-09 1851 if (hw->fifos[HFCUSB_PCM_RX].pipe) 69f52adb Karsten Keil 2009-01-09 @1852 mISDN_initdchannel(&hw->ech, MAX_DFRAME_LEN_L1, NULL); 69f52adb Karsten Keil 2009-01-09 1853 69f52adb Karsten Keil 2009-01-09 1854 hw->dch.dev.Bprotocols = (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK)) | 69f52adb Karsten Keil 2009-01-09 1855 (1 << (ISDN_P_B_HDLC & ISDN_P_B_MASK)); 69f52adb Karsten Keil 2009-01-09 1856 hw->dch.dev.nrbchan = 2; 69f52adb Karsten Keil 2009-01-09 1857 for (i = 0; i < 2; i++) { 69f52adb Karsten Keil 2009-01-09 1858 hw->bch[i].nr = i + 1; 69f52adb Karsten Keil 2009-01-09 1859 set_channelmap(i + 1, hw->dch.dev.channelmap); 69f52adb Karsten Keil 2009-01-09 1860 hw->bch[i].debug = debug; 034005a0 Karsten Keil 2012-05-15 @1861 mISDN_initbchannel(&hw->bch[i], MAX_DATA_MEM, poll >> 1); 69f52adb Karsten Keil 2009-01-09 1862 hw->bch[i].hw = hw; 69f52adb Karsten Keil 2009-01-09 1863 hw->bch[i].ch.send = hfcusb_l2l1B; 69f52adb Karsten Keil 2009-01-09 1864 hw->bch[i].ch.ctrl = hfc_bctrl; 69f52adb Karsten Keil 2009-01-09 1865 hw->bch[i].ch.nr = i + 1; 69f52adb Karsten Keil 2009-01-09 1866 list_add(&hw->bch[i].ch.list, &hw->dch.dev.bchannels); 69f52adb Karsten Keil 2009-01-09 1867 } 69f52adb Karsten Keil 2009-01-09 1868 69f52adb Karsten Keil 2009-01-09 1869 hw->fifos[HFCUSB_B1_TX].bch = &hw->bch[0]; 69f52adb Karsten Keil 2009-01-09 1870 hw->fifos[HFCUSB_B1_RX].bch = &hw->bch[0]; 69f52adb Karsten Keil 2009-01-09 1871 hw->fifos[HFCUSB_B2_TX].bch = &hw->bch[1]; 69f52adb Karsten Keil 2009-01-09 1872 hw->fifos[HFCUSB_B2_RX].bch = &hw->bch[1]; 69f52adb Karsten Keil 2009-01-09 1873 hw->fifos[HFCUSB_D_TX].dch = &hw->dch; 69f52adb Karsten Keil 2009-01-09 1874 hw->fifos[HFCUSB_D_RX].dch = &hw->dch; 69f52adb Karsten Keil 2009-01-09 1875 hw->fifos[HFCUSB_PCM_RX].ech = &hw->ech; 69f52adb Karsten Keil 2009-01-09 1876 hw->fifos[HFCUSB_PCM_TX].ech = &hw->ech; 69f52adb Karsten Keil 2009-01-09 1877 69f52adb Karsten Keil 2009-01-09 1878 err = setup_hfcsusb(hw); 69f52adb Karsten Keil 2009-01-09 1879 if (err) 69f52adb Karsten Keil 2009-01-09 1880 goto out; 69f52adb Karsten Keil 2009-01-09 1881 69f52adb Karsten Keil 2009-01-09 1882 snprintf(hw->name, MISDN_MAX_IDLEN - 1, "%s.%d", DRIVER_NAME, 69f52adb Karsten Keil 2009-01-09 1883 hfcsusb_cnt + 1); 69f52adb Karsten Keil 2009-01-09 1884 printk(KERN_INFO "%s: registered as '%s'\n", 69f52adb Karsten Keil 2009-01-09 1885 DRIVER_NAME, hw->name); 69f52adb Karsten Keil 2009-01-09 1886 69f52adb Karsten Keil 2009-01-09 @1887 err = mISDN_register_device(&hw->dch.dev, parent, hw->name); 69f52adb Karsten Keil 2009-01-09 1888 if (err) 69f52adb Karsten Keil 2009-01-09 1889 goto out; 69f52adb Karsten Keil 2009-01-09 1890 69f52adb Karsten Keil 2009-01-09 1891 hfcsusb_cnt++; 69f52adb Karsten Keil 2009-01-09 1892 write_lock_irqsave(&HFClock, flags); 69f52adb Karsten Keil 2009-01-09 1893 list_add_tail(&hw->list, &HFClist); 69f52adb Karsten Keil 2009-01-09 1894 write_unlock_irqrestore(&HFClock, flags); 69f52adb Karsten Keil 2009-01-09 1895 return 0; 69f52adb Karsten Keil 2009-01-09 1896 69f52adb Karsten Keil 2009-01-09 1897 out: 69f52adb Karsten Keil 2009-01-09 1898 mISDN_freebchannel(&hw->bch[1]); 69f52adb Karsten Keil 2009-01-09 1899 mISDN_freebchannel(&hw->bch[0]); 69f52adb Karsten Keil 2009-01-09 1900 mISDN_freedchannel(&hw->dch); 69f52adb Karsten Keil 2009-01-09 1901 kfree(hw); 69f52adb Karsten Keil 2009-01-09 1902 return err; 69f52adb Karsten Keil 2009-01-09 1903 } 69f52adb Karsten Keil 2009-01-09 1904:::::: The code at line 1757 was first introduced by commit ::::::
69f52adb2d534afc41fcc658f155e01f0b322f9emISDN: Add HFC USB driver:::::: TO: Karsten Keil <[email protected]>
:::::: CC: Karsten Keil <[email protected]>---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH 3/5 kbuild: support building of per-directory mod.a
In reply to NeilBrownThis patch allows a "mod.a" to be built in any
directory. A previous patch allows that mod.a
to be included in any module or another mod.a.
This is achieved via a new pair of macros: modobj-y and modobj-m.
Anything in modobj-y is added to obj-y and is otherwise ignored.
Anything listed in modobj-m is built, almost as though "modobj.o" was a requested target. The objects are then combined
into mod.a.
These objects are always built with part-of-module=y.
This is sufficient to build a module from source in multiple directories. Each "other" directory lists something like
modobj-$(CONFIG_FOO) += bar.o bar.o bat.o
and the main directory lists
obj-$(CONFIG-FOO) = foo.o
foo-y = other1/ ../friend/other2/ module.o
--- scripts/Makefile.build | 44 +++++++++++++++++++++++++++++++++----------- scripts/Makefile.lib | 14 ++++++++++---- 2 files changed, 43 insertions(+), 15 deletions(-)
scripts/Makefile.build +33 -11
@@ -15,6 +15,8 @@ obj-y := obj-m := lib-y := lib-m := +modobj-y := +modobj-m := always := targets := subdir-y :=
@@ -80,12 +82,16 @@ ifneq ($(strip $(real-obj-y) $(need-builtin)),) builtin-target := $(obj)/built-in.a endif +ifneq ($(strip $(modobj-m)),) +modobj-target := $(obj)/mod.a +endif + modorder-target := $(obj)/modules.order # We keep a list of all modules in $(MODVERDIR) __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ - $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ + $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target) $(modobj-target)) \ $(subdir-ym) $(always) @:
@@ -119,17 +125,19 @@ modkern_cflags = \ $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) quiet_modtag := $(empty) $(empty) -$(real-obj-m) : part-of-module := y -$(real-obj-m:.o=.i) : part-of-module := y -$(real-obj-m:.o=.s) : part-of-module := y -$(real-obj-m:.o=.lst): part-of-module := y +_mod_obj = $(real-obj-m) $(real-modobj-m) + +$(_mod_obj) : part-of-module := y +$(_mod_obj:.o=.i) : part-of-module := y +$(_mod_obj:.o=.s) : part-of-module := y +$(_mod_obj:.o=.lst): part-of-module := y -$(real-obj-m) : quiet_modtag := [M] -$(real-obj-m:.o=.i) : quiet_modtag := [M] -$(real-obj-m:.o=.s) : quiet_modtag := [M] -$(real-obj-m:.o=.lst): quiet_modtag := [M] +$(_mod_obj) : quiet_modtag := [M] +$(_mod_obj:.o=.i) : quiet_modtag := [M] +$(_mod_obj:.o=.s) : quiet_modtag := [M] +$(_mod_obj:.o=.lst): quiet_modtag := [M] -$(obj-m) : quiet_modtag := [M] +$(obj-m) : quiet_modtag := [M] quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
@@ -417,7 +425,7 @@ $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE $(call if_changed_rule,as_o_S) targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) -targets += $(filter-out $(subdir-obj-m), $(real-obj-m)) +targets += $(filter-out $(subdir-obj-m) $(real-modobj-m), $(real-obj-m)) targets += $(lib-y) $(extra-y) $(MAKECMDGOALS) $(always) # Linker scripts preprocessor (.lds.S -> .lds)
@@ -508,6 +516,20 @@ targets += $(obj)/lib-ksyms.o endif +ifdef modobj-target + +quiet_cmd_ar_modobj = AR $@ + cmd_ar_modobj = rm -f $@; \ + $(AR) rcTP$(KBUILD_ARFLAGS) $@ $(filter $(real-modobj-m), $^) + +$(modobj-target): $(real-modobj-m) FORCE + $(call if_changed,ar_modobj) + +targets += $(modobj-target) + +endif # modobj-target + + # # Rule to link composite objects #
scripts/Makefile.lib +10 -4
@@ -16,12 +16,13 @@ KBUILD_CFLAGS += $(subdir-ccflags-y) # is exactly what happens for directories in obj-y. So move all # directories from obj-m to obj-y. Then we will know that any directory # in real-obj-m is a component of some other object. -obj-y := $(obj-y) $(filter %/, $(obj-m)) +obj-y := $(obj-y) $(filter %/, $(obj-m)) $(filter-out $(obj-y), $(modobj-y)) obj-m := $(filter-out %/, $(obj-m)) # When an object is listed to be built compiled-in and modular, # only build the compiled-in version obj-m := $(filter-out $(obj-y),$(obj-m)) +modobj-m := $(filter-out $(obj-y), $(modobj-m)) # Libraries are always collected in one lib file. # Filter out objects already built-in
@@ -42,6 +43,7 @@ single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) # including built-in.a from subdirectories real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) real-obj-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))) +real-modobj-m := $(foreach m, $(modobj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) # Handle objects in subdirs # ---------------------------------------------------------------------------
@@ -53,8 +55,11 @@ __subdir-y := $(patsubst %/,%,$(filter %/, $(real-obj-y))) subdir-y += $(__subdir-y) __subdir-m := $(patsubst %/,%,$(filter %/, $(real-obj-m))) subdir-m += $(__subdir-m) +__subdir-mo := $(patsubst %/,%,$(filter %/, $(real-modobj-m))) +subdir-m += $(__subdir-mo) real-obj-y := $(patsubst %/, %/built-in.a, $(real-obj-y)) real-obj-m := $(patsubst %/, %/mod.a, $(real-obj-m)) +real-modobj-m := $(patsubst %/, %/mod.a, $(real-modobj-m)) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m))
@@ -62,9 +67,9 @@ subdir-ym := $(sort $(subdir-y) $(subdir-m)) # $(subdir-obj-y) is the list of objects in $(real-obj-y) which uses dir/ to # tell kbuild to descend subdir-obj-y := $(filter %/built-in.a, $(real-obj-y)) -# $(subdir-obj-m) is the list of objects in $(real-obj-m) which uses dir/ to -# tell kbuild to descend -subdir-obj-m := $(filter %/mod.a, $(real-obj-m)) +# $(subdir-obj-m) is the list of objects in $(real-obj-m) and +# $(real-modobj-m) which use dir/ to tell kbuild to descend +subdir-obj-m := $(filter %/mod.a, $(real-obj-m) $(real-modobj-m)) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
@@ -83,6 +88,7 @@ subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) subdir-obj-m := $(addprefix $(obj)/,$(subdir-obj-m)) real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) +real-modobj-m := $(addprefix $(obj)/,$(real-modobj-m)) single-used-m := $(addprefix $(obj)/,$(single-used-m)) multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
PATCH v2 3/5 kbuild: support building of per-directory mod.a
This patch allows a "mod.a" to be built in any
directory. A previous patch allows that mod.a
to be included in any module or another mod.a.
This is achieved via a new pair of macros: modobj-y and modobj-m.
Anything in modobj-y is added to obj-y and is otherwise ignored.
Anything listed in modobj-m is built, almost as though "modobj.o" was a requested target. The objects are then combined
into mod.a.
These objects are always built with part-of-module=y.
This is sufficient to build a module from source in multiple directories. Each "other" directory lists something like
modobj-$(CONFIG_FOO) += bar.o bar.o bat.o
and the main directory lists
obj-$(CONFIG-FOO) = foo.o
foo-y = other1/ ../friend/other2/ module.o
---
There was bug in the first version of this.
This line:
+targets += $(filter-out $(subdir-obj-m) $(real-modobj-m), $(real-obj-m)) is now
+targets += $(filter-out $(subdir-obj-m), $(real-modobj-m) $(real-obj-m))
Comma in the wrong place.
Thanks,
NeilBrown
scripts/Makefile.build | 44 +++++++++++++++++++++++++++++++++----------- scripts/Makefile.lib | 14 ++++++++++---- 2 files changed, 43 insertions(+), 15 deletions(-)
scripts/Makefile.build +33 -11
@@ -15,6 +15,8 @@ obj-y := obj-m := lib-y := lib-m := +modobj-y := +modobj-m := always := targets := subdir-y :=
@@ -80,12 +82,16 @@ ifneq ($(strip $(real-obj-y) $(need-builtin)),) builtin-target := $(obj)/built-in.a endif +ifneq ($(strip $(modobj-m)),) +modobj-target := $(obj)/mod.a +endif + modorder-target := $(obj)/modules.order # We keep a list of all modules in $(MODVERDIR) __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ - $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ + $(if $(KBUILD_MODULES),$(obj-m) $(modorder-target) $(modobj-target)) \ $(subdir-ym) $(always) @:
@@ -119,17 +125,19 @@ modkern_cflags = \ $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) quiet_modtag := $(empty) $(empty) -$(real-obj-m) : part-of-module := y -$(real-obj-m:.o=.i) : part-of-module := y -$(real-obj-m:.o=.s) : part-of-module := y -$(real-obj-m:.o=.lst): part-of-module := y +_mod_obj = $(real-obj-m) $(real-modobj-m) + +$(_mod_obj) : part-of-module := y +$(_mod_obj:.o=.i) : part-of-module := y +$(_mod_obj:.o=.s) : part-of-module := y +$(_mod_obj:.o=.lst): part-of-module := y -$(real-obj-m) : quiet_modtag := [M] -$(real-obj-m:.o=.i) : quiet_modtag := [M] -$(real-obj-m:.o=.s) : quiet_modtag := [M] -$(real-obj-m:.o=.lst): quiet_modtag := [M] +$(_mod_obj) : quiet_modtag := [M] +$(_mod_obj:.o=.i) : quiet_modtag := [M] +$(_mod_obj:.o=.s) : quiet_modtag := [M] +$(_mod_obj:.o=.lst): quiet_modtag := [M] -$(obj-m) : quiet_modtag := [M] +$(obj-m) : quiet_modtag := [M] quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $<
@@ -417,7 +425,7 @@ $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE $(call if_changed_rule,as_o_S) targets += $(filter-out $(subdir-obj-y), $(real-obj-y)) -targets += $(filter-out $(subdir-obj-m), $(real-obj-m)) +targets += $(filter-out $(subdir-obj-m), $(real-modobj-m) $(real-obj-m)) targets += $(lib-y) $(extra-y) $(MAKECMDGOALS) $(always) # Linker scripts preprocessor (.lds.S -> .lds)
@@ -508,6 +516,20 @@ targets += $(obj)/lib-ksyms.o endif +ifdef modobj-target + +quiet_cmd_ar_modobj = AR $@ + cmd_ar_modobj = rm -f $@; \ + $(AR) rcTP$(KBUILD_ARFLAGS) $@ $(filter $(real-modobj-m), $^) + +$(modobj-target): $(real-modobj-m) FORCE + $(call if_changed,ar_modobj) + +targets += $(modobj-target) + +endif # modobj-target + + # # Rule to link composite objects #
scripts/Makefile.lib +10 -4
@@ -16,12 +16,13 @@ KBUILD_CFLAGS += $(subdir-ccflags-y) # is exactly what happens for directories in obj-y. So move all # directories from obj-m to obj-y. Then we will know that any directory # in real-obj-m is a component of some other object. -obj-y := $(obj-y) $(filter %/, $(obj-m)) +obj-y := $(obj-y) $(filter %/, $(obj-m)) $(filter-out $(obj-y), $(modobj-y)) obj-m := $(filter-out %/, $(obj-m)) # When an object is listed to be built compiled-in and modular, # only build the compiled-in version obj-m := $(filter-out $(obj-y),$(obj-m)) +modobj-m := $(filter-out $(obj-y), $(modobj-m)) # Libraries are always collected in one lib file. # Filter out objects already built-in
@@ -42,6 +43,7 @@ single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) # including built-in.a from subdirectories real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) real-obj-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))) +real-modobj-m := $(foreach m, $(modobj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m))) # Handle objects in subdirs # ---------------------------------------------------------------------------
@@ -53,8 +55,11 @@ __subdir-y := $(patsubst %/,%,$(filter %/, $(real-obj-y))) subdir-y += $(__subdir-y) __subdir-m := $(patsubst %/,%,$(filter %/, $(real-obj-m))) subdir-m += $(__subdir-m) +__subdir-mo := $(patsubst %/,%,$(filter %/, $(real-modobj-m))) +subdir-m += $(__subdir-mo) real-obj-y := $(patsubst %/, %/built-in.a, $(real-obj-y)) real-obj-m := $(patsubst %/, %/mod.a, $(real-obj-m)) +real-modobj-m := $(patsubst %/, %/mod.a, $(real-modobj-m)) # Subdirectories we need to descend into subdir-ym := $(sort $(subdir-y) $(subdir-m))
@@ -62,9 +67,9 @@ subdir-ym := $(sort $(subdir-y) $(subdir-m)) # $(subdir-obj-y) is the list of objects in $(real-obj-y) which uses dir/ to # tell kbuild to descend subdir-obj-y := $(filter %/built-in.a, $(real-obj-y)) -# $(subdir-obj-m) is the list of objects in $(real-obj-m) which uses dir/ to -# tell kbuild to descend -subdir-obj-m := $(filter %/mod.a, $(real-obj-m)) +# $(subdir-obj-m) is the list of objects in $(real-obj-m) and +# $(real-modobj-m) which use dir/ to tell kbuild to descend +subdir-obj-m := $(filter %/mod.a, $(real-obj-m) $(real-modobj-m)) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
@@ -83,6 +88,7 @@ subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) subdir-obj-m := $(addprefix $(obj)/,$(subdir-obj-m)) real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) +real-modobj-m := $(addprefix $(obj)/,$(real-modobj-m)) single-used-m := $(addprefix $(obj)/,$(single-used-m)) multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
Signature · 1 line
2.14.0.rc0.dirty
PATCH 4/5 kbuild: disable KBUILD_MODNAME when building for mod.a
In reply to NeilBrownWhen building an object to be included in mod.a we cannot know the name of the module. So don't define KBUILD_MODNAME. This will ensure attempt to use that macro when the module name isn't know will trigger an error.
--- scripts/Makefile.lib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.lib +2 -2
@@ -96,7 +96,7 @@ subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) # Finds the multi-part object the current object will be linked into. # If the object belongs to two or more multi-part objects, all of them are # concatenated with a colon separator. -modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ +modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used) modobj.o,\ $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) modname = $(if $(modname-multi),$(modname-multi),$(basetarget))
@@ -106,7 +106,7 @@ modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) # end up in (or would, if it gets compiled in) name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) -modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) +modname_flags = $(if $(filter-out modobj,$(modname)),-DKBUILD_MODNAME=$(call name-fix,$(modname))) orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ $(ccflags-y) $(CFLAGS_$(basetarget).o)
Re: [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a
2018-06-18 13:55 GMT+09:00 NeilBrown <[email protected]>:
Quoted 5 lines
When building an object to be included in mod.a we cannot know the name of the module. So don't define
KBUILD_MODNAME. This will ensure attempt to use that macro when the module name isn't know will trigger an error.
Honestly, I hate KBUILD_MODNAME.
If KBUILD_MODNAME is undefined,
you cannot call pr_debug() in the sub-directory for example.
CONFIG_DYNAMIC_DEBUG requires KBUILD_MODNAME,
but people often miss to notice that, then cause build errors.
Quoted 33 lines
Signed-off-by NeilBrown <[email protected]>--- scripts/Makefile.lib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)scripts/Makefile.lib +2
-3@@ -96,7 +96,7 @@ subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) # Finds the multi-part object the current object will be linked into. # If the object belongs to two or more multi-part objects, all of them are # concatenated with a colon separator. -modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ +modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used) modobj.o,\ $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) modname = $(if $(modname-multi),$(modname-multi),$(basetarget))@@ -106,7 +106,7 @@ modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) # end up in (or would, if it gets compiled in) name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) -modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) +modname_flags = $(if $(filter-out modobj,$(modname)),-DKBUILD_MODNAME=$(call name-fix,$(modname))) orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ $(ccflags-y) $(CFLAGS_$(basetarget).o) --To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a
Quoted 11 lines · Masahiro Yamada
2018-06-18 13:55 GMT+09:00 NeilBrown <[email protected]>:
Quoted 5 lines
When building an object to be included in mod.a we cannot know the name of the module. So don't define
KBUILD_MODNAME. This will ensure attempt to use that macro when the module name isn't know will trigger an error.Honestly, I hate
KBUILD_MODNAME.If
KBUILD_MODNAMEis undefined,
you cannot callpr_debug()in the sub-directory for example.
I think this is only true if you have something like
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
in your .c files. Developers who use modobj-m could be advised not to do this.
Quoted 3 lines
CONFIG_DYNAMIC_DEBUGrequiresKBUILD_MODNAME,
but people often miss to notice that, then cause build errors.
Yes, I can see that.
We could change it to use a default ("no-name") if KBUILD_MODNAME isn't defined. Or we could require that KBUILD_MODNAME always be defined.
Where I've been using these patches I've sometimes been adding
ccflags-y += -DKBUILD_MODNAME='"FOO"'
to Makefiles so that modules_params get handled correctly on non-module builds. I've thought about instead allowing "modobj-name" to be defined and requiring that it be set if either modobj-[yn] is set. Then it gets used for the KBUILD_MODNAME when building modobj modules.
Would you prefer to always require KBUILD_MODNAME, or to use a default name for dynamic-debug?
Thanks,
NeilBrown
Re: [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a
2018-07-04 7:14 GMT+09:00 NeilBrown <[email protected]>:
Quoted 38 lines · Masahiro Yamada
Quoted 8 lines
2018-06-18 13:55 GMT+09:00 NeilBrown <[email protected]>:
Quoted 5 lines
When building an object to be included in mod.a we cannot know the name of the module. So don't define
KBUILD_MODNAME. This will ensure attempt to use that macro when the module name isn't know will trigger an error.Quoted 4 lines
Honestly, I hate
KBUILD_MODNAME.If
KBUILD_MODNAMEis undefined,
you cannot callpr_debug()in the sub-directory for example.I think this is only true if you have something like
#define
pr_fmt(fmt)KBUILD_MODNAME": " fmtin your .c files. Developers who use modobj-m could be advised not to do this.
Quoted 3 lines
CONFIG_DYNAMIC_DEBUGrequiresKBUILD_MODNAME,
but people often miss to notice that, then cause build errors.Yes, I can see that.
We could change it to use a default ("no-name") ifKBUILD_MODNAMEisn't defined. Or we could require thatKBUILD_MODNAMEalways be defined.Where I've been using these patches I've sometimes been adding
ccflags-y += -DKBUILD_MODNAME='"FOO"'
to Makefiles so that
modules_paramsget handled correctly on non-module builds. I've thought about instead allowing "modobj-name" to be defined and requiring that it be set if either modobj-[yn] is set. Then it gets used for theKBUILD_MODNAMEwhen building modobj modules.
Quoted 5 lines
Would you prefer to always require
KBUILD_MODNAME, or to use a default name for dynamic-debug?Thanks,
NeilBrown
I prefer flat directory structure for modules.
Most of modules fit in a single directory.
Signature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a
Quoted 14 lines · Masahiro Yamada
2018-07-04 7:14 GMT+09:00 NeilBrown <[email protected]>:
Quoted 13 lines
Where I've been using these patches I've sometimes been adding
ccflags-y += -DKBUILD_MODNAME='"FOO"'
to Makefiles so that
modules_paramsget handled correctly on non-module builds. I've thought about instead allowing "modobj-name" to be defined and requiring that it be set if either modobj-[yn] is set. Then it gets used for theKBUILD_MODNAMEwhen building modobj modules.Would you prefer to always require
KBUILD_MODNAME, or to use a default name for dynamic-debug?
Quoted 6 lines
Quoted 2 lines
Thanks,
NeilBrownI prefer flat directory structure for modules.
Most of modules fit in a single directory.
I'd prefer that too in general.
But some modules are bigger than others and some times it helps to sub-divide a module.
xfs, btrfs, ceph, net/dccp, and lustre all already use multiple directories despite the poor support, so clearly some developers like a more structured approach to organizing their code. Wouldn't it be good to allow them to make full use of the kbuild system?
Thanks,
NeilBrown
Re: [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a
2018-07-05 6:54 GMT+09:00 NeilBrown <[email protected]>:
Quoted 23 lines · Masahiro Yamada
Quoted 15 lines
2018-07-04 7:14 GMT+09:00 NeilBrown <[email protected]>:
Quoted 13 lines
Where I've been using these patches I've sometimes been adding
ccflags-y += -DKBUILD_MODNAME='"FOO"'
to Makefiles so that
modules_paramsget handled correctly on non-module builds. I've thought about instead allowing "modobj-name" to be defined and requiring that it be set if either modobj-[yn] is set. Then it gets used for theKBUILD_MODNAMEwhen building modobj modules.Would you prefer to always require
KBUILD_MODNAME, or to use a default name for dynamic-debug?Quoted 6 lines
Quoted 2 lines
Thanks,
NeilBrownI prefer flat directory structure for modules.
Most of modules fit in a single directory.
Quoted 7 lines
I'd prefer that too in general.
But some modules are bigger than others and some times it helps to sub-divide a module.
xfs, btrfs, ceph, net/dccp, and lustre all already use multiple directories despite the poor support, so clearly some developers like a more structured approach to organizing their code. Wouldn't it be good to allow them to make full use of the kbuild system?
xfs is quite big, but the others are not too bad.
You can collect files into a single directory if you want. If you mind the namespace, one tip might be to group files with prefix. For example,
drivers/btrfs/tests/foo.o -> drivers/btrfs/test-foo.o
I do not want to introduce a mess to core build scripts.
Quoted 2 lines
Thanks,
NeilBrown
Signature · 2 lines
Best Regards Masahiro Yamada
Re: [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a
Quoted 33 lines · Masahiro Yamada
2018-07-05 6:54 GMT+09:00 NeilBrown <[email protected]>:
Quoted 23 lines · Masahiro Yamada
Quoted 15 lines
2018-07-04 7:14 GMT+09:00 NeilBrown <[email protected]>:
Quoted 13 lines
Where I've been using these patches I've sometimes been adding
ccflags-y += -DKBUILD_MODNAME='"FOO"'
to Makefiles so that
modules_paramsget handled correctly on non-module builds. I've thought about instead allowing "modobj-name" to be defined and requiring that it be set if either modobj-[yn] is set. Then it gets used for theKBUILD_MODNAMEwhen building modobj modules.Would you prefer to always require
KBUILD_MODNAME, or to use a default name for dynamic-debug?Quoted 6 lines
Quoted 2 lines
Thanks,
NeilBrownI prefer flat directory structure for modules.
Most of modules fit in a single directory.Quoted 7 lines
I'd prefer that too in general.
But some modules are bigger than others and some times it helps to sub-divide a module.
xfs, btrfs, ceph, net/dccp, and lustre all already use multiple directories despite the poor support, so clearly some developers like a more structured approach to organizing their code. Wouldn't it be good to allow them to make full use of the kbuild system?
Quoted 6 lines
xfs is quite big, but the others are not too bad.
You can collect files into a single directory if you want. If you mind the namespace, one tip might be to group files with prefix. For example,
drivers/btrfs/tests/foo.o->drivers/btrfs/test-foo.o
Certainly that is possible. We could even place all of linux in a single directory, but that would be a bad idea. Subdividing large bodies of code into files and then directories is a widely used practice. Why do you want make it hard for people to structure their code in the way that seems most suitable to them?
My particular interest is lustre which has quite a few more subdirectories than btrfs or xfs. It currently builds as nearly a dozen modules, one per directory (and that is just the client side). This requires a lot more exports than should be necessary, and exposes internal detail unnecessarily. I would much rather it were fewer modules.
Quoted 2 lines
I do not want to introduce a mess to core build scripts.
What mess are you referring to? The code I provided follows the style of the current code and has the same general level of complexity as the current code. How is it a mess?
Thanks,
NeilBrown
PATCH 5/5 kbuild: Add documentation for modobj-m
In reply to NeilBrownAdd documentation for building modules
from multiple directories using modobj-m.
--- Documentation/kbuild/makefiles.txt | 65 ++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 4 deletions(-)
Documentation/kbuild/makefiles.txt +61 -4
@@ -225,17 +225,74 @@ more details, with real examples. part of the composite object ext2.o if $(CONFIG_EXT2_FS_XATTR) evaluates to 'y'. + If you wish to include code in some other directory into a + module, that directory should be configured to create a + mod.a target from the relevant code, as described below. + The list of components for the module (e.g. foo-y) should + then contain the name of the directory (with trailing /). + The mod.a from that directory will be built and included + into this module. + Note: Of course, when you are building objects into the kernel, the syntax above will also work. So, if you have CONFIG_EXT2_FS=y, kbuild will build an ext2.o file for you out of the individual parts and then link this into built-in.a, as you would expect. ---- 3.4 Objects which export symbols +--- 3.4 Loadable modules from multiple directories - modobj-m + + One way to build modules with source from multiple directories + is to list relative path names of all source files in a + single Makefile. + + Example: + btrfs-$(CONFIG_BTRFS_FS_RUN_SANITY_TESTS) += tests/free-space-tests.o \ + tests/extent-buffer-tests.o tests/btrfs-tests.o \ + .... + + This works, but defeats the ability to build individual + directories, or individual target files such as assembly + language targets. + + Example: + make btrfs/tests/free-space-tests.s + + A more general way is to create a mod.a file using modobj-m + + Example: + modobj-$(CONFIG_LUSTRE_FS) += fid_request.o fid_lib.o lproc_fid.o + + modobj-y is treated identically to obj-y so if CONFIG_LUSTRE_FS=y + then these objects are built in to the kernel. If + CONFIG_LUSTRE_FS=m then these objects are gathered into an archive + called mod.a. Archives from other directories can be included + by listing the directories in modobj-m, so + + Example: + modobj-$(CONFIG_LUSTRE_FS) += fid/ fld/ + + This will create a mod.a in the same directory as the + Makefile, combining the contents of mod.a from the listed + directories. The mod.a can instead be included into a module + by listing the directory with any other local object files. + + Example: + obj-$(CONFIG_LUSTRE_FS) += lustre.o + lustre-y := module.o + lustre-y += obdclass/ ldlm/ ptlrpc/ fld/ osc/ mgc/ + + When CONFIG_LUSTRE_FS=m, kbuild will build lustre.ko from module.o and + the mod.a archives created in the listed directories. + + When components of a module are built in a different directory + kbuild cannot determine the name of the module so the + KBUILD_MODNAME macro is left undefined. + +--- 3.5 Objects which export symbols No special notation is required in the makefiles for modules exporting symbols. ---- 3.5 Library file goals - lib-y +--- 3.6 Library file goals - lib-y Objects listed with obj-* are used for modules, or combined in a built-in.a for that specific directory.
@@ -263,7 +320,7 @@ more details, with real examples. Use of lib-y is normally restricted to lib/ and arch/*/lib. ---- 3.6 Descending down in directories +--- 3.7 Descending down in directories A Makefile is only responsible for building objects in its own directory. Files in subdirectories should be taken care of by
@@ -290,7 +347,7 @@ more details, with real examples. names. This allows kbuild to totally skip the directory if the corresponding CONFIG_ option is neither 'y' nor 'm'. ---- 3.7 Compilation flags +--- 3.8 Compilation flags ccflags-y, asflags-y and ldflags-y These three flags apply only to the kbuild makefile in which they
Quoted 18 lines · NeilBrown
This set of patches makes it possible to build a module from code in multiple directories without needing to list files from one directory in the
Makefileof another directory.The code was developed for lustre (which is now out-of-tree :-( ) but can be useful elsewhere, such as for xfs and btrfs and others.
In
fs/xfs/Makefilethe section:xfs-y += $(addprefix libxfs/, \ xfs_ag.o \ xfs_alloc.o \ .....could become
xfs-y += libxfs/
Quoted 8 lines
and then in
fs/xfs/libxfs/Makefilewe would havemodobj-$(CONFIG_XFS_FS) += xfs_ag.o \ xfs_alloc.o \ .....A similar process could move filenames for scrub/* from the
fs/xfs/Makefiletofs/xfs/scrub/Makefile
How about you actually convert it as an example?
Quoted 21 lines · Christoph Hellwig
Quoted 20 lines · NeilBrown
This set of patches makes it possible to build a module from code in multiple directories without needing to list files from one directory in the
Makefileof another directory.The code was developed for lustre (which is now out-of-tree :-( ) but can be useful elsewhere, such as for xfs and btrfs and others.
In
fs/xfs/Makefilethe section:xfs-y += $(addprefix libxfs/, \ xfs_ag.o \ xfs_alloc.o \ .....could become
xfs-y += libxfs/
and then in
fs/xfs/libxfs/Makefilewe would have
Quoted 8 lines
Quoted 6 lines
modobj-$(CONFIG_XFS_FS) += xfs_ag.o \ xfs_alloc.o \ .....A similar process could move filenames for scrub/* from the
fs/xfs/Makefiletofs/xfs/scrub/MakefileHow about you actually convert it as an example?
Sure ... found a bug while testing it. Thanks :-)
From ac7953b4ba6d9a2a69dab84dd772aafca38d8377 Mon Sep 17 00:00:00 2001
From: NeilBrown <[email protected]>
Date: Tue, 19 Jun 2018 13:59:16 +1000
Subject: [PATCH] kbuild/xfs: example modobj-m conversion
This is a demonstration patch to show how
xfs can be changed to make use of the proposed modobj-m= functionality, should the xfs developers want that.
--- fs/xfs/Makefile | 78 ++------------------------------------------------ fs/xfs/libxfs/Makefile | 43 ++++++++++++++++++++++++++++ fs/xfs/scrub/Makefile | 29 +++++++++++++++++++ 3 files changed, 74 insertions(+), 76 deletions(-) create mode 100644 fs/xfs/libxfs/Makefile create mode 100644 fs/xfs/scrub/Makefile
fs/xfs/Makefile +2 -76
@@ -15,47 +15,7 @@ obj-$(CONFIG_XFS_FS) += xfs.o xfs-y += xfs_trace.o # build the libxfs code first -xfs-y += $(addprefix libxfs/, \ - xfs_ag.o \ - xfs_alloc.o \ - xfs_alloc_btree.o \ - xfs_attr.o \ - xfs_attr_leaf.o \ - xfs_attr_remote.o \ - xfs_bit.o \ - xfs_bmap.o \ - xfs_bmap_btree.o \ - xfs_btree.o \ - xfs_da_btree.o \ - xfs_da_format.o \ - xfs_defer.o \ - xfs_dir2.o \ - xfs_dir2_block.o \ - xfs_dir2_data.o \ - xfs_dir2_leaf.o \ - xfs_dir2_node.o \ - xfs_dir2_sf.o \ - xfs_dquot_buf.o \ - xfs_ialloc.o \ - xfs_ialloc_btree.o \ - xfs_iext_tree.o \ - xfs_inode_fork.o \ - xfs_inode_buf.o \ - xfs_log_rlimit.o \ - xfs_ag_resv.o \ - xfs_rmap.o \ - xfs_rmap_btree.o \ - xfs_refcount.o \ - xfs_refcount_btree.o \ - xfs_sb.o \ - xfs_symlink_remote.o \ - xfs_trans_resv.o \ - xfs_types.o \ - ) -# xfs_rtbitmap is shared with libxfs -xfs-$(CONFIG_XFS_RT) += $(addprefix libxfs/, \ - xfs_rtbitmap.o \ - ) +xfs-y += libxfs/ # highlevel code xfs-y += xfs_aops.o \
@@ -127,38 +87,4 @@ xfs-$(CONFIG_SYSCTL) += xfs_sysctl.o xfs-$(CONFIG_COMPAT) += xfs_ioctl32.o xfs-$(CONFIG_EXPORTFS_BLOCK_OPS) += xfs_pnfs.o -# online scrub/repair -ifeq ($(CONFIG_XFS_ONLINE_SCRUB),y) - -# Tracepoints like to blow up, so build that before everything else - -xfs-y += $(addprefix scrub/, \ - trace.o \ - agheader.o \ - alloc.o \ - attr.o \ - bmap.o \ - btree.o \ - common.o \ - dabtree.o \ - dir.o \ - ialloc.o \ - inode.o \ - parent.o \ - refcount.o \ - rmap.o \ - scrub.o \ - symlink.o \ - ) - -xfs-$(CONFIG_XFS_RT) += scrub/rtbitmap.o -xfs-$(CONFIG_XFS_QUOTA) += scrub/quota.o - -# online repair -ifeq ($(CONFIG_XFS_ONLINE_REPAIR),y) -xfs-y += $(addprefix scrub/, \ - agheader_repair.o \ - repair.o \ - ) -endif -endif +xfs-$(CONFIG_XFS_ONLINE_SCRUB) += scrub/
fs/xfs/libxfs/Makefile new file +43 -0
43 lines not on this page · raw message
fs/xfs/scrub/Makefile new file +29 -0
@@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0 + +# Tracepoints like to blow up, so build that before everything else + +ccflags-y += -I$(src)/.. +ccflags-y += -I$(src)/../libxfs + +xobj-$(CONFIG_XFS_RT) += rtbitmap.o +xobj-$(CONFIG_XFS_QUOTA) += quota.o +xobj-$(CONFIG_XFS_ONLINE_REPAIR)+= agheader_repair.o \ + repair.o + +modobj-$(CONFIG_XFS_FS) += trace.o \ + agheader.o \ + alloc.o \ + attr.o \ + bmap.o \ + btree.o \ + common.o \ + dabtree.o \ + dir.o \ + ialloc.o \ + inode.o \ + parent.o \ + refcount.o \ + rmap.o \ + scrub.o \ + symlink.o \ + $(xobj-y)
Signature · 1 line
2.14.0.rc0.dirty
Quoted 7 lines · NeilBrown
From: NeilBrown <[email protected]>
Date: Tue, 19 Jun 2018 13:59:16 +1000
Subject: [PATCH] kbuild/xfs: example modobj-m conversionThis is a demonstration patch to show how
xfs can be changed to make use of the proposed modobj-m= functionality, should the xfs developers want that.
Well, IFF we go with this new functionality I think everyone should be using it instead of the current hacks.
So text like the above should be in the series cover letter, and this patch should have an actual description..
I see no argument against these changes, but I've also added the XFS list.
Quoted 190 lines
Signed-off-by NeilBrown <[email protected]>--- fs/xfs/Makefile | 78 ++------------------------------------------------ fs/xfs/libxfs/Makefile | 43 ++++++++++++++++++++++++++++ fs/xfs/scrub/Makefile | 29 +++++++++++++++++++ 3 files changed, 74 insertions(+), 76 deletions(-) create mode 100644 fs/xfs/libxfs/Makefile create mode 100644 fs/xfs/scrub/Makefilefs/xfs/Makefile +2
-76@@ -15,47 +15,7 @@ obj-$(CONFIG_XFS_FS) += xfs.o xfs-y += xfs_trace.o # build the libxfs code first -xfs-y += $(addprefix libxfs/, \ - xfs_ag.o \ - xfs_alloc.o \ - xfs_alloc_btree.o \ - xfs_attr.o \ - xfs_attr_leaf.o \ - xfs_attr_remote.o \ - xfs_bit.o \ - xfs_bmap.o \ - xfs_bmap_btree.o \ - xfs_btree.o \ - xfs_da_btree.o \ - xfs_da_format.o \ - xfs_defer.o \ - xfs_dir2.o \ - xfs_dir2_block.o \ - xfs_dir2_data.o \ - xfs_dir2_leaf.o \ - xfs_dir2_node.o \ - xfs_dir2_sf.o \ - xfs_dquot_buf.o \ - xfs_ialloc.o \ - xfs_ialloc_btree.o \ - xfs_iext_tree.o \ - xfs_inode_fork.o \ - xfs_inode_buf.o \ - xfs_log_rlimit.o \ - xfs_ag_resv.o \ - xfs_rmap.o \ - xfs_rmap_btree.o \ - xfs_refcount.o \ - xfs_refcount_btree.o \ - xfs_sb.o \ - xfs_symlink_remote.o \ - xfs_trans_resv.o \ - xfs_types.o \ - ) -# xfs_rtbitmap is shared with libxfs -xfs-$(CONFIG_XFS_RT) += $(addprefix libxfs/, \ - xfs_rtbitmap.o \ - ) +xfs-y += libxfs/ # highlevel code xfs-y += xfs_aops.o \@@ -127,38 +87,4 @@ xfs-$(CONFIG_SYSCTL) += xfs_sysctl.o xfs-$(CONFIG_COMPAT) += xfs_ioctl32.o xfs-$(CONFIG_EXPORTFS_BLOCK_OPS) += xfs_pnfs.o -# online scrub/repair -ifeq ($(CONFIG_XFS_ONLINE_SCRUB),y) - -# Tracepoints like to blow up, so build that before everything else - -xfs-y += $(addprefix scrub/, \ - trace.o \ - agheader.o \ - alloc.o \ - attr.o \ - bmap.o \ - btree.o \ - common.o \ - dabtree.o \ - dir.o \ - ialloc.o \ - inode.o \ - parent.o \ - refcount.o \ - rmap.o \ - scrub.o \ - symlink.o \ - ) - -xfs-$(CONFIG_XFS_RT) += scrub/rtbitmap.o -xfs-$(CONFIG_XFS_QUOTA) += scrub/quota.o - -# online repair -ifeq ($(CONFIG_XFS_ONLINE_REPAIR),y) -xfs-y += $(addprefix scrub/, \ - agheader_repair.o \ - repair.o \ - ) -endif -endif +xfs-$(CONFIG_XFS_ONLINE_SCRUB) += scrub/fs/xfs/libxfs/Makefile new file +43
-0@@ -0,0 +1,43 @@ +# SPDX-License-Identifier: GPL-2.0 + +ccflags-y += -I$(src)/.. + +# xfs_rtbitmap is shared with libxfs +xobj-$(CONFIG_XFS_RT) += xfs_rtbitmap.o + +modobj-$(CONFIG_XFS_FS) += xfs_ag.o \ + xfs_alloc.o \ + xfs_alloc_btree.o \ + xfs_attr.o \ + xfs_attr_leaf.o \ + xfs_attr_remote.o \ + xfs_bit.o \ + xfs_bmap.o \ + xfs_bmap_btree.o \ + xfs_btree.o \ + xfs_da_btree.o \ + xfs_da_format.o \ + xfs_defer.o \ + xfs_dir2.o \ + xfs_dir2_block.o \ + xfs_dir2_data.o \ + xfs_dir2_leaf.o \ + xfs_dir2_node.o \ + xfs_dir2_sf.o \ + xfs_dquot_buf.o \ + xfs_ialloc.o \ + xfs_ialloc_btree.o \ + xfs_iext_tree.o \ + xfs_inode_fork.o \ + xfs_inode_buf.o \ + xfs_log_rlimit.o \ + xfs_ag_resv.o \ + xfs_rmap.o \ + xfs_rmap_btree.o \ + xfs_refcount.o \ + xfs_refcount_btree.o \ + xfs_sb.o \ + xfs_symlink_remote.o \ + xfs_trans_resv.o \ + xfs_types.o \ + $(xobj-y)fs/xfs/scrub/Makefile new file +29
-0@@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0 + +# Tracepoints like to blow up, so build that before everything else + +ccflags-y += -I$(src)/.. +ccflags-y += -I$(src)/../libxfs + +xobj-$(CONFIG_XFS_RT) += rtbitmap.o +xobj-$(CONFIG_XFS_QUOTA) += quota.o +xobj-$(CONFIG_XFS_ONLINE_REPAIR)+= agheader_repair.o \ + repair.o + +modobj-$(CONFIG_XFS_FS) += trace.o \ + agheader.o \ + alloc.o \ + attr.o \ + bmap.o \ + btree.o \ + common.o \ + dabtree.o \ + dir.o \ + ialloc.o \ + inode.o \ + parent.o \ + refcount.o \ + rmap.o \ + scrub.o \ + symlink.o \ + $(xobj-y)Signature · 1 line
2.14.0.rc0.dirty
---end quoted text---
Quoted 9 lines · Christoph Hellwig
Quoted 7 lines · NeilBrown
From: NeilBrown <[email protected]>
Date: Tue, 19 Jun 2018 13:59:16 +1000
Subject: [PATCH] kbuild/xfs: example modobj-m conversionThis is a demonstration patch to show how
xfs can be changed to make use of the proposed modobj-m= functionality, should the xfs developers want that.
Quoted 8 lines
Well, IFF we go with this new functionality I think everyone should be using it instead of the current hacks.
So text like the above should be in the series cover letter, and this patch should have an actual description..
I see no argument against these changes, but I've also added the XFS list.
Yes, please send the entire series to the xfs list in the future.
It looks like a reasonable reorganization of makefile goop. :)
(Will dig for the rest of the series on lkml tomorrow I guess.)
Quoted 153 lines
Quoted 153 lines
Signed-off-by NeilBrown <[email protected]>--- fs/xfs/Makefile | 78 ++------------------------------------------------ fs/xfs/libxfs/Makefile | 43 ++++++++++++++++++++++++++++ fs/xfs/scrub/Makefile | 29 +++++++++++++++++++ 3 files changed, 74 insertions(+), 76 deletions(-) create mode 100644 fs/xfs/libxfs/Makefile create mode 100644 fs/xfs/scrub/Makefilefs/xfs/Makefile +2
-76@@ -15,47 +15,7 @@ obj-$(CONFIG_XFS_FS) += xfs.o xfs-y += xfs_trace.o # build the libxfs code first -xfs-y += $(addprefix libxfs/, \ - xfs_ag.o \ - xfs_alloc.o \ - xfs_alloc_btree.o \ - xfs_attr.o \ - xfs_attr_leaf.o \ - xfs_attr_remote.o \ - xfs_bit.o \ - xfs_bmap.o \ - xfs_bmap_btree.o \ - xfs_btree.o \ - xfs_da_btree.o \ - xfs_da_format.o \ - xfs_defer.o \ - xfs_dir2.o \ - xfs_dir2_block.o \ - xfs_dir2_data.o \ - xfs_dir2_leaf.o \ - xfs_dir2_node.o \ - xfs_dir2_sf.o \ - xfs_dquot_buf.o \ - xfs_ialloc.o \ - xfs_ialloc_btree.o \ - xfs_iext_tree.o \ - xfs_inode_fork.o \ - xfs_inode_buf.o \ - xfs_log_rlimit.o \ - xfs_ag_resv.o \ - xfs_rmap.o \ - xfs_rmap_btree.o \ - xfs_refcount.o \ - xfs_refcount_btree.o \ - xfs_sb.o \ - xfs_symlink_remote.o \ - xfs_trans_resv.o \ - xfs_types.o \ - ) -# xfs_rtbitmap is shared with libxfs -xfs-$(CONFIG_XFS_RT) += $(addprefix libxfs/, \ - xfs_rtbitmap.o \ - ) +xfs-y += libxfs/ # highlevel code xfs-y += xfs_aops.o \@@ -127,38 +87,4 @@ xfs-$(CONFIG_SYSCTL) += xfs_sysctl.o xfs-$(CONFIG_COMPAT) += xfs_ioctl32.o xfs-$(CONFIG_EXPORTFS_BLOCK_OPS) += xfs_pnfs.o -# online scrub/repair -ifeq ($(CONFIG_XFS_ONLINE_SCRUB),y) - -# Tracepoints like to blow up, so build that before everything else - -xfs-y += $(addprefix scrub/, \ - trace.o \ - agheader.o \ - alloc.o \ - attr.o \ - bmap.o \ - btree.o \ - common.o \ - dabtree.o \ - dir.o \ - ialloc.o \ - inode.o \ - parent.o \ - refcount.o \ - rmap.o \ - scrub.o \ - symlink.o \ - ) - -xfs-$(CONFIG_XFS_RT) += scrub/rtbitmap.o -xfs-$(CONFIG_XFS_QUOTA) += scrub/quota.o - -# online repair -ifeq ($(CONFIG_XFS_ONLINE_REPAIR),y) -xfs-y += $(addprefix scrub/, \ - agheader_repair.o \ - repair.o \ - ) -endif -endif +xfs-$(CONFIG_XFS_ONLINE_SCRUB) += scrub/fs/xfs/libxfs/Makefile new file +43
-0@@ -0,0 +1,43 @@ +# SPDX-License-Identifier: GPL-2.0 + +ccflags-y += -I$(src)/.. + +# xfs_rtbitmap is shared with libxfs +xobj-$(CONFIG_XFS_RT) += xfs_rtbitmap.o + +modobj-$(CONFIG_XFS_FS) += xfs_ag.o \ + xfs_alloc.o \ + xfs_alloc_btree.o \ + xfs_attr.o \ + xfs_attr_leaf.o \ + xfs_attr_remote.o \ + xfs_bit.o \ + xfs_bmap.o \ + xfs_bmap_btree.o \ + xfs_btree.o \ + xfs_da_btree.o \ + xfs_da_format.o \ + xfs_defer.o \ + xfs_dir2.o \ + xfs_dir2_block.o \ + xfs_dir2_data.o \ + xfs_dir2_leaf.o \ + xfs_dir2_node.o \ + xfs_dir2_sf.o \ + xfs_dquot_buf.o \ + xfs_ialloc.o \ + xfs_ialloc_btree.o \ + xfs_iext_tree.o \ + xfs_inode_fork.o \ + xfs_inode_buf.o \ + xfs_log_rlimit.o \ + xfs_ag_resv.o \ + xfs_rmap.o \ + xfs_rmap_btree.o \ + xfs_refcount.o \ + xfs_refcount_btree.o \ + xfs_sb.o \ + xfs_symlink_remote.o \ + xfs_trans_resv.o \ + xfs_types.o \ + $(xobj-y)fs/xfs/scrub/Makefile +0
-0
Quoted 8 lines
fs/xfs/scrub/Makefile line 3
Quoted 8 lines
new file mode 100644
index 000000000000..f91818a0e6eefs/xfs/scrub/Makefile new file +3
-0@@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0 + +# Tracepoints like to blow up, so build that before everything else
This comment ought to stay with trace.o below because that's what it applies to.
--D
Quoted 36 lines
Quoted 29 lines
fs/xfs/scrub/Makefile new file +26
-0+ +ccflags-y += -I$(src)/.. +ccflags-y += -I$(src)/../libxfs + +xobj-$(CONFIG_XFS_RT) += rtbitmap.o +xobj-$(CONFIG_XFS_QUOTA) += quota.o +xobj-$(CONFIG_XFS_ONLINE_REPAIR)+= agheader_repair.o \ + repair.o + +modobj-$(CONFIG_XFS_FS) += trace.o \ + agheader.o \ + alloc.o \ + attr.o \ + bmap.o \ + btree.o \ + common.o \ + dabtree.o \ + dir.o \ + ialloc.o \ + inode.o \ + parent.o \ + refcount.o \ + rmap.o \ + scrub.o \ + symlink.o \ + $(xobj-y)Signature · 1 line
2.14.0.rc0.dirty---end quoted text---
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html