Michal Nazarewicz | 5ab54cf | 2010-11-12 14:29:28 +0100 | [diff] [blame] | 1 | /* |
| 2 | * g_ffs.c -- user mode file system API for USB composite function controllers |
| 3 | * |
| 4 | * Copyright (C) 2010 Samsung Electronics |
Michal Nazarewicz | 54b8360 | 2012-01-13 15:05:16 +0100 | [diff] [blame] | 5 | * Author: Michal Nazarewicz <mina86@mina86.com> |
Michal Nazarewicz | 5ab54cf | 2010-11-12 14:29:28 +0100 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
Michal Nazarewicz | 5ab54cf | 2010-11-12 14:29:28 +0100 | [diff] [blame] | 11 | */ |
| 12 | |
Michal Nazarewicz | aa02f17 | 2010-11-17 17:09:47 +0100 | [diff] [blame] | 13 | #define pr_fmt(fmt) "g_ffs: " fmt |
| 14 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 15 | #include <linux/module.h> |
| 16 | #include <linux/utsname.h> |
| 17 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 18 | /* |
| 19 | * kbuild is not very cooperative with respect to linking separately |
| 20 | * compiled library objects into one module. So for now we won't use |
| 21 | * separate compilation ... ensuring init/exit sections work to shrink |
| 22 | * the runtime footprint, and giving us at least some parts of what |
| 23 | * a "gcc --combine ... part1.c part2.c part3.c ... " build would. |
| 24 | */ |
| 25 | |
| 26 | #include "composite.c" |
| 27 | #include "usbstring.c" |
| 28 | #include "config.c" |
| 29 | #include "epautoconf.c" |
| 30 | |
| 31 | #if defined CONFIG_USB_FUNCTIONFS_ETH || defined CONFIG_USB_FUNCTIONFS_RNDIS |
| 32 | # if defined USB_ETH_RNDIS |
| 33 | # undef USB_ETH_RNDIS |
| 34 | # endif |
| 35 | # ifdef CONFIG_USB_FUNCTIONFS_RNDIS |
| 36 | # define USB_ETH_RNDIS y |
| 37 | # endif |
| 38 | |
| 39 | # include "f_ecm.c" |
| 40 | # include "f_subset.c" |
| 41 | # ifdef USB_ETH_RNDIS |
| 42 | # include "f_rndis.c" |
| 43 | # include "rndis.c" |
| 44 | # endif |
| 45 | # include "u_ether.c" |
| 46 | |
| 47 | static u8 gfs_hostaddr[ETH_ALEN]; |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 48 | # ifdef CONFIG_USB_FUNCTIONFS_ETH |
| 49 | static int eth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]); |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 50 | # endif |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 51 | #else |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 52 | # define gether_cleanup() do { } while (0) |
| 53 | # define gether_setup(gadget, hostaddr) ((int)0) |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 54 | # define gfs_hostaddr NULL |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 55 | #endif |
| 56 | |
| 57 | #include "f_fs.c" |
| 58 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 59 | #define DRIVER_NAME "g_ffs" |
| 60 | #define DRIVER_DESC "USB Function Filesystem" |
| 61 | #define DRIVER_VERSION "24 Aug 2004" |
| 62 | |
| 63 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 64 | MODULE_AUTHOR("Michal Nazarewicz"); |
| 65 | MODULE_LICENSE("GPL"); |
| 66 | |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 67 | #define GFS_VENDOR_ID 0x1d6b /* Linux Foundation */ |
| 68 | #define GFS_PRODUCT_ID 0x0105 /* FunctionFS Gadget */ |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 69 | |
| 70 | static struct usb_device_descriptor gfs_dev_desc = { |
| 71 | .bLength = sizeof gfs_dev_desc, |
| 72 | .bDescriptorType = USB_DT_DEVICE, |
| 73 | |
| 74 | .bcdUSB = cpu_to_le16(0x0200), |
| 75 | .bDeviceClass = USB_CLASS_PER_INTERFACE, |
| 76 | |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 77 | .idVendor = cpu_to_le16(GFS_VENDOR_ID), |
| 78 | .idProduct = cpu_to_le16(GFS_PRODUCT_ID), |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 79 | }; |
| 80 | |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 81 | module_param_named(bDeviceClass, gfs_dev_desc.bDeviceClass, byte, 0644); |
| 82 | MODULE_PARM_DESC(bDeviceClass, "USB Device class"); |
| 83 | module_param_named(bDeviceSubClass, gfs_dev_desc.bDeviceSubClass, byte, 0644); |
| 84 | MODULE_PARM_DESC(bDeviceSubClass, "USB Device subclass"); |
| 85 | module_param_named(bDeviceProtocol, gfs_dev_desc.bDeviceProtocol, byte, 0644); |
| 86 | MODULE_PARM_DESC(bDeviceProtocol, "USB Device protocol"); |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 87 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 88 | static const struct usb_descriptor_header *gfs_otg_desc[] = { |
| 89 | (const struct usb_descriptor_header *) |
| 90 | &(const struct usb_otg_descriptor) { |
| 91 | .bLength = sizeof(struct usb_otg_descriptor), |
| 92 | .bDescriptorType = USB_DT_OTG, |
| 93 | |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 94 | /* |
| 95 | * REVISIT SRP-only hardware is possible, although |
| 96 | * it would not be called "OTG" ... |
| 97 | */ |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 98 | .bmAttributes = USB_OTG_SRP | USB_OTG_HNP, |
| 99 | }, |
| 100 | |
| 101 | NULL |
| 102 | }; |
| 103 | |
Michal Nazarewicz | 5ab54cf | 2010-11-12 14:29:28 +0100 | [diff] [blame] | 104 | /* String IDs are assigned dynamically */ |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 105 | static struct usb_string gfs_strings[] = { |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 106 | #ifdef CONFIG_USB_FUNCTIONFS_RNDIS |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 107 | { .s = "FunctionFS + RNDIS" }, |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 108 | #endif |
| 109 | #ifdef CONFIG_USB_FUNCTIONFS_ETH |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 110 | { .s = "FunctionFS + ECM" }, |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 111 | #endif |
| 112 | #ifdef CONFIG_USB_FUNCTIONFS_GENERIC |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 113 | { .s = "FunctionFS" }, |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 114 | #endif |
| 115 | { } /* end of list */ |
| 116 | }; |
| 117 | |
| 118 | static struct usb_gadget_strings *gfs_dev_strings[] = { |
| 119 | &(struct usb_gadget_strings) { |
| 120 | .language = 0x0409, /* en-us */ |
| 121 | .strings = gfs_strings, |
| 122 | }, |
| 123 | NULL, |
| 124 | }; |
| 125 | |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 126 | struct gfs_configuration { |
| 127 | struct usb_configuration c; |
| 128 | int (*eth)(struct usb_configuration *c, u8 *ethaddr); |
| 129 | } gfs_configurations[] = { |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 130 | #ifdef CONFIG_USB_FUNCTIONFS_RNDIS |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 131 | { |
| 132 | .eth = rndis_bind_config, |
| 133 | }, |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 134 | #endif |
| 135 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 136 | #ifdef CONFIG_USB_FUNCTIONFS_ETH |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 137 | { |
| 138 | .eth = eth_bind_config, |
| 139 | }, |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 140 | #endif |
| 141 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 142 | #ifdef CONFIG_USB_FUNCTIONFS_GENERIC |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 143 | { |
| 144 | }, |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 145 | #endif |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 146 | }; |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 147 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 148 | static int gfs_bind(struct usb_composite_dev *cdev); |
| 149 | static int gfs_unbind(struct usb_composite_dev *cdev); |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 150 | static int gfs_do_config(struct usb_configuration *c); |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 151 | |
| 152 | static struct usb_composite_driver gfs_driver = { |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 153 | .name = DRIVER_NAME, |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 154 | .dev = &gfs_dev_desc, |
| 155 | .strings = gfs_dev_strings, |
Tatyana Brokhman | 35a0e0b | 2011-06-29 16:41:49 +0300 | [diff] [blame] | 156 | .max_speed = USB_SPEED_HIGH, |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 157 | .unbind = gfs_unbind, |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 158 | .iProduct = DRIVER_DESC, |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 159 | }; |
| 160 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 161 | static struct ffs_data *gfs_ffs_data; |
| 162 | static unsigned long gfs_registered; |
| 163 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 164 | static int gfs_init(void) |
| 165 | { |
| 166 | ENTER(); |
| 167 | |
| 168 | return functionfs_init(); |
| 169 | } |
| 170 | module_init(gfs_init); |
| 171 | |
| 172 | static void gfs_exit(void) |
| 173 | { |
| 174 | ENTER(); |
| 175 | |
| 176 | if (test_and_clear_bit(0, &gfs_registered)) |
| 177 | usb_composite_unregister(&gfs_driver); |
| 178 | |
| 179 | functionfs_cleanup(); |
| 180 | } |
| 181 | module_exit(gfs_exit); |
| 182 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 183 | static int functionfs_ready_callback(struct ffs_data *ffs) |
| 184 | { |
| 185 | int ret; |
| 186 | |
| 187 | ENTER(); |
| 188 | |
| 189 | if (WARN_ON(test_and_set_bit(0, &gfs_registered))) |
| 190 | return -EBUSY; |
| 191 | |
| 192 | gfs_ffs_data = ffs; |
Michal Nazarewicz | 07a18bd | 2010-08-12 17:43:54 +0200 | [diff] [blame] | 193 | ret = usb_composite_probe(&gfs_driver, gfs_bind); |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 194 | if (unlikely(ret < 0)) |
| 195 | clear_bit(0, &gfs_registered); |
| 196 | return ret; |
| 197 | } |
| 198 | |
| 199 | static void functionfs_closed_callback(struct ffs_data *ffs) |
| 200 | { |
| 201 | ENTER(); |
| 202 | |
| 203 | if (test_and_clear_bit(0, &gfs_registered)) |
| 204 | usb_composite_unregister(&gfs_driver); |
| 205 | } |
| 206 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 207 | static int functionfs_check_dev_callback(const char *dev_name) |
| 208 | { |
| 209 | return 0; |
| 210 | } |
| 211 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 212 | static int gfs_bind(struct usb_composite_dev *cdev) |
| 213 | { |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 214 | int ret, i; |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 215 | |
| 216 | ENTER(); |
| 217 | |
| 218 | if (WARN_ON(!gfs_ffs_data)) |
| 219 | return -ENODEV; |
| 220 | |
| 221 | ret = gether_setup(cdev->gadget, gfs_hostaddr); |
| 222 | if (unlikely(ret < 0)) |
| 223 | goto error_quick; |
| 224 | |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 225 | ret = usb_string_ids_tab(cdev, gfs_strings); |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 226 | if (unlikely(ret < 0)) |
| 227 | goto error; |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 228 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 229 | ret = functionfs_bind(gfs_ffs_data, cdev); |
| 230 | if (unlikely(ret < 0)) |
| 231 | goto error; |
| 232 | |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 233 | for (i = 0; i < ARRAY_SIZE(gfs_configurations); ++i) { |
| 234 | struct gfs_configuration *c = gfs_configurations + i; |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 235 | |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 236 | c->c.label = gfs_strings[i].s; |
| 237 | c->c.iConfiguration = gfs_strings[i].id; |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 238 | c->c.bConfigurationValue = 1 + i; |
| 239 | c->c.bmAttributes = USB_CONFIG_ATT_SELFPOWER; |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 240 | |
Uwe Kleine-König | c9bfff9 | 2010-08-12 17:43:55 +0200 | [diff] [blame] | 241 | ret = usb_add_config(cdev, &c->c, gfs_do_config); |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 242 | if (unlikely(ret < 0)) |
| 243 | goto error_unbind; |
| 244 | } |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 245 | |
| 246 | return 0; |
| 247 | |
| 248 | error_unbind: |
| 249 | functionfs_unbind(gfs_ffs_data); |
| 250 | error: |
| 251 | gether_cleanup(); |
| 252 | error_quick: |
| 253 | gfs_ffs_data = NULL; |
| 254 | return ret; |
| 255 | } |
| 256 | |
| 257 | static int gfs_unbind(struct usb_composite_dev *cdev) |
| 258 | { |
| 259 | ENTER(); |
| 260 | |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 261 | /* |
| 262 | * We may have been called in an error recovery from |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 263 | * composite_bind() after gfs_unbind() failure so we need to |
| 264 | * check if gfs_ffs_data is not NULL since gfs_bind() handles |
| 265 | * all error recovery itself. I'd rather we werent called |
| 266 | * from composite on orror recovery, but what you're gonna |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 267 | * do...? |
| 268 | */ |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 269 | if (gfs_ffs_data) { |
| 270 | gether_cleanup(); |
| 271 | functionfs_unbind(gfs_ffs_data); |
| 272 | gfs_ffs_data = NULL; |
| 273 | } |
| 274 | |
| 275 | return 0; |
| 276 | } |
| 277 | |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 278 | static int gfs_do_config(struct usb_configuration *c) |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 279 | { |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 280 | struct gfs_configuration *gc = |
| 281 | container_of(c, struct gfs_configuration, c); |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 282 | int ret; |
| 283 | |
| 284 | if (WARN_ON(!gfs_ffs_data)) |
| 285 | return -ENODEV; |
| 286 | |
| 287 | if (gadget_is_otg(c->cdev->gadget)) { |
| 288 | c->descriptors = gfs_otg_desc; |
| 289 | c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; |
| 290 | } |
| 291 | |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 292 | if (gc->eth) { |
| 293 | ret = gc->eth(c, gfs_hostaddr); |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 294 | if (unlikely(ret < 0)) |
| 295 | return ret; |
| 296 | } |
| 297 | |
Michal Nazarewicz | 7898aee | 2010-06-16 12:07:58 +0200 | [diff] [blame] | 298 | ret = functionfs_bind_config(c->cdev, c, gfs_ffs_data); |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 299 | if (unlikely(ret < 0)) |
| 300 | return ret; |
| 301 | |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 302 | /* |
| 303 | * After previous do_configs there may be some invalid |
Michal Nazarewicz | f588c0d | 2010-06-14 10:43:34 +0200 | [diff] [blame] | 304 | * pointers in c->interface array. This happens every time |
| 305 | * a user space function with fewer interfaces than a user |
| 306 | * space function that was run before the new one is run. The |
| 307 | * compasit's set_config() assumes that if there is no more |
| 308 | * then MAX_CONFIG_INTERFACES interfaces in a configuration |
| 309 | * then there is a NULL pointer after the last interface in |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 310 | * c->interface array. We need to make sure this is true. |
| 311 | */ |
Michal Nazarewicz | f588c0d | 2010-06-14 10:43:34 +0200 | [diff] [blame] | 312 | if (c->next_interface_id < ARRAY_SIZE(c->interface)) |
| 313 | c->interface[c->next_interface_id] = NULL; |
| 314 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 315 | return 0; |
| 316 | } |
| 317 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 318 | #ifdef CONFIG_USB_FUNCTIONFS_ETH |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 319 | |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 320 | static int eth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]) |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 321 | { |
Michal Nazarewicz | f8dae53 | 2010-06-25 16:29:27 +0200 | [diff] [blame] | 322 | return can_support_ecm(c->cdev->gadget) |
| 323 | ? ecm_bind_config(c, ethaddr) |
| 324 | : geth_bind_config(c, ethaddr); |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 325 | } |
Michal Nazarewicz | fc19de6 | 2010-08-12 17:43:48 +0200 | [diff] [blame] | 326 | |
Michal Nazarewicz | c6c5600 | 2010-05-05 12:53:15 +0200 | [diff] [blame] | 327 | #endif |