From 6ee3e8e63d77bb4ed686f0c92dc7aa1a8e13fefb Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Sat, 6 Apr 2013 12:39:49 +0800 Subject: [PATCH 1/8] usb: gadget: f_obex: fix error return code in obex_bind() Fix to return a negative error code from the error handling case instead of 0, as returned elsewhere in this function. Signed-off-by: Wei Yongjun Signed-off-by: Felipe Balbi --- drivers/usb/gadget/f_obex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/f_obex.c b/drivers/usb/gadget/f_obex.c index 29a348a2a294..8aa2be5329bc 100644 --- a/drivers/usb/gadget/f_obex.c +++ b/drivers/usb/gadget/f_obex.c @@ -348,6 +348,7 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f) /* allocate instance-specific endpoints */ + status = -ENODEV; ep = usb_ep_autoconfig(cdev->gadget, &obex_fs_ep_in_desc); if (!ep) goto fail; From ad46047bd1988d61bc53ea354b77ef40f8a674a5 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Sat, 6 Apr 2013 17:23:22 +0800 Subject: [PATCH 2/8] usb: gadget: multi: fix error return code in rndis_do_config() Fix to return a negative error code from the error handling case instead of 0, as returned elsewhere in this function. Introduced by commit 59835a (usb: gadget: multi: use function framework for ACM.) Signed-off-by: Wei Yongjun Signed-off-by: Felipe Balbi --- drivers/usb/gadget/multi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c index a74ebefc7682..4a45e80c6e38 100644 --- a/drivers/usb/gadget/multi.c +++ b/drivers/usb/gadget/multi.c @@ -157,8 +157,10 @@ static __init int rndis_do_config(struct usb_configuration *c) return ret; f_acm_rndis = usb_get_function(fi_acm); - if (IS_ERR(f_acm_rndis)) + if (IS_ERR(f_acm_rndis)) { + ret = PTR_ERR(f_acm_rndis); goto err_func_acm; + } ret = usb_add_function(c, f_acm_rndis); if (ret) From 8d6f51bda67bb68b33ed4a48c57b0904a3395301 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Sat, 6 Apr 2013 17:25:21 +0800 Subject: [PATCH 3/8] usb: gadget: cdc2: fix error return code in cdc_do_config() Fix to return a negative error code from the error handling case instead of 0, as returned elsewhere in this function. Introduced by commit 29a664 (usb: gadget: cdc2: use function framework for ACM) Signed-off-by: Wei Yongjun Signed-off-by: Felipe Balbi --- drivers/usb/gadget/cdc2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/cdc2.c b/drivers/usb/gadget/cdc2.c index c6ee6f1558c3..2c5255182769 100644 --- a/drivers/usb/gadget/cdc2.c +++ b/drivers/usb/gadget/cdc2.c @@ -129,8 +129,10 @@ static int __init cdc_do_config(struct usb_configuration *c) return PTR_ERR(fi_serial); f_acm = usb_get_function(fi_serial); - if (IS_ERR(f_acm)) + if (IS_ERR(f_acm)) { + status = PTR_ERR(f_acm); goto err_func_acm; + } status = usb_add_function(c, f_acm); if (status) From 9890e33013fae0d67cd385d2038fcab4e52a6632 Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Thu, 18 Apr 2013 14:43:25 +0200 Subject: [PATCH 4/8] usb: gadget: f_sourcesink.c: correct a copy-paste misnomer acm was the first function to be converted and it seems that its code served as a base for converting f_sourcesink to the new function interface. source_sink has nothing to do with acm, though. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Kyungmin Park Signed-off-by: Felipe Balbi --- drivers/usb/gadget/f_sourcesink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/f_sourcesink.c b/drivers/usb/gadget/f_sourcesink.c index 41adf3ef96c2..a8895859a221 100644 --- a/drivers/usb/gadget/f_sourcesink.c +++ b/drivers/usb/gadget/f_sourcesink.c @@ -898,7 +898,7 @@ static struct usb_function *source_sink_alloc_func( return &ss->function; } -static void acm_free_instance(struct usb_function_instance *fi) +static void source_sink_free_instance(struct usb_function_instance *fi) { struct f_ss_opts *ss_opts; @@ -913,7 +913,7 @@ static struct usb_function_instance *source_sink_alloc_inst(void) ss_opts = kzalloc(sizeof(*ss_opts), GFP_KERNEL); if (!ss_opts) return ERR_PTR(-ENOMEM); - ss_opts->func_inst.free_func_inst = acm_free_instance; + ss_opts->func_inst.free_func_inst = source_sink_free_instance; return &ss_opts->func_inst; } DECLARE_USB_FUNCTION(SourceSink, source_sink_alloc_inst, From abe7a4097dd0141d21d02e4bd949b377a0a75120 Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Thu, 18 Apr 2013 14:43:26 +0200 Subject: [PATCH 5/8] usb: gadget: zero: put function instances on unbind If function instances are not put on gadget's unbind, their implementation module's refcount is nonzero and it is impossible to unload them. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Kyungmin Park Signed-off-by: Felipe Balbi --- drivers/usb/gadget/zero.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 685fa681cb65..2cd6262e8b71 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c @@ -368,8 +368,10 @@ static int zero_unbind(struct usb_composite_dev *cdev) del_timer_sync(&autoresume_timer); if (!IS_ERR_OR_NULL(func_ss)) usb_put_function(func_ss); + usb_put_function_instance(func_inst_ss); if (!IS_ERR_OR_NULL(func_lb)) usb_put_function(func_lb); + usb_put_function_instance(func_inst_lb); return 0; } From 19d8ceddda8b3a806a0960106ae6aa4dcc21df3b Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Thu, 18 Apr 2013 17:13:31 +0400 Subject: [PATCH 6/8] usb: phy: remove exported function from __init section The symbol usb_bind_phy is exported and annotated __init. It looks like section mismatch. Fix by removing the __init annotation of usb_bind_phy. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Denis Efremov Signed-off-by: Felipe Balbi --- drivers/usb/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index f52c006417ff..a9984c700d2c 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c @@ -413,7 +413,7 @@ EXPORT_SYMBOL_GPL(usb_remove_phy); * * To be used by platform specific initialization code. */ -int __init usb_bind_phy(const char *dev_name, u8 index, +int usb_bind_phy(const char *dev_name, u8 index, const char *phy_dev_name) { struct usb_phy_bind *phy_bind; From a52f31e95e502c53b0e5ab519c9527e9f9995288 Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Sun, 24 Mar 2013 22:06:04 +0800 Subject: [PATCH 7/8] ARM: imx_v6_v7_defconfig: add CONFIG_USB_PHY Commit edc7cb2 (usb: phy: make it a menuconfig) makes USB_MXS_PHY be a sub-item of menuconfig symbol USB_PHY. This change gets the selection of CONFIG_USB_MXS_PHY in imx_v6_v7_defconfig lost. Hence the boot stops at the point below. ci_hdrc ci_hdrc.0: doesn't support gadget ci_hdrc ci_hdrc.0: EHCI Host Controller ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1 Add CONFIG_USB_PHY to have the CONFIG_USB_MXS_PHY selection back to work. Signed-off-by: Shawn Guo Signed-off-by: Felipe Balbi --- arch/arm/configs/imx_v6_v7_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index e36b01025321..088d6c11a0fa 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig @@ -188,6 +188,7 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_MXC=y CONFIG_USB_CHIPIDEA=y CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_USB_PHY=y CONFIG_USB_MXS_PHY=y CONFIG_USB_STORAGE=y CONFIG_MMC=y From added5fce61e97087a4a25270694c542c5ed1ba9 Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Sun, 24 Mar 2013 22:06:05 +0800 Subject: [PATCH 8/8] ARM: mxs_defconfig: add CONFIG_USB_PHY Commit edc7cb2 (usb: phy: make it a menuconfig) makes USB_MXS_PHY be a sub-item of menuconfig symbol USB_PHY. This change gets the selection of CONFIG_USB_MXS_PHY in mxs_defconfig lost. Hence the boot stops at the point below. [ 1.600867] ci_hdrc ci_hdrc.0: doesn't support gadget [ 1.606282] ci_hdrc ci_hdrc.0: EHCI Host Controller [ 1.613522] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1 Add CONFIG_USB_PHY to have the CONFIG_USB_MXS_PHY selection back to work. Signed-off-by: Shawn Guo Signed-off-by: Felipe Balbi --- arch/arm/configs/mxs_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig index 6a99e30f81d2..87924d671115 100644 --- a/arch/arm/configs/mxs_defconfig +++ b/arch/arm/configs/mxs_defconfig @@ -120,6 +120,7 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_CHIPIDEA=y CONFIG_USB_CHIPIDEA_HOST=y CONFIG_USB_STORAGE=y +CONFIG_USB_PHY=y CONFIG_USB_MXS_PHY=y CONFIG_MMC=y CONFIG_MMC_MXS=y