mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-19 18:50:23 +07:00
usb: gadget: net2272: 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
5dc7b77365
commit
c9f9c849ae
@ -2209,7 +2209,6 @@ net2272_remove(struct net2272 *dev)
|
|||||||
free_irq(dev->irq, dev);
|
free_irq(dev->irq, dev);
|
||||||
iounmap(dev->base_addr);
|
iounmap(dev->base_addr);
|
||||||
|
|
||||||
device_unregister(&dev->gadget.dev);
|
|
||||||
device_remove_file(dev->dev, &dev_attr_registers);
|
device_remove_file(dev->dev, &dev_attr_registers);
|
||||||
|
|
||||||
dev_info(dev->dev, "unbind\n");
|
dev_info(dev->dev, "unbind\n");
|
||||||
@ -2236,11 +2235,11 @@ static struct net2272 *net2272_probe_init(struct device *dev, unsigned int irq)
|
|||||||
ret->gadget.max_speed = USB_SPEED_HIGH;
|
ret->gadget.max_speed = USB_SPEED_HIGH;
|
||||||
|
|
||||||
/* the "gadget" abstracts/virtualizes the controller */
|
/* the "gadget" abstracts/virtualizes the controller */
|
||||||
dev_set_name(&ret->gadget.dev, "gadget");
|
|
||||||
ret->gadget.dev.parent = dev;
|
ret->gadget.dev.parent = dev;
|
||||||
ret->gadget.dev.dma_mask = dev->dma_mask;
|
ret->gadget.dev.dma_mask = dev->dma_mask;
|
||||||
ret->gadget.dev.release = net2272_gadget_release;
|
ret->gadget.dev.release = net2272_gadget_release;
|
||||||
ret->gadget.name = driver_name;
|
ret->gadget.name = driver_name;
|
||||||
|
ret->gadget.register_my_device = true;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -2275,12 +2274,9 @@ net2272_probe_fin(struct net2272 *dev, unsigned int irqflags)
|
|||||||
dma_mode_string());
|
dma_mode_string());
|
||||||
dev_info(dev->dev, "version: %s\n", driver_vers);
|
dev_info(dev->dev, "version: %s\n", driver_vers);
|
||||||
|
|
||||||
ret = device_register(&dev->gadget.dev);
|
|
||||||
if (ret)
|
|
||||||
goto err_irq;
|
|
||||||
ret = device_create_file(dev->dev, &dev_attr_registers);
|
ret = device_create_file(dev->dev, &dev_attr_registers);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_dev_reg;
|
goto err_irq;
|
||||||
|
|
||||||
ret = usb_add_gadget_udc(dev->dev, &dev->gadget);
|
ret = usb_add_gadget_udc(dev->dev, &dev->gadget);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -2290,8 +2286,6 @@ net2272_probe_fin(struct net2272 *dev, unsigned int irqflags)
|
|||||||
|
|
||||||
err_add_udc:
|
err_add_udc:
|
||||||
device_remove_file(dev->dev, &dev_attr_registers);
|
device_remove_file(dev->dev, &dev_attr_registers);
|
||||||
err_dev_reg:
|
|
||||||
device_unregister(&dev->gadget.dev);
|
|
||||||
err_irq:
|
err_irq:
|
||||||
free_irq(dev->irq, dev);
|
free_irq(dev->irq, dev);
|
||||||
err:
|
err:
|
||||||
|
Loading…
Reference in New Issue
Block a user