static void tegra_ehci_hcd_shutdown(struct platform_device *pdev) { struct tegra_ehci_hcd *tegra = NULL; struct usb_hcd *hcd = NULL; dev_info(&pdev->dev, "%s+\n", __func__); device_ehci_shutdown = true; if (!_try_lock(&pdev->dev)) { pr_info("%s failed to lock device\n", __func__); goto exit; } tegra = platform_get_drvdata(pdev); if (!tegra) { pr_info("%s device has no driver data\n", __func__); goto unlock_device; } hcd = ehci_to_hcd(tegra->ehci); if ( !hcd || !hcd->driver ) { pr_info("%s: hcd <%p> or driver is NULL\n", __func__, hcd); WARN_ON(1); goto unlock_device; } if (hcd->driver->shutdown) hcd->driver->shutdown(hcd); dev_info(&pdev->dev, "%s-\n", __func__); //htc_dbg unlock_device: device_unlock(&pdev->dev); exit: return; }
bool try_lock() { return _try_lock() == 0; }