static int tegra_ehci_remove(struct platform_device *pdev) { struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); struct usb_device *rhdev = NULL; struct tegra_usb_platform_data *pdata; unsigned long timeout = 0; wake_lock_destroy(&tegra->ehci_wake_lock); #ifdef CONFIG_TEGRA_EHCI_BOOST_CPU_FREQ cancel_delayed_work_sync(&tegra->boost_cpu_freq_work); tegra->cpu_boost_in_work = false; pm_qos_remove_request(&tegra->boost_cpu_freq_req); #endif rhdev = hcd->self.root_hub; pdata = dev_get_platdata(&pdev->dev); if (!IS_ERR_OR_NULL(tegra->transceiver)) otg_set_host(tegra->transceiver->otg, NULL); /* Make sure phy is powered ON to access USB register */ if(!tegra_usb_phy_hw_accessible(tegra->phy)) tegra_usb_phy_power_on(tegra->phy); if (pdata->port_otg) { timeout = jiffies + 5 * HZ; /* wait for devices connected to root hub to disconnect*/ while (rhdev && usb_hub_find_child(rhdev, 1)) { /* wait for any control packets sent to root hub to complete */ if (time_after(jiffies, timeout)) break; msleep(20); cpu_relax(); } } #ifdef CONFIG_TEGRA_EHCI_BOOST_CPU_FREQ device_remove_file(hcd->self.controller, &dev_attr_boost_enable); #endif usb_remove_hcd(hcd); usb_put_hcd(hcd); tegra_usb_phy_power_off(tegra->phy); usb_phy_shutdown(get_usb_phy(tegra->phy)); mutex_destroy(&tegra->sync_lock); tegra_pd_remove_device(&pdev->dev); return 0; }
static int __exit vi_remove(struct platform_device *dev) { #ifdef CONFIG_TEGRA_CAMERA int err = 0; #endif struct nvhost_device_data *pdata = platform_get_drvdata(dev); struct vi *tegra_vi = (struct vi *)pdata->private_data; dev_info(&dev->dev, "%s: ++\n", __func__); #if defined(CONFIG_TEGRA_ISOMGR) if (tegra_vi->isomgr_handle) vi_isomgr_unregister(tegra_vi); #endif vi_remove_debugfs(tegra_vi); vi_intr_free(tegra_vi); nvhost_client_device_release(dev); pdata->aperture[0] = NULL; #ifdef CONFIG_TEGRA_CAMERA err = tegra_camera_unregister(tegra_vi->camera); if (err) return err; #endif #ifdef CONFIG_PM_GENERIC_DOMAINS tegra_pd_remove_device(&dev->dev); #endif regulator_put(tegra_vi->reg); tegra_vi->reg = NULL; /* Remove I2C Devices according to settings from board file */ if (i2c_ctrl && i2c_ctrl->remove_devices) i2c_ctrl->remove_devices(dev); pdata->private_data = i2c_ctrl; return 0; }