All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@freescale.com>
To: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	daniel.vetter@ffwll.ch, Michal Marek <mmarek@suse.com>,
	linux-usb@vger.kernel.org, Joern Engel <joern@logfs.org>,
	Prasad Joshi <prasadjoshi.linux@gmail.com>,
	logfs@logfs.org
Subject: Re: [PATCH 2/3] kbuild: Allow to specify composite modules with modname-m
Date: Thu, 29 Oct 2015 14:34:28 +0800	[thread overview]
Message-ID: <20151029063427.GB8367@shlinux2> (raw)
In-Reply-To: <1446038742-13482-2-git-send-email-mmarek@suse.cz>

On Wed, Oct 28, 2015 at 02:25:41PM +0100, Michal Marek wrote:
> From: Michal Marek <mmarek@suse.com>
> 
> 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.
> 
> Cc: Peter Chen <Peter.Chen@freescale.com>
> Cc: linux-usb@vger.kernel.org
> Cc: Joern Engel <joern@logfs.org>
> Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
> Cc: logfs@logfs.org
> Signed-off-by: Michal Marek <mmarek@suse.com>
> ---
>  drivers/misc/ibmasm/ibmasm.h   | 2 +-
>  drivers/usb/chipidea/otg_fsm.h | 2 +-
>  fs/logfs/logfs.h               | 2 +-
>  scripts/Makefile.build         | 8 ++++++--
>  scripts/Makefile.lib           | 4 ++--
>  5 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h
> index 9b08344..5bd1277 100644
> --- a/drivers/misc/ibmasm/ibmasm.h
> +++ b/drivers/misc/ibmasm/ibmasm.h
> @@ -211,7 +211,7 @@ void ibmasmfs_unregister(void);
>  void ibmasmfs_add_sp(struct service_processor *sp);
>  
>  /* uart */
> -#ifdef CONFIG_SERIAL_8250
> +#if IS_ENABLED(CONFIG_SERIAL_8250)
>  void ibmasm_register_uart(struct service_processor *sp);
>  void ibmasm_unregister_uart(struct service_processor *sp);
>  #else
> diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h
> index 2689375..262d6ef 100644
> --- a/drivers/usb/chipidea/otg_fsm.h
> +++ b/drivers/usb/chipidea/otg_fsm.h
> @@ -62,7 +62,7 @@
>  /* SSEND time before SRP */
>  #define TB_SSEND_SRP         (1500)	/* minimum 1.5 sec, section:5.1.2 */
>  
> -#ifdef CONFIG_USB_OTG_FSM
> +#if IS_ENABLED(CONFIG_USB_OTG_FSM)

Does it mean if the configuration is tristate, it must use IS_ENABLED?

Peter
>  
>  int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci);
>  int ci_otg_fsm_work(struct ci_hdrc *ci);
> diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h
> index 5f09376..23f961a 100644
> --- a/fs/logfs/logfs.h
> +++ b/fs/logfs/logfs.h
> @@ -485,7 +485,7 @@ static inline int logfs_get_sb_bdev(struct logfs_super *s,
>  #endif
>  
>  /* dev_mtd.c */
> -#ifdef CONFIG_MTD
> +#if IS_ENABLED(CONFIG_MTD)
>  int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr);
>  #else
>  static inline int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 01df30a..2c47f9c 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -372,10 +372,14 @@ endif
>  #    <composite-object>-objs := <list of .o files>
>  #  or
>  #    <composite-object>-y    := <list of .o files>
> +#  or
> +#    <composite-object>-m    := <list of .o files>
> +#  The -m syntax only works if <composite object> is a module
>  link_multi_deps =                     \
>  $(filter $(addprefix $(obj)/,         \
>  $($(subst $(obj)/,,$(@:.o=-objs)))    \
> -$($(subst $(obj)/,,$(@:.o=-y)))), $^)
> +$($(subst $(obj)/,,$(@:.o=-y)))       \
> +$($(subst $(obj)/,,$(@:.o=-m)))), $^)
>  
>  quiet_cmd_link_multi-y = LD      $@
>  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)
>  $(multi-used-m): FORCE
>  	$(call if_changed,link_multi-m)
>  	@{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod)
> -$(call multi_depend, $(multi-used-m), .o, -objs -y)
> +$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
>  
>  targets += $(multi-used-y) $(multi-used-m)
>  
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 79e8661..e18957b 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -48,7 +48,7 @@ subdir-ym	:= $(sort $(subdir-y) $(subdir-m))
>  
>  # if $(foo-objs) 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))))
> +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)))
>  
> @@ -67,7 +67,7 @@ obj-dirs := $(dir $(multi-objs) $(obj-y))
>  
>  # Replace multi-part objects by their individual parts, look at local dir only
>  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)
> -real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
> +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)))
>  
>  # Add subdir path
>  
> -- 
> 1.9.2
> 

-- 

Best Regards,
Peter Chen

WARNING: multiple messages have this Message-ID (diff)
From: Peter Chen <peter.chen@freescale.com>
To: Michal Marek <mmarek@suse.cz>
Cc: <linux-kbuild@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<daniel.vetter@ffwll.ch>, Michal Marek <mmarek@suse.com>,
	<linux-usb@vger.kernel.org>, Joern Engel <joern@logfs.org>,
	Prasad Joshi <prasadjoshi.linux@gmail.com>, <logfs@logfs.org>
Subject: Re: [PATCH 2/3] kbuild: Allow to specify composite modules with modname-m
Date: Thu, 29 Oct 2015 14:34:28 +0800	[thread overview]
Message-ID: <20151029063427.GB8367@shlinux2> (raw)
In-Reply-To: <1446038742-13482-2-git-send-email-mmarek@suse.cz>

On Wed, Oct 28, 2015 at 02:25:41PM +0100, Michal Marek wrote:
> From: Michal Marek <mmarek@suse.com>
> 
> 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.
> 
> Cc: Peter Chen <Peter.Chen@freescale.com>
> Cc: linux-usb@vger.kernel.org
> Cc: Joern Engel <joern@logfs.org>
> Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
> Cc: logfs@logfs.org
> Signed-off-by: Michal Marek <mmarek@suse.com>
> ---
>  drivers/misc/ibmasm/ibmasm.h   | 2 +-
>  drivers/usb/chipidea/otg_fsm.h | 2 +-
>  fs/logfs/logfs.h               | 2 +-
>  scripts/Makefile.build         | 8 ++++++--
>  scripts/Makefile.lib           | 4 ++--
>  5 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h
> index 9b08344..5bd1277 100644
> --- a/drivers/misc/ibmasm/ibmasm.h
> +++ b/drivers/misc/ibmasm/ibmasm.h
> @@ -211,7 +211,7 @@ void ibmasmfs_unregister(void);
>  void ibmasmfs_add_sp(struct service_processor *sp);
>  
>  /* uart */
> -#ifdef CONFIG_SERIAL_8250
> +#if IS_ENABLED(CONFIG_SERIAL_8250)
>  void ibmasm_register_uart(struct service_processor *sp);
>  void ibmasm_unregister_uart(struct service_processor *sp);
>  #else
> diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h
> index 2689375..262d6ef 100644
> --- a/drivers/usb/chipidea/otg_fsm.h
> +++ b/drivers/usb/chipidea/otg_fsm.h
> @@ -62,7 +62,7 @@
>  /* SSEND time before SRP */
>  #define TB_SSEND_SRP         (1500)	/* minimum 1.5 sec, section:5.1.2 */
>  
> -#ifdef CONFIG_USB_OTG_FSM
> +#if IS_ENABLED(CONFIG_USB_OTG_FSM)

Does it mean if the configuration is tristate, it must use IS_ENABLED?

Peter
>  
>  int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci);
>  int ci_otg_fsm_work(struct ci_hdrc *ci);
> diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h
> index 5f09376..23f961a 100644
> --- a/fs/logfs/logfs.h
> +++ b/fs/logfs/logfs.h
> @@ -485,7 +485,7 @@ static inline int logfs_get_sb_bdev(struct logfs_super *s,
>  #endif
>  
>  /* dev_mtd.c */
> -#ifdef CONFIG_MTD
> +#if IS_ENABLED(CONFIG_MTD)
>  int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr);
>  #else
>  static inline int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 01df30a..2c47f9c 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -372,10 +372,14 @@ endif
>  #    <composite-object>-objs := <list of .o files>
>  #  or
>  #    <composite-object>-y    := <list of .o files>
> +#  or
> +#    <composite-object>-m    := <list of .o files>
> +#  The -m syntax only works if <composite object> is a module
>  link_multi_deps =                     \
>  $(filter $(addprefix $(obj)/,         \
>  $($(subst $(obj)/,,$(@:.o=-objs)))    \
> -$($(subst $(obj)/,,$(@:.o=-y)))), $^)
> +$($(subst $(obj)/,,$(@:.o=-y)))       \
> +$($(subst $(obj)/,,$(@:.o=-m)))), $^)
>  
>  quiet_cmd_link_multi-y = LD      $@
>  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)
>  $(multi-used-m): FORCE
>  	$(call if_changed,link_multi-m)
>  	@{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod)
> -$(call multi_depend, $(multi-used-m), .o, -objs -y)
> +$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
>  
>  targets += $(multi-used-y) $(multi-used-m)
>  
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 79e8661..e18957b 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -48,7 +48,7 @@ subdir-ym	:= $(sort $(subdir-y) $(subdir-m))
>  
>  # if $(foo-objs) 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))))
> +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)))
>  
> @@ -67,7 +67,7 @@ obj-dirs := $(dir $(multi-objs) $(obj-y))
>  
>  # Replace multi-part objects by their individual parts, look at local dir only
>  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)
> -real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
> +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)))
>  
>  # Add subdir path
>  
> -- 
> 1.9.2
> 

-- 

Best Regards,
Peter Chen

  reply	other threads:[~2015-10-29  6:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28 13:25 [PATCH 1/3] staging/ad7606: Actually build the interface modules Michal Marek
2015-10-28 13:25 ` [PATCH 2/3] kbuild: Allow to specify composite modules with modname-m Michal Marek
2015-10-29  6:34   ` Peter Chen [this message]
2015-10-29  6:34     ` Peter Chen
2015-10-29  8:05     ` Michal Marek
2015-10-29  8:07       ` Peter Chen
2015-10-29  8:07         ` Peter Chen
2015-11-25 12:30   ` Michal Marek
2015-10-28 13:25 ` [PATCH 3/3] Revert "drm: Hack around CONFIG_AGP=m build failures" Michal Marek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151029063427.GB8367@shlinux2 \
    --to=peter.chen@freescale.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=joern@logfs.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=logfs@logfs.org \
    --cc=mmarek@suse.com \
    --cc=mmarek@suse.cz \
    --cc=prasadjoshi.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.