cdc2.c (b10778a00d40b3d9fdaaf5891e802794781ff71c) | cdc2.c (c94e289f195e0e13cf34d27f9338d28221a85751) |
---|---|
1/* 2 * cdc2.c -- CDC Composite driver, with ECM and ACM support 3 * 4 * Copyright (C) 2008 David Brownell 5 * Copyright (C) 2008 Nokia Corporation 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 --- 90 unchanged lines hidden (view full) --- 99static struct usb_function_instance *fi_serial; 100 101static struct usb_function *f_ecm; 102static struct usb_function_instance *fi_ecm; 103 104/* 105 * We _always_ have both CDC ECM and CDC ACM functions. 106 */ | 1/* 2 * cdc2.c -- CDC Composite driver, with ECM and ACM support 3 * 4 * Copyright (C) 2008 David Brownell 5 * Copyright (C) 2008 Nokia Corporation 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 --- 90 unchanged lines hidden (view full) --- 99static struct usb_function_instance *fi_serial; 100 101static struct usb_function *f_ecm; 102static struct usb_function_instance *fi_ecm; 103 104/* 105 * We _always_ have both CDC ECM and CDC ACM functions. 106 */ |
107static int __init cdc_do_config(struct usb_configuration *c) | 107static int cdc_do_config(struct usb_configuration *c) |
108{ 109 int status; 110 111 if (gadget_is_otg(c->cdev->gadget)) { 112 c->descriptors = otg_desc; 113 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; 114 } 115 --- 32 unchanged lines hidden (view full) --- 148 .label = "CDC Composite (ECM + ACM)", 149 .bConfigurationValue = 1, 150 /* .iConfiguration = DYNAMIC */ 151 .bmAttributes = USB_CONFIG_ATT_SELFPOWER, 152}; 153 154/*-------------------------------------------------------------------------*/ 155 | 108{ 109 int status; 110 111 if (gadget_is_otg(c->cdev->gadget)) { 112 c->descriptors = otg_desc; 113 c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; 114 } 115 --- 32 unchanged lines hidden (view full) --- 148 .label = "CDC Composite (ECM + ACM)", 149 .bConfigurationValue = 1, 150 /* .iConfiguration = DYNAMIC */ 151 .bmAttributes = USB_CONFIG_ATT_SELFPOWER, 152}; 153 154/*-------------------------------------------------------------------------*/ 155 |
156static int __init cdc_bind(struct usb_composite_dev *cdev) | 156static int cdc_bind(struct usb_composite_dev *cdev) |
157{ 158 struct usb_gadget *gadget = cdev->gadget; 159 struct f_ecm_opts *ecm_opts; 160 int status; 161 162 if (!can_support_ecm(cdev->gadget)) { 163 dev_err(&gadget->dev, "controller '%s' not usable\n", 164 gadget->name); --- 41 unchanged lines hidden (view full) --- 206 207fail1: 208 usb_put_function_instance(fi_serial); 209fail: 210 usb_put_function_instance(fi_ecm); 211 return status; 212} 213 | 157{ 158 struct usb_gadget *gadget = cdev->gadget; 159 struct f_ecm_opts *ecm_opts; 160 int status; 161 162 if (!can_support_ecm(cdev->gadget)) { 163 dev_err(&gadget->dev, "controller '%s' not usable\n", 164 gadget->name); --- 41 unchanged lines hidden (view full) --- 206 207fail1: 208 usb_put_function_instance(fi_serial); 209fail: 210 usb_put_function_instance(fi_ecm); 211 return status; 212} 213 |
214static int __exit cdc_unbind(struct usb_composite_dev *cdev) | 214static int cdc_unbind(struct usb_composite_dev *cdev) |
215{ 216 usb_put_function(f_acm); 217 usb_put_function_instance(fi_serial); 218 if (!IS_ERR_OR_NULL(f_ecm)) 219 usb_put_function(f_ecm); 220 if (!IS_ERR_OR_NULL(fi_ecm)) 221 usb_put_function_instance(fi_ecm); 222 return 0; 223} 224 | 215{ 216 usb_put_function(f_acm); 217 usb_put_function_instance(fi_serial); 218 if (!IS_ERR_OR_NULL(f_ecm)) 219 usb_put_function(f_ecm); 220 if (!IS_ERR_OR_NULL(fi_ecm)) 221 usb_put_function_instance(fi_ecm); 222 return 0; 223} 224 |
225static __refdata struct usb_composite_driver cdc_driver = { | 225static struct usb_composite_driver cdc_driver = { |
226 .name = "g_cdc", 227 .dev = &device_desc, 228 .strings = dev_strings, 229 .max_speed = USB_SPEED_HIGH, 230 .bind = cdc_bind, | 226 .name = "g_cdc", 227 .dev = &device_desc, 228 .strings = dev_strings, 229 .max_speed = USB_SPEED_HIGH, 230 .bind = cdc_bind, |
231 .unbind = __exit_p(cdc_unbind), | 231 .unbind = cdc_unbind, |
232}; 233 234module_usb_composite_driver(cdc_driver); 235 236MODULE_DESCRIPTION(DRIVER_DESC); 237MODULE_AUTHOR("David Brownell"); 238MODULE_LICENSE("GPL"); | 232}; 233 234module_usb_composite_driver(cdc_driver); 235 236MODULE_DESCRIPTION(DRIVER_DESC); 237MODULE_AUTHOR("David Brownell"); 238MODULE_LICENSE("GPL"); |