From c3993c41595548123caa2e8dc9efcb0b67b18afa Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Tue, 14 Jan 2014 14:26:26 +0100 Subject: [PATCH] Revert "usb/gadget: multi: convert to new interface of f_ecm" This reverts commit 0f51ef4507d61692afe5de4598b8f5df82f1ada1. --- drivers/usb/gadget/Kconfig | 1 - drivers/usb/gadget/multi.c | 68 ++++++---------------------------------------- 2 files changed, 8 insertions(+), 61 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 33ba3ec..e327cc3 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -1094,7 +1094,6 @@ config USB_G_MULTI_CDC bool "CDC Ethernet + CDC Serial + Storage configuration" depends on USB_G_MULTI default n - select USB_F_ECM help This option enables a configuration with CDC Ethernet (ECM), CDC Serial and Mass Storage functions available in the Multifunction diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c index 0d1d132..c232f76 100644 --- a/drivers/usb/gadget/multi.c +++ b/drivers/usb/gadget/multi.c @@ -15,7 +15,6 @@ #include #include -#include #include "u_serial.h" #if defined USB_ETH_RNDIS @@ -45,7 +44,8 @@ MODULE_LICENSE("GPL"); #define USB_FMS_INCLUDED #include "f_mass_storage.c" -#include "u_ecm.h" +#define USBF_ECM_INCLUDED +#include "f_ecm.c" #ifdef USB_ETH_RNDIS # define USB_FRNDIS_INCLUDED # include "f_rndis.c" @@ -151,14 +151,14 @@ FSG_MODULE_PARAMETERS(/* no prefix */, fsg_mod_data); static struct fsg_common fsg_common; +static u8 host_mac[ETH_ALEN]; + static struct usb_function_instance *fi_acm; static struct eth_dev *the_dev; /********** RNDIS **********/ #ifdef USB_ETH_RNDIS -static u8 host_mac[ETH_ALEN]; - static struct usb_function *f_acm_rndis; static __init int rndis_do_config(struct usb_configuration *c) @@ -220,9 +220,7 @@ static int rndis_config_register(struct usb_composite_dev *cdev) /********** CDC ECM **********/ #ifdef CONFIG_USB_G_MULTI_CDC -static struct usb_function_instance *fi_ecm; static struct usb_function *f_acm_multi; -static struct usb_function *f_ecm; static __init int cdc_do_config(struct usb_configuration *c) { @@ -233,20 +231,14 @@ static __init int cdc_do_config(struct usb_configuration *c) c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; } - f_ecm = usb_get_function(fi_ecm); - if (IS_ERR(f_ecm)) - return PTR_ERR(f_ecm); - - ret = usb_add_function(c, f_ecm); + ret = ecm_bind_config(c, host_mac, the_dev); if (ret < 0) - goto err_func_ecm; + return ret; /* implicit port_num is zero */ f_acm_multi = usb_get_function(fi_acm); - if (IS_ERR(f_acm_multi)) { - ret = PTR_ERR(f_acm_multi); - goto err_func_acm; - } + if (IS_ERR(f_acm_multi)) + return PTR_ERR(f_acm_multi); ret = usb_add_function(c, f_acm_multi); if (ret) @@ -261,10 +253,6 @@ err_fsg: usb_remove_function(c, f_acm_multi); err_conf: usb_put_function(f_acm_multi); -err_func_acm: - usb_remove_function(c, f_ecm); -err_func_ecm: - usb_put_function(f_ecm); return ret; } @@ -297,9 +285,6 @@ static int cdc_config_register(struct usb_composite_dev *cdev) static int __ref multi_bind(struct usb_composite_dev *cdev) { struct usb_gadget *gadget = cdev->gadget; -#ifdef CONFIG_USB_G_MULTI_CDC - struct f_ecm_opts *ecm_opts; -#endif int status; if (!can_support_ecm(cdev->gadget)) { @@ -308,39 +293,11 @@ static int __ref multi_bind(struct usb_composite_dev *cdev) return -EINVAL; } -#ifdef CONFIG_USB_G_MULTI_CDC - fi_ecm = usb_get_function_instance("ecm"); - if (IS_ERR(fi_ecm)) - return PTR_ERR(fi_ecm); - - ecm_opts = container_of(fi_ecm, struct f_ecm_opts, func_inst); - - gether_set_qmult(ecm_opts->net, qmult); - if (!gether_set_host_addr(ecm_opts->net, host_addr)) - pr_info("using host ethernet address: %s", host_addr); - if (!gether_set_dev_addr(ecm_opts->net, dev_addr)) - pr_info("using self ethernet address: %s", dev_addr); - - the_dev = netdev_priv(ecm_opts->net); - -#elif defined USB_ETH_RNDIS - /* set up network link layer */ the_dev = gether_setup(cdev->gadget, dev_addr, host_addr, host_mac, qmult); if (IS_ERR(the_dev)) return PTR_ERR(the_dev); -#endif - -#if (defined CONFIG_USB_G_MULTI_CDC && defined USB_ETH_RNDIS) - gether_set_gadget(ecm_opts->net, cdev->gadget); - status = gether_register_netdev(ecm_opts->net); - if (status) - goto fail0; - ecm_opts->bound = true; - - gether_get_host_addr_u8(ecm_opts->net, host_mac); -#endif /* set up serial link layer */ fi_acm = usb_get_function_instance("acm"); @@ -388,11 +345,7 @@ fail2: fail1: usb_put_function_instance(fi_acm); fail0: -#ifdef CONFIG_USB_G_MULTI_CDC - usb_put_function_instance(fi_ecm); -#else gether_cleanup(the_dev); -#endif return status; } @@ -405,12 +358,7 @@ static int __exit multi_unbind(struct usb_composite_dev *cdev) usb_put_function(f_acm_rndis); #endif usb_put_function_instance(fi_acm); -#ifdef CONFIG_USB_G_MULTI_CDC - usb_put_function(f_ecm); - usb_put_function_instance(fi_ecm); -#else gether_cleanup(the_dev); -#endif return 0; } -- 2.7.4