>>>>> "Daniel" == Daniel Mack <zonque@xxxxxxxxx> writes: Daniel> This makes building the actual object files optional to the selected Daniel> mode, which saves users who know which kind of USB mode support they Daniel> need some binary size. Daniel> Unimplemented functions are stubbed out with static inline functions. Daniel> Signed-off-by: Daniel Mack <zonque@xxxxxxxxx> Daniel> --- Daniel> drivers/usb/musb/Kconfig | 29 +++++++++++++++++++++++++++++ Daniel> drivers/usb/musb/Makefile | 10 ++++++++-- Daniel> drivers/usb/musb/musb_gadget.h | 21 +++++++++++++++++++++ Daniel> drivers/usb/musb/musb_host.h | 29 +++++++++++++++++++++++++++-- Daniel> 4 files changed, 85 insertions(+), 4 deletions(-) Daniel> diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig Daniel> index 47442d3..aab1568 100644 Daniel> --- a/drivers/usb/musb/Kconfig Daniel> +++ b/drivers/usb/musb/Kconfig Daniel> @@ -28,6 +28,35 @@ config USB_MUSB_HDRC Daniel> if USB_MUSB_HDRC Daniel> choice Daniel> + bool "MUSB Mode Selection" Daniel> + default USB_MUSB_DUAL_ROLE if (USB && USB_GADGET) Daniel> + default USB_MUSB_HOST if (USB && !USB_GADGET) Daniel> + default USB_MUSB_GADGET if (!USB && USB_GADGET) Daniel> + Daniel> +config USB_MUSB_HOST Daniel> + bool "Host only mode" Daniel> + depends on USB Daniel> + help Daniel> + Select this when you want to use MUSB in host mode only, Daniel> + thereby the gadget feature will be regressed. Daniel> + Daniel> +config USB_MUSB_GADGET Daniel> + bool "Gadget only mode" Daniel> + depends on USB_GADGET Daniel> + help Daniel> + Select this when you want to use MUSB in gadget mode only, Daniel> + thereby the host feature will be regressed. Daniel> + Daniel> +config USB_MUSB_DUAL_ROLE Daniel> + bool "Dual Role mode" Daniel> + depends on (USB && USB_GADGET) Daniel> + help Daniel> + This is the default mode of working of MUSB controller where Daniel> + both host and gadget features are enabled. Daniel> + Daniel> +endchoice Daniel> + Daniel> +choice Daniel> prompt "Platform Glue Layer" Daniel> config USB_MUSB_DAVINCI Daniel> diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile Daniel> index 3b85871..6b13a53 100644 Daniel> --- a/drivers/usb/musb/Makefile Daniel> +++ b/drivers/usb/musb/Makefile Daniel> @@ -6,10 +6,16 @@ obj-$(CONFIG_USB_MUSB_HDRC) += musb_hdrc.o Daniel> musb_hdrc-y := musb_core.o Daniel> -musb_hdrc-y += musb_gadget_ep0.o musb_gadget.o Daniel> -musb_hdrc-y += musb_virthub.o musb_host.o Daniel> musb_hdrc-$(CONFIG_DEBUG_FS) += musb_debugfs.o Daniel> +ifneq ($(filter y,$(CONFIG_USB_MUSB_HOST) $(CONFIG_USB_MUSB_DUAL_ROLE)),) Daniel> + musb_hdrc-y += musb_virthub.o musb_host.o Daniel> +endif Daniel> + Daniel> +ifneq ($(filter y,$(CONFIG_USB_MUSB_GADGET) $(CONFIG_USB_MUSB_DUAL_ROLE)),) Daniel> + musb_hdrc-y += musb_gadget_ep0.o musb_gadget.o Daniel> +endif I believe unselected option values simply expand to the empty strings, so these can just be: musb_hdrc-$(CONFIG_USB_MUSB_HOST)$(CONFIG_USB_MUSB_DUAL_ROLE) += musb_virthub.o musb_host.o musb_hdrc-$(CONFIG_USB_MUSB_GADGET)$(CONFIG_USB_MUSB_DUAL_ROLE) += musb_gadget_ep0.o musb_gadget.o Other than that, it looks good: Acked-by: Peter Korsgaard <jacmet@xxxxxxxxxx> -- Bye, Peter Korsgaard -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html