From patchwork Wed Jun 8 16:54:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9165325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EEACB60467 for ; Wed, 8 Jun 2016 17:12:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D83B4282F9 for ; Wed, 8 Jun 2016 17:12:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD1CD28305; Wed, 8 Jun 2016 17:12:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 823EE2810E for ; Wed, 8 Jun 2016 17:12:25 +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 1bAh05-00030x-Qw; Wed, 08 Jun 2016 17:10:41 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAgzx-0002z2-6i for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Jun 2016 17:10:33 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by merlin.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bAgl6-0007pd-PG for linux-arm-kernel@lists.infradead.org; Wed, 08 Jun 2016 16:55:13 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B51A6439F; Wed, 8 Jun 2016 16:54:48 +0000 (UTC) Received: from shalem.localdomain.com (vpn1-4-249.ams2.redhat.com [10.36.4.249]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u58GsglE024376; Wed, 8 Jun 2016 12:54:43 -0400 From: Hans de Goede To: Greg Kroah-Hartman Subject: [PATCH] ehci-platform: Add support for shared reset controllers Date: Wed, 8 Jun 2016 18:54:40 +0200 Message-Id: <1465404880-28374-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 08 Jun 2016 16:54:48 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160608_125512_887585_CDEFC2DD X-CRM114-Status: GOOD ( 14.20 ) 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: devicetree , Florian Fainelli , linux-usb , Tony Prisk , Hans de Goede , Alan Stern , Philipp Zabel , Maxime Ripard , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for shared platform controllers by using devm_reset_control_get_shared_by_index instead of of_reset_control_get_by_index. Note we use the devm function because there is no of_reset_control_get_shared_by_index, this also leads to a nice cleanup of the cleanup code. This brings the ehci-platform reset handling code inline with ohci-platform. Signed-off-by: Hans de Goede Acked-by: Alan Stern --- drivers/usb/host/ehci-platform.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index bc33f45..6816b8c 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -236,8 +236,8 @@ static int ehci_platform_probe(struct platform_device *dev) } for (rst = 0; rst < EHCI_MAX_RSTS; rst++) { - priv->rsts[rst] = of_reset_control_get_by_index( - dev->dev.of_node, rst); + priv->rsts[rst] = devm_reset_control_get_shared_by_index( + &dev->dev, rst); if (IS_ERR(priv->rsts[rst])) { err = PTR_ERR(priv->rsts[rst]); if (err == -EPROBE_DEFER) @@ -247,10 +247,8 @@ static int ehci_platform_probe(struct platform_device *dev) } err = reset_control_deassert(priv->rsts[rst]); - if (err) { - reset_control_put(priv->rsts[rst]); + if (err) goto err_reset; - } } if (pdata->big_endian_desc) @@ -307,10 +305,8 @@ err_power: if (pdata->power_off) pdata->power_off(dev); err_reset: - while (--rst >= 0) { + while (--rst >= 0) reset_control_assert(priv->rsts[rst]); - reset_control_put(priv->rsts[rst]); - } err_put_clks: while (--clk >= 0) clk_put(priv->clks[clk]); @@ -335,10 +331,8 @@ static int ehci_platform_remove(struct platform_device *dev) if (pdata->power_off) pdata->power_off(dev); - for (rst = 0; rst < EHCI_MAX_RSTS && priv->rsts[rst]; rst++) { + for (rst = 0; rst < EHCI_MAX_RSTS && priv->rsts[rst]; rst++) reset_control_assert(priv->rsts[rst]); - reset_control_put(priv->rsts[rst]); - } for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) clk_put(priv->clks[clk]);