diff options
author | Roger Quadros <rogerq@ti.com> | 2012-11-26 08:26:28 -0500 |
---|---|---|
committer | Roger Quadros <rogerq@ti.com> | 2013-02-13 06:22:42 -0500 |
commit | 7ed8619141198191d09f63fa6f172af361ad280d (patch) | |
tree | af3378eaa148463c955133ad54503223c61c8547 /drivers/mfd | |
parent | 8bdbd1549479840293e46bf0f84d7174e77b7b5e (diff) |
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | 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 3dbbfea515ad..eccc65e97202 100644 --- a/drivers/mfd/omap-usb-tll.c +++ b/drivers/mfd/omap-usb-tll.c | |||
@@ -109,8 +109,8 @@ struct usbtll_omap { | |||
109 | 109 | ||
110 | /*-------------------------------------------------------------------------*/ | 110 | /*-------------------------------------------------------------------------*/ |
111 | 111 | ||
112 | const char usbtll_driver_name[] = USBTLL_DRIVER_NAME; | 112 | static const char usbtll_driver_name[] = USBTLL_DRIVER_NAME; |
113 | struct platform_device *tll_pdev; | 113 | static struct device *tll_dev; |
114 | 114 | ||
115 | /*-------------------------------------------------------------------------*/ | 115 | /*-------------------------------------------------------------------------*/ |
116 | 116 | ||
@@ -334,7 +334,8 @@ static int usbtll_omap_probe(struct platform_device *pdev) | |||
334 | 334 | ||
335 | spin_unlock_irqrestore(&tll->lock, flags); | 335 | spin_unlock_irqrestore(&tll->lock, flags); |
336 | pm_runtime_put_sync(dev); | 336 | pm_runtime_put_sync(dev); |
337 | tll_pdev = pdev; | 337 | /* only after this can omap_tll_enable/disable work */ |
338 | tll_dev = dev; | ||
338 | 339 | ||
339 | return 0; | 340 | return 0; |
340 | 341 | ||
@@ -356,6 +357,8 @@ static int usbtll_omap_remove(struct platform_device *pdev) | |||
356 | struct usbtll_omap *tll = platform_get_drvdata(pdev); | 357 | struct usbtll_omap *tll = platform_get_drvdata(pdev); |
357 | int i; | 358 | int i; |
358 | 359 | ||
360 | tll_dev = NULL; | ||
361 | |||
359 | for (i = 0; i < tll->nch; i++) | 362 | for (i = 0; i < tll->nch; i++) |
360 | if (!IS_ERR(tll->ch_clk[i])) | 363 | if (!IS_ERR(tll->ch_clk[i])) |
361 | clk_put(tll->ch_clk[i]); | 364 | clk_put(tll->ch_clk[i]); |
@@ -436,21 +439,21 @@ static struct platform_driver usbtll_omap_driver = { | |||
436 | 439 | ||
437 | int omap_tll_enable(void) | 440 | int omap_tll_enable(void) |
438 | { | 441 | { |
439 | if (!tll_pdev) { | 442 | if (!tll_dev) { |
440 | pr_err("missing omap usbhs tll platform_data\n"); | 443 | pr_err("%s: OMAP USB TLL not initialized\n", __func__); |
441 | return -ENODEV; | 444 | return -ENODEV; |
442 | } | 445 | } |
443 | return pm_runtime_get_sync(&tll_pdev->dev); | 446 | return pm_runtime_get_sync(tll_dev); |
444 | } | 447 | } |
445 | EXPORT_SYMBOL_GPL(omap_tll_enable); | 448 | EXPORT_SYMBOL_GPL(omap_tll_enable); |
446 | 449 | ||
447 | int omap_tll_disable(void) | 450 | int omap_tll_disable(void) |
448 | { | 451 | { |
449 | if (!tll_pdev) { | 452 | if (!tll_dev) { |
450 | pr_err("missing omap usbhs tll platform_data\n"); | 453 | pr_err("%s: OMAP USB TLL not initialized\n", __func__); |
451 | return -ENODEV; | 454 | return -ENODEV; |
452 | } | 455 | } |
453 | return pm_runtime_put_sync(&tll_pdev->dev); | 456 | return pm_runtime_put_sync(tll_dev); |
454 | } | 457 | } |
455 | EXPORT_SYMBOL_GPL(omap_tll_disable); | 458 | EXPORT_SYMBOL_GPL(omap_tll_disable); |
456 | 459 | ||