Signed-off-by: Andrzej Pietrasiewicz <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
---
drivers/usb/gadget/Kconfig | 1 +
drivers/usb/gadget/ether.c | 41 ++++++++++++++++++++++++++++++++++++-----
2 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 8e950e2..8e81699 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -672,6 +672,7 @@ config USB_ETH
select USB_U_RNDIS
select USB_F_EEM
select USB_F_ECM
+ select USB_F_SUBSET
select CRC32
help
This driver implements Ethernet style communication, in one of
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index f02c91b..754b300 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -25,7 +25,7 @@
#include "u_ether.h"
#include "u_eem.h"
#include "u_ecm.h"
-
+#include "u_gether.h"
/*
* Ethernet gadget driver -- with CDC and non-CDC options
@@ -104,8 +104,6 @@ static inline bool has_rndis(void)
* the runtime footprint, and giving us at least some parts of what
* a "gcc --combine ... part1.c part2.c part3.c ... " build would.
*/
-#define USB_FSUBSET_INCLUDED
-#include "f_subset.c"
#ifdef USB_ETH_RNDIS
#include "f_rndis.c"
#include "rndis.h"
@@ -217,6 +215,9 @@ static struct usb_function *f_eem;
static struct usb_function_instance *f_ecm_inst;
static struct usb_function *f_ecm;
+static struct usb_function_instance *f_gether_inst;
+static struct usb_function *f_gether;
+
/*-------------------------------------------------------------------------*/
/*
@@ -320,8 +321,34 @@ static int __init eth_do_config(struct usb_configuration
*c)
}
return 0;
- } else
- return geth_bind_config(c, hostaddr, the_dev);
+ } else {
+ struct f_gether_opts *gether_opts;
+
+ f_gether_inst = usb_get_function_instance("geth");
+ if (IS_ERR(f_gether_inst))
+ return PTR_ERR(f_gether_inst);
+
+ gether_opts = container_of(f_gether_inst, struct f_gether_opts,
+ func_inst);
+ gether_opts->ethaddr = hostaddr;
+ gether_opts->dev = the_dev;
+
+ f_gether = usb_get_function(f_gether_inst);
+ if (IS_ERR(f_gether)) {
+ status = PTR_ERR(f_gether);
+ usb_put_function_instance(f_gether_inst);
+ return status;
+ }
+
+ status = usb_add_function(c, f_gether);
+ if (status < 0) {
+ usb_put_function(f_gether);
+ usb_put_function_instance(f_gether_inst);
+ return status;
+ }
+
+ return 0;
+ }
}
static struct usb_configuration eth_config_driver = {
@@ -413,6 +440,10 @@ static int __exit eth_unbind(struct usb_composite_dev
*cdev)
usb_put_function(f_ecm);
if (!IS_ERR_OR_NULL(f_ecm_inst))
usb_put_function_instance(f_ecm_inst);
+ if (!IS_ERR_OR_NULL(f_gether))
+ usb_put_function(f_gether);
+ if (!IS_ERR_OR_NULL(f_gether_inst))
+ usb_put_function_instance(f_gether_inst);
return 0;
}
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html