retval = hw_device_reset(ci, USBMODE_CM_DC);
if (retval)
goto put_transceiver;
- hw_enable_vbus_intr(ci);
}
- retval = device_register(&ci->gadget.dev);
- if (retval) {
- put_device(&ci->gadget.dev);
- retval = dbg_create_files(ci->dev);
- if (retval)
-- goto put_transceiver;
- }
--
if (!IS_ERR_OR_NULL(ci->transceiver)) {
retval = otg_set_peripheral(ci->transceiver->otg,
&ci->gadget);
if (retval)
- goto unreg_device;
- goto remove_dbg;
++ goto put_transceiver;
}
retval = usb_add_gadget_udc(dev, &ci->gadget);
}
dev_err(dev, "error = %i\n", retval);
- unreg_device:
- device_unregister(&ci->gadget.dev);
-remove_dbg:
- dbg_remove_files(ci->dev);
put_transceiver:
if (!IS_ERR_OR_NULL(ci->transceiver) && ci->global_phy)
usb_put_phy(ci->transceiver);
if (ci->global_phy)
usb_put_phy(ci->transceiver);
}
- device_unregister(&ci->gadget.dev);
- dbg_remove_files(ci->dev);
/* my kobject is dynamic, I swear! */
memset(&ci->gadget, 0, sizeof(ci->gadget));
}
* do...?
*/
if (gfs_ether_setup)
- gether_cleanup();
+ gether_cleanup(the_dev);
gfs_ether_setup = false;
- for (i = func_num; --i; )
+ for (i = func_num; i--; )
if (ffs_tab[i].ffs_data)
functionfs_unbind(ffs_tab[i].ffs_data);
"ep-a", "ep-b", "ep-c",
};
- #define DMA_ADDR_INVALID (~(dma_addr_t)0)
-#ifdef CONFIG_USB_GADGET_NET2272_DMA
+#ifdef CONFIG_USB_NET2272_DMA
/*
* use_dma: the NET2272 can use an external DMA controller.
* Note that since there is no generic DMA api, some functions,
err_func:
device_remove_file (&dev->pdev->dev, &dev_attr_function);
err_unbind:
- dev->gadget.dev.driver = NULL;
- driver->unbind (&dev->gadget);
dev->driver = NULL;
return retval;
}
if (!irq) {
dev_err(&pdev->dev, "Failed to get IRQ\n");
err = -ENODEV;
- goto fail;
+ goto fail_phy;
}
- #ifdef CONFIG_USB_OTG_UTILS
if (pdata->operating_mode == TEGRA_USB_OTG) {
tegra->transceiver =
devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
- if (!IS_ERR_OR_NULL(tegra->transceiver))
+ if (!IS_ERR(tegra->transceiver))
otg_set_host(tegra->transceiver->otg, &hcd->self);
+ } else {
+ tegra->transceiver = ERR_PTR(-ENODEV);
}
- #endif
err = usb_add_hcd(hcd, irq, IRQF_SHARED);
if (err) {
return err;
fail:
- #ifdef CONFIG_USB_OTG_UTILS
- if (!IS_ERR_OR_NULL(tegra->transceiver))
+ if (!IS_ERR(tegra->transceiver))
otg_set_host(tegra->transceiver->otg, NULL);
- #endif
+fail_phy:
usb_phy_shutdown(hcd->phy);
fail_io:
clk_disable_unprepare(tegra->clk);