Re: [PATCH] usb: chipidea: fix linking of udc if gadget is build as module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 07/16/2012 04:20 PM, Felipe Balbi wrote:
>>>>> This is not the real problem. The problem is that USB_CHIPIDEA depends
>>>>> on USB (which is the Host side USB). So if you make host built-in, you
>>>>> can make chipidea built-in regardless of the gadget setting. That's the
>>>>> bug you want to solve.
>>>>
>>>> I don't think so. Have a look at the above mentioned undefined symbols:
>>>> "usb_gadget_unmap_request", they are implemented in:
>>>>
>>>> $git grep usb_gadget_unmap_request | grep EXPORT
>>>> drivers/usb/gadget/udc-core.c:EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);
>>>
>>> of course... that's because chipidea can be built-in while gadget isn't.
>>> The bug is exactly allowing chipidea to be built-in with no regards to
>>> the gadget side.
>>>
>>>> CONFIG_USB_CHIPIDEA=y
>>>> CONFIG_USB_GADGET=m
>>>
>>> there you go. Chipidea is built-in and gadget isn't.
>>
>> That's exactly what my patch fixes.
> 
> yeah, but you fix it the wrong way. CONFIG_USB_CHIPIDEA should not

Okay. Point taken. My patch only fixes the regression which was
introduced in "5e0aa49 usb: chipidea: use generic map/unmap routines".
Just a minimal patch to go into the current release cycle.

> depend on USB to start with. If you disable USB Host side, you can't
> compile chipidea driver. The patch below fixes most of the failures. Now
> the only problem is when we have both host and gadget enabled, if one of
> them is built-in, chipidea can be built-in regardless of the other. But
> that's something from the kbuild language I guess.

Hmmm...Same problem as before, but now also for the host side. I've
wrapped my head around the problem and I think a found something...I'm
not sure how "nice" the solution is.

> diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
> index fd36dc8..e43bf69 100644
> --- a/drivers/usb/chipidea/Kconfig
> +++ b/drivers/usb/chipidea/Kconfig
> @@ -1,6 +1,7 @@
>  config USB_CHIPIDEA
>  	tristate "ChipIdea Highspeed Dual Role Controller"
> -	depends on USB
> +	depends on USB_SUPPORT
                   ^^^^^^^^^^^
not needed as it is included from drivers/usb/Kconfig inside the big
ifdef USB_SUPPORT...endif. (At least on 3.5-rc7)

> +	depends on USB || USB_GADGET
>  	help
>            Say Y here if your system has a dual role high speed USB
>            controller based on ChipIdea silicon IP. Currently, only the
> @@ -10,20 +11,6 @@ config USB_CHIPIDEA
>  
>  if USB_CHIPIDEA
>  
> -config USB_CHIPIDEA_UDC
> -	bool "ChipIdea device controller"
> -	depends on USB_GADGET
> -	select USB_GADGET_DUALSPEED

What about the select?

Marc
> -	help
> -	  Say Y here to enable device controller functionality of the
> -	  ChipIdea driver.
> -
> -config USB_CHIPIDEA_HOST
> -	bool "ChipIdea host controller"
> -	help
> -	  Say Y here to enable host controller functionality of the
> -	  ChipIdea driver.
> -
>  config USB_CHIPIDEA_DEBUG
>  	bool "ChipIdea driver debug"
>  	help
> diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
> index cc34937..545d8d2 100644
> --- a/drivers/usb/chipidea/Makefile
> +++ b/drivers/usb/chipidea/Makefile
> @@ -1,8 +1,15 @@
>  obj-$(CONFIG_USB_CHIPIDEA)		+= ci_hdrc.o
>  
>  ci_hdrc-y				:= core.o
> -ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC)	+= udc.o
> -ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST)	+= host.o
> +
> +ifneq ($(CONFIG_USB_GADGET),)
> +	ci_hdrc-y			+= udc.o
> +endif
> +
> +ifneq ($(CONFIG_USB),)
> +	ci_hdrc-y			+= host.o
> +endif
> +
>  ci_hdrc-$(CONFIG_USB_CHIPIDEA_DEBUG)	+= debug.o
>  
>  ifneq ($(CONFIG_PCI),)
> diff --git a/drivers/usb/chipidea/host.h b/drivers/usb/chipidea/host.h
> index 761fb1f..d52046e 100644
> --- a/drivers/usb/chipidea/host.h
> +++ b/drivers/usb/chipidea/host.h
> @@ -1,7 +1,7 @@
>  #ifndef __DRIVERS_USB_CHIPIDEA_HOST_H
>  #define __DRIVERS_USB_CHIPIDEA_HOST_H
>  
> -#ifdef CONFIG_USB_CHIPIDEA_HOST
> +#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
>  
>  int ci_hdrc_host_init(struct ci13xxx *ci);
>  
> diff --git a/drivers/usb/chipidea/udc.h b/drivers/usb/chipidea/udc.h
> index 4ff2384d..8f7ec75 100644
> --- a/drivers/usb/chipidea/udc.h
> +++ b/drivers/usb/chipidea/udc.h
> @@ -77,7 +77,7 @@ struct ci13xxx_req {
>  	dma_addr_t		zdma;
>  };
>  
> -#ifdef CONFIG_USB_CHIPIDEA_UDC
> +#if defined(CONFIG_USB_GADGET) || defined(CONFIG_USB_GADGET_MODULE)
>  
>  int ci_hdrc_gadget_init(struct ci13xxx *ci);
>  
> 


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux