aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/udc-core.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index 2ddb7c8b5b3d..05ba47214361 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -44,7 +44,6 @@ struct usb_udc {
44}; 44};
45 45
46static struct class *udc_class; 46static struct class *udc_class;
47static struct device_type udc_device_type;
48static LIST_HEAD(udc_list); 47static LIST_HEAD(udc_list);
49static DEFINE_MUTEX(udc_lock); 48static DEFINE_MUTEX(udc_lock);
50 49
@@ -144,6 +143,7 @@ static void usb_udc_release(struct device *dev)
144 kfree(udc); 143 kfree(udc);
145} 144}
146 145
146static const struct attribute_group *usb_udc_attr_groups[];
147/** 147/**
148 * usb_add_gadget_udc - adds a new gadget to the udc class driver list 148 * usb_add_gadget_udc - adds a new gadget to the udc class driver list
149 * @parent: the parent device to this udc. Usually the controller 149 * @parent: the parent device to this udc. Usually the controller
@@ -164,6 +164,7 @@ int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget)
164 device_initialize(&udc->dev); 164 device_initialize(&udc->dev);
165 udc->dev.release = usb_udc_release; 165 udc->dev.release = usb_udc_release;
166 udc->dev.class = udc_class; 166 udc->dev.class = udc_class;
167 udc->dev.groups = usb_udc_attr_groups;
167 udc->dev.parent = parent; 168 udc->dev.parent = parent;
168 ret = dev_set_name(&udc->dev, "%s", kobject_name(&parent->kobj)); 169 ret = dev_set_name(&udc->dev, "%s", kobject_name(&parent->kobj));
169 if (ret) 170 if (ret)
@@ -373,7 +374,7 @@ static DEVICE_ATTR(soft_connect, S_IWUSR, NULL, usb_udc_softconn_store);
373static ssize_t usb_udc_speed_show(struct device *dev, 374static ssize_t usb_udc_speed_show(struct device *dev,
374 struct device_attribute *attr, char *buf) 375 struct device_attribute *attr, char *buf)
375{ 376{
376 struct usb_udc *udc = dev_get_drvdata(dev); 377 struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
377 struct usb_gadget *gadget = udc->gadget; 378 struct usb_gadget *gadget = udc->gadget;
378 379
379 switch (gadget->speed) { 380 switch (gadget->speed) {
@@ -398,7 +399,7 @@ static DEVICE_ATTR(speed, S_IRUSR, usb_udc_speed_show, NULL);
398ssize_t usb_udc_##name##_show(struct device *dev, \ 399ssize_t usb_udc_##name##_show(struct device *dev, \
399 struct device_attribute *attr, char *buf) \ 400 struct device_attribute *attr, char *buf) \
400{ \ 401{ \
401 struct usb_udc *udc = dev_get_drvdata(dev); \ 402 struct usb_udc *udc = container_of(dev, struct usb_udc, dev); \
402 struct usb_gadget *gadget = udc->gadget; \ 403 struct usb_gadget *gadget = udc->gadget; \
403 \ 404 \
404 return snprintf(buf, PAGE_SIZE, "%d\n", gadget->name); \ 405 return snprintf(buf, PAGE_SIZE, "%d\n", gadget->name); \
@@ -468,8 +469,6 @@ static int __init usb_udc_init(void)
468 } 469 }
469 470
470 udc_class->dev_uevent = usb_udc_uevent; 471 udc_class->dev_uevent = usb_udc_uevent;
471 udc_device_type.groups = usb_udc_attr_groups;
472
473 return 0; 472 return 0;
474} 473}
475subsys_initcall(usb_udc_init); 474subsys_initcall(usb_udc_init);