From patchwork Thu May 5 12:34:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 9024061 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EA059BF29F for ; Thu, 5 May 2016 12:37:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2959020220 for ; Thu, 5 May 2016 12:37:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 54EC1201E4 for ; Thu, 5 May 2016 12:37:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ayIVF-0001jh-8V; Thu, 05 May 2016 12:35:37 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ayIUx-0000RK-BQ for linux-arm-kernel@lists.infradead.org; Thu, 05 May 2016 12:35:22 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O6P000LZEY43Q90@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 05 May 2016 13:34:52 +0100 (BST) X-AuditID: cbfec7f5-f792a6d000001302-fc-572b3dec7047 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id B1.41.04866.CED3B275; Thu, 5 May 2016 13:34:52 +0100 (BST) Received: from AMDC2174.DIGITAL.local ([106.120.53.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O6P00KEEEXN8E00@eusync4.samsung.com>; Thu, 05 May 2016 13:34:52 +0100 (BST) From: Krzysztof Kozlowski To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, Ulf Hansson , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , Greg Kroah-Hartman , Mark Brown Subject: [RFC v2 01/13] usb: misc: usb3503: Clean up on driver unbind Date: Thu, 05 May 2016 14:34:14 +0200 Message-id: <1462451666-17945-2-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1462451666-17945-1-git-send-email-k.kozlowski@samsung.com> References: <1462451666-17945-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsVy+t/xa7pvbLXDDSadkbPYOGM9q8XUh0/Y LCY9ec9sMf/IOVaLiSsnM1s0L17PZnFq8jMmi9cvDC02Pb7GanF51xw2iyP/+xktPvceYbSY cX4fk8WiZa3MFmuP3GW3OL27xKJt9QdWi+Nrwx2EPHbOusvusXmFlsemVZ1sHneu7WHz2D93 DVBoSb3Hv2PsHn1bVjF6fN4k53Hq62f2AK4oLpuU1JzMstQifbsErozVR2cwFvTwVTS1bWBu YDzO3cXIySEhYCKx7vp0FghbTOLCvfVsXYxcHEICSxklFi6/xAiSEBJoZJL4MrsexGYTMJbY vHwJWJGIwA1miVc7JzODOMwCOxgl/i67AzZKWMBVYsHspWA2i4CqxKzrm8Am8Qq4S6yb/pcJ Yp2cxMljk1lBbE4BD4mzv+azQmxzlzj0ezrjBEbeBYwMqxhFU0uTC4qT0nON9IoTc4tL89L1 kvNzNzFCgv3rDsalx6wOMQpwMCrx8GbM1QoXYk0sK67MPcQowcGsJMIrD4wVId6UxMqq1KL8 +KLSnNTiQ4zSHCxK4rwzd70PERJITyxJzU5NLUgtgskycXBKNTCGLuqeUhjkI98V5P7mx+br B922VohFH699X2Yjsv5dftNHSZntQr88ji9l/Pnh9wub7VOmy9Seafn7/rHr0aUn+eactza9 tZk1+Jxc6hwrH2sGP7O1BXJ5qm9Obzj/6dwf/TulP44FNjrGZ6+SUbXpq+iqjFNdyZswiafp 5JqQR51V0SklvulKLMUZiYZazEXFiQAw9xp4cgIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160505_053519_615147_9A43B78A X-CRM114-Status: GOOD ( 17.92 ) X-Spam-Score: -9.0 (---------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hverkuil@xs4all.nl, tjakobi@math.uni-bielefeld.de, Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , m.szyprowski@samsung.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver should clean up after itself by unpreparing the clock when it is unbound. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Javier Martinez Canillas --- drivers/usb/misc/usb3503.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c index b45cb77c0744..a464636675a6 100644 --- a/drivers/usb/misc/usb3503.c +++ b/drivers/usb/misc/usb3503.c @@ -330,6 +330,19 @@ 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) { + if (hub->clk) + clk_disable_unprepare(hub->clk); + } + + return 0; +} + static int usb3503_platform_probe(struct platform_device *pdev) { struct usb3503 *hub; @@ -342,6 +355,19 @@ 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) { + if (hub->clk) + clk_disable_unprepare(hub->clk); + } + + return 0; +} + #ifdef CONFIG_PM_SLEEP static int usb3503_i2c_suspend(struct device *dev) { @@ -395,6 +421,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, }; @@ -404,6 +431,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)