usb: gadget: net2280: let udc-core manage gadget->dev
By simply setting a flag, we can drop some boilerplate code. Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
c9f9c849ae
commit
654dfe4d2a
|
@ -2679,7 +2679,6 @@ static void net2280_remove (struct pci_dev *pdev)
|
||||||
pci_resource_len (pdev, 0));
|
pci_resource_len (pdev, 0));
|
||||||
if (dev->enabled)
|
if (dev->enabled)
|
||||||
pci_disable_device (pdev);
|
pci_disable_device (pdev);
|
||||||
device_unregister (&dev->gadget.dev);
|
|
||||||
device_remove_file (&pdev->dev, &dev_attr_registers);
|
device_remove_file (&pdev->dev, &dev_attr_registers);
|
||||||
pci_set_drvdata (pdev, NULL);
|
pci_set_drvdata (pdev, NULL);
|
||||||
|
|
||||||
|
@ -2711,11 +2710,11 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
dev->gadget.max_speed = USB_SPEED_HIGH;
|
dev->gadget.max_speed = USB_SPEED_HIGH;
|
||||||
|
|
||||||
/* the "gadget" abstracts/virtualizes the controller */
|
/* the "gadget" abstracts/virtualizes the controller */
|
||||||
dev_set_name(&dev->gadget.dev, "gadget");
|
|
||||||
dev->gadget.dev.parent = &pdev->dev;
|
dev->gadget.dev.parent = &pdev->dev;
|
||||||
dev->gadget.dev.dma_mask = pdev->dev.dma_mask;
|
dev->gadget.dev.dma_mask = pdev->dev.dma_mask;
|
||||||
dev->gadget.dev.release = gadget_release;
|
dev->gadget.dev.release = gadget_release;
|
||||||
dev->gadget.name = driver_name;
|
dev->gadget.name = driver_name;
|
||||||
|
dev->gadget.register_my_device = true;
|
||||||
|
|
||||||
/* now all the pci goodies ... */
|
/* now all the pci goodies ... */
|
||||||
if (pci_enable_device (pdev) < 0) {
|
if (pci_enable_device (pdev) < 0) {
|
||||||
|
@ -2823,8 +2822,6 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
use_dma
|
use_dma
|
||||||
? (use_dma_chaining ? "chaining" : "enabled")
|
? (use_dma_chaining ? "chaining" : "enabled")
|
||||||
: "disabled");
|
: "disabled");
|
||||||
retval = device_register (&dev->gadget.dev);
|
|
||||||
if (retval) goto done;
|
|
||||||
retval = device_create_file (&pdev->dev, &dev_attr_registers);
|
retval = device_create_file (&pdev->dev, &dev_attr_registers);
|
||||||
if (retval) goto done;
|
if (retval) goto done;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue