linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] usb: misc: usb3503: Set platform data
@ 2016-06-01  7:29 Krzysztof Kozlowski
  2016-06-01  7:29 ` [PATCH v2 2/2] usb: misc: usb3503: Clean up on driver unbind Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2016-06-01  7:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-usb, linux-kernel
  Cc: Andrew F. Davis, Bartlomiej Zolnierkiewicz

Driver supports two paths of device instantiation: as platform and i2c
device. In the platform path it lacks of storing the driver specific
structure as drvdata.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

---

Changes since v1:
1. New patch.
---
 drivers/usb/misc/usb3503.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index b45cb77c0744..0cf2987b322f 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -338,6 +338,7 @@ static int usb3503_platform_probe(struct platform_device *pdev)
 	if (!hub)
 		return -ENOMEM;
 	hub->dev = &pdev->dev;
+	platform_set_drvdata(pdev, hub);
 
 	return usb3503_probe(hub);
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH v2 2/2] usb: misc: usb3503: Clean up on driver unbind
  2016-06-01  7:29 [PATCH v2 1/2] usb: misc: usb3503: Set platform data Krzysztof Kozlowski
@ 2016-06-01  7:29 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2016-06-01  7:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-usb, linux-kernel
  Cc: Andrew F. Davis, Bartlomiej Zolnierkiewicz

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>

---

Changes since v1:
1. Add Javier's tag.
2. Follow Javier's suggestion - the 'hub' cannot be null now.
---
 drivers/usb/misc/usb3503.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

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,
 	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)
 {
 	struct usb3503 *hub;
@@ -343,6 +354,17 @@ static int usb3503_platform_probe(struct platform_device *pdev)
 	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
 static int usb3503_i2c_suspend(struct device *dev)
 {
@@ -396,6 +418,7 @@ static struct i2c_driver usb3503_i2c_driver = {
 		.of_match_table = of_match_ptr(usb3503_of_match),
 	},
 	.probe		= usb3503_i2c_probe,
+	.remove		= usb3503_i2c_remove,
 	.id_table	= usb3503_id,
 };
 
@@ -405,6 +428,7 @@ static struct platform_driver usb3503_platform_driver = {
 		.of_match_table = of_match_ptr(usb3503_of_match),
 	},
 	.probe		= usb3503_platform_probe,
+	.remove		= usb3503_platform_remove,
 };
 
 static int __init usb3503_init(void)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-01  7:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-01  7:29 [PATCH v2 1/2] usb: misc: usb3503: Set platform data Krzysztof Kozlowski
2016-06-01  7:29 ` [PATCH v2 2/2] usb: misc: usb3503: Clean up on driver unbind Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).