[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1358511445-26656-9-git-send-email-rogerq@ti.com>
Date: Fri, 18 Jan 2013 14:17:11 +0200
From: Roger Quadros <rogerq@...com>
To: <sameo@...ux.intel.com>, <balbi@...com>, <tony@...mide.com>
CC: <kishon@...com>, <sshtylyov@...sta.com>, <bjorn@...k.no>,
<linux@....linux.org.uk>, <linux-usb@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <rogerq@...com>
Subject: [PATCH v8 08/22] 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@...com>
Reviewed-by: Felipe Balbi <balbi@...com>
---
drivers/mfd/omap-usb-tll.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 0e68c8a..81d2cac 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;
/*-------------------------------------------------------------------------*/
@@ -337,7 +337,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;
@@ -359,6 +360,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++)
clk_put(tll->ch_clk[i]);
@@ -438,21 +441,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);
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists