Commit 62c32e46 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Greg Kroah-Hartman

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: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 495660cb
...@@ -330,6 +330,17 @@ static int usb3503_i2c_probe(struct i2c_client *i2c, ...@@ -330,6 +330,17 @@ static int usb3503_i2c_probe(struct i2c_client *i2c,
return usb3503_probe(hub); return usb3503_probe(hub);
} }
static int usb3503_i2c_remove(struct i2c_client *i2c)
{
struct usb3503 *hub;
hub = i2c_get_clientdata(i2c);
if (hub->clk)
clk_disable_unprepare(hub->clk);
return 0;
}
static int usb3503_platform_probe(struct platform_device *pdev) static int usb3503_platform_probe(struct platform_device *pdev)
{ {
struct usb3503 *hub; struct usb3503 *hub;
...@@ -343,6 +354,17 @@ static int usb3503_platform_probe(struct platform_device *pdev) ...@@ -343,6 +354,17 @@ static int usb3503_platform_probe(struct platform_device *pdev)
return usb3503_probe(hub); return usb3503_probe(hub);
} }
static int usb3503_platform_remove(struct platform_device *pdev)
{
struct usb3503 *hub;
hub = platform_get_drvdata(pdev);
if (hub->clk)
clk_disable_unprepare(hub->clk);
return 0;
}
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int usb3503_i2c_suspend(struct device *dev) static int usb3503_i2c_suspend(struct device *dev)
{ {
...@@ -396,6 +418,7 @@ static struct i2c_driver usb3503_i2c_driver = { ...@@ -396,6 +418,7 @@ static struct i2c_driver usb3503_i2c_driver = {
.of_match_table = of_match_ptr(usb3503_of_match), .of_match_table = of_match_ptr(usb3503_of_match),
}, },
.probe = usb3503_i2c_probe, .probe = usb3503_i2c_probe,
.remove = usb3503_i2c_remove,
.id_table = usb3503_id, .id_table = usb3503_id,
}; };
...@@ -405,6 +428,7 @@ static struct platform_driver usb3503_platform_driver = { ...@@ -405,6 +428,7 @@ static struct platform_driver usb3503_platform_driver = {
.of_match_table = of_match_ptr(usb3503_of_match), .of_match_table = of_match_ptr(usb3503_of_match),
}, },
.probe = usb3503_platform_probe, .probe = usb3503_platform_probe,
.remove = usb3503_platform_remove,
}; };
static int __init usb3503_init(void) static int __init usb3503_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment