aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/usb3503.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2016-06-01 03:29:57 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-08 01:19:59 -0400
commit62c32e4641e7c5f6e0cad72bea0c8645c33d51b6 (patch)
tree55119068450d4b550f41b902311a4f0f7edea5d5 /drivers/usb/misc/usb3503.c
parent495660cb53ba7c8cc8fcb577ad05001f12b58632 (diff)
usb: misc: usb3503: Clean up on driver unbind
The driver should clean up after itself by unpreparing the clock when it is unbound. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc/usb3503.c')
-rw-r--r--drivers/usb/misc/usb3503.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index 0cf2987b322f..8e7737d7ac0a 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -330,6 +330,17 @@ static int usb3503_i2c_probe(struct i2c_client *i2c,
330 return usb3503_probe(hub); 330 return usb3503_probe(hub);
331} 331}
332 332
333static int usb3503_i2c_remove(struct i2c_client *i2c)
334{
335 struct usb3503 *hub;
336
337 hub = i2c_get_clientdata(i2c);
338 if (hub->clk)
339 clk_disable_unprepare(hub->clk);
340
341 return 0;
342}
343
333static int usb3503_platform_probe(struct platform_device *pdev) 344static int usb3503_platform_probe(struct platform_device *pdev)
334{ 345{
335 struct usb3503 *hub; 346 struct usb3503 *hub;
@@ -343,6 +354,17 @@ static int usb3503_platform_probe(struct platform_device *pdev)
343 return usb3503_probe(hub); 354 return usb3503_probe(hub);
344} 355}
345 356
357static int usb3503_platform_remove(struct platform_device *pdev)
358{
359 struct usb3503 *hub;
360
361 hub = platform_get_drvdata(pdev);
362 if (hub->clk)
363 clk_disable_unprepare(hub->clk);
364
365 return 0;
366}
367
346#ifdef CONFIG_PM_SLEEP 368#ifdef CONFIG_PM_SLEEP
347static int usb3503_i2c_suspend(struct device *dev) 369static int usb3503_i2c_suspend(struct device *dev)
348{ 370{
@@ -396,6 +418,7 @@ static struct i2c_driver usb3503_i2c_driver = {
396 .of_match_table = of_match_ptr(usb3503_of_match), 418 .of_match_table = of_match_ptr(usb3503_of_match),
397 }, 419 },
398 .probe = usb3503_i2c_probe, 420 .probe = usb3503_i2c_probe,
421 .remove = usb3503_i2c_remove,
399 .id_table = usb3503_id, 422 .id_table = usb3503_id,
400}; 423};
401 424
@@ -405,6 +428,7 @@ static struct platform_driver usb3503_platform_driver = {
405 .of_match_table = of_match_ptr(usb3503_of_match), 428 .of_match_table = of_match_ptr(usb3503_of_match),
406 }, 429 },
407 .probe = usb3503_platform_probe, 430 .probe = usb3503_platform_probe,
431 .remove = usb3503_platform_remove,
408}; 432};
409 433
410static int __init usb3503_init(void) 434static int __init usb3503_init(void)