summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2012-11-26 15:26:28 +0200
committerRoger Quadros <rogerq@ti.com>2013-02-13 13:22:42 +0200
commit7ed8619141198191d09f63fa6f172af361ad280d (patch)
treeaf3378eaa148463c955133ad54503223c61c8547
parent8bdbd1549479840293e46bf0f84d7174e77b7b5e (diff)
downloadlinux-7ed8619141198191d09f63fa6f172af361ad280d.tar.gz
linux-7ed8619141198191d09f63fa6f172af361ad280d.tar.bz2
linux-7ed8619141198191d09f63fa6f172af361ad280d.zip
mfd: omap-usb-tll: Fix error message
omap_enable/disable_tll() can fail if TLL device is not initialized. It could be due to multiple reasons and not only due to missing platform data. Also make local variables static and use 'struct device *' instead of 'struct platform_device *' for global reference. Signed-off-by: Roger Quadros <rogerq@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/mfd/omap-usb-tll.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 3dbbfea515ad..eccc65e97202 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -109,8 +109,8 @@ struct usbtll_omap {
/*-------------------------------------------------------------------------*/
-const char usbtll_driver_name[] = USBTLL_DRIVER_NAME;
-struct platform_device *tll_pdev;
+static const char usbtll_driver_name[] = USBTLL_DRIVER_NAME;
+static struct device *tll_dev;
/*-------------------------------------------------------------------------*/
@@ -334,7 +334,8 @@ static int usbtll_omap_probe(struct platform_device *pdev)
spin_unlock_irqrestore(&tll->lock, flags);
pm_runtime_put_sync(dev);
- tll_pdev = pdev;
+ /* only after this can omap_tll_enable/disable work */
+ tll_dev = dev;
return 0;
@@ -356,6 +357,8 @@ static int usbtll_omap_remove(struct platform_device *pdev)
struct usbtll_omap *tll = platform_get_drvdata(pdev);
int i;
+ tll_dev = NULL;
+
for (i = 0; i < tll->nch; i++)
if (!IS_ERR(tll->ch_clk[i]))
clk_put(tll->ch_clk[i]);
@@ -436,21 +439,21 @@ static struct platform_driver usbtll_omap_driver = {
int omap_tll_enable(void)
{
- if (!tll_pdev) {
- pr_err("missing omap usbhs tll platform_data\n");
+ if (!tll_dev) {
+ pr_err("%s: OMAP USB TLL not initialized\n", __func__);
return -ENODEV;
}
- return pm_runtime_get_sync(&tll_pdev->dev);
+ return pm_runtime_get_sync(tll_dev);
}
EXPORT_SYMBOL_GPL(omap_tll_enable);
int omap_tll_disable(void)
{
- if (!tll_pdev) {
- pr_err("missing omap usbhs tll platform_data\n");
+ if (!tll_dev) {
+ pr_err("%s: OMAP USB TLL not initialized\n", __func__);
return -ENODEV;
}
- return pm_runtime_put_sync(&tll_pdev->dev);
+ return pm_runtime_put_sync(tll_dev);
}
EXPORT_SYMBOL_GPL(omap_tll_disable);