enum usb_phy_interface phy_type;
struct reset_control *reset;
struct resource *res;
+ struct usb_phy *phy;
int err;
tegra_phy = devm_kzalloc(&pdev->dev, sizeof(*tegra_phy), GFP_KERNEL);
return err;
}
- tegra_phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0);
- if (!tegra_phy->ulpi) {
+ phy = devm_otg_ulpi_create(&pdev->dev,
+ &ulpi_viewport_access_ops, 0);
+ if (!phy) {
dev_err(&pdev->dev, "Failed to create ULPI OTG\n");
return -ENOMEM;
}
+ tegra_phy->ulpi = phy;
tegra_phy->ulpi->io_priv = tegra_phy->regs + ULPI_VIEWPORT;
break;
err = usb_add_phy_dev(&tegra_phy->u_phy);
if (err)
- goto free_ulpi;
+ return err;
return 0;
-
-free_ulpi:
- if (tegra_phy->ulpi) {
- kfree(tegra_phy->ulpi->otg);
- kfree(tegra_phy->ulpi);
- }
-
- return err;
}
static int tegra_usb_phy_remove(struct platform_device *pdev)
usb_remove_phy(&tegra_phy->u_phy);
- if (tegra_phy->ulpi) {
- kfree(tegra_phy->ulpi->otg);
- kfree(tegra_phy->ulpi);
- }
-
return 0;
}