if (!udc)
goto err1;
+ if (gadget->register_my_device) {
+ dev_set_name(&gadget->dev, "gadget");
+
+ ret = device_register(&gadget->dev);
+ if (ret)
+ goto err2;
+ }
+
device_initialize(&udc->dev);
udc->dev.release = usb_udc_release;
udc->dev.class = udc_class;
udc->dev.parent = parent;
ret = dev_set_name(&udc->dev, "%s", kobject_name(&parent->kobj));
if (ret)
- goto err2;
+ goto err3;
udc->gadget = gadget;
ret = device_add(&udc->dev);
if (ret)
- goto err3;
+ goto err4;
mutex_unlock(&udc_lock);
return 0;
-err3:
+
+err4:
list_del(&udc->list);
mutex_unlock(&udc_lock);
-err2:
+err3:
put_device(&udc->dev);
+err2:
+ if (gadget->register_my_device)
+ put_device(&gadget->dev);
err1:
return ret;
}
kobject_uevent(&udc->dev.kobj, KOBJ_REMOVE);
device_unregister(&udc->dev);
+
+ if (gadget->register_my_device)
+ device_unregister(&gadget->dev);
}
EXPORT_SYMBOL_GPL(usb_del_gadget_udc);
* only supports HNP on a different root port.
* @b_hnp_enable: OTG device feature flag, indicating that the A-Host
* enabled HNP support.
+ * @register_my_device: Flag telling udc-core that UDC driver didn't
+ * register the gadget device to the driver model. Temporary until
+ * all UDC drivers are fixed up properly.
* @name: Identifies the controller hardware type. Used in diagnostics
* and sometimes configuration.
* @dev: Driver model state for this abstract device.
unsigned b_hnp_enable:1;
unsigned a_hnp_support:1;
unsigned a_alt_hnp_support:1;
+ unsigned register_my_device:1;
const char *name;
struct device dev;
unsigned out_epnum;