From patchwork Fri Mar 29 09:33:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10876711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82625139A for ; Fri, 29 Mar 2019 09:34:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6DE02287E0 for ; Fri, 29 Mar 2019 09:34:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6237128856; Fri, 29 Mar 2019 09:34:19 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F403287E0 for ; Fri, 29 Mar 2019 09:34:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728917AbfC2JeR (ORCPT ); Fri, 29 Mar 2019 05:34:17 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:40347 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728737AbfC2Jdq (ORCPT ); Fri, 29 Mar 2019 05:33:46 -0400 Received: by mail-wm1-f68.google.com with SMTP id z24so1960196wmi.5 for ; Fri, 29 Mar 2019 02:33:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ze5SSoMthSUJEWILh/6R6Dx6kiGpd0KVEMFuw2rprTY=; b=0BSzGfvncOp+if/tJIHLno6MGS9J176p5OuCiUpvRIpwJtY2UTdoe7/x8bZzvQbwUy 6uov2hdT4bF9A/9E6HpwTs9bu4JOG2GXE8UHxOIHMOwRbapJqNKYArovWz/LB09vYkx7 Z7YS4oK6a7aOgz4LmJExBeZroq1pWS1YSdDLekZmHY2uPDsG27TckGUfOhQbylpj4Mg0 8TCWDMTM73KtTcIyofhdWeOx1qqeYqqeRaNzKA7EMrLIZFK9PTTJ4WKbzGfy+R2SVxqk Y4ucaijH8aGjkigRxgt7WV8oW7fLIZigBVqP1FcksX4+3DCDLFya+XZlU+QBCy4lNHZ3 5r6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ze5SSoMthSUJEWILh/6R6Dx6kiGpd0KVEMFuw2rprTY=; b=bgensz2iSZ5PYj561dDy3BT7Tuy39wHIK0L8iceBpbTJjXaOP8Sv+s4IMjSGRYLHeZ 8dltTVwlypSU0MAFK1XOnt0e7tV6Ah+tvcFPStz6tpym3nxFrnVM7bNdljDQytJwe4SK 17mJ1uPjVH/EHPq8C66K0r0YkXcsW7d038+nfwcO0Rep4CjAFmm64ut4tZsSOMeZvRcw OXSVFo6wv4SmuBvoSZEHwJKtd6KUZxgpe92mUddkzWL+nDL+lD5p3bm1XrSUzIxj4htN ryl/tSYQ9NNvWOUnyLWLk09DCk3auo2e8s2+CwVT7lXMCf4nztsNtZ/fupCpCqg1VN4j +hqw== X-Gm-Message-State: APjAAAXv4PhgWXo4vp8eT6oirFNQz5J9MbzZHBfR8JNIO92TLAcveeQV WfkaCknYBsVaVLsNNVVii5drYg== X-Google-Smtp-Source: APXvYqywqsBJ6vOuQI0SVUJ9GDFgyd4nYvY/ygpOvIhNOZKecn56UXso299U5l5WwsmJ3cF2p4HNGg== X-Received: by 2002:a1c:e085:: with SMTP id x127mr2814871wmg.87.1553852024425; Fri, 29 Mar 2019 02:33:44 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-29-77.w90-86.abo.wanadoo.fr. [90.86.254.77]) by smtp.gmail.com with ESMTPSA id s12sm1957125wmj.42.2019.03.29.02.33.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 02:33:43 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 2/6] usb: ohci-da8xx: let the regulator framework keep track of use count Date: Fri, 29 Mar 2019 10:33:30 +0100 Message-Id: <20190329093334.3885-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190329093334.3885-1-brgl@bgdev.pl> References: <20190329093334.3885-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski There's no reason to have a separate variable to keep track of the regulator state. The regulator core already does that. Remove reg_enabled from struct da8xx_ohci_hcd. Signed-off-by: Bartosz Golaszewski --- drivers/usb/host/ohci-da8xx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index ca8a94f15ac0..9c6d1f03b871 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -40,7 +40,6 @@ struct da8xx_ohci_hcd { struct phy *usb11_phy; struct regulator *vbus_reg; struct notifier_block nb; - unsigned int reg_enabled; struct gpio_desc *vbus_gpio; struct gpio_desc *oc_gpio; }; @@ -100,21 +99,18 @@ static int ohci_da8xx_set_power(struct usb_hcd *hcd, int on) if (!da8xx_ohci->vbus_reg) return 0; - if (on && !da8xx_ohci->reg_enabled) { + if (on) { ret = regulator_enable(da8xx_ohci->vbus_reg); if (ret) { dev_err(dev, "Failed to enable regulator: %d\n", ret); return ret; } - da8xx_ohci->reg_enabled = 1; - - } else if (!on && da8xx_ohci->reg_enabled) { + } else if (!on) { ret = regulator_disable(da8xx_ohci->vbus_reg); if (ret) { dev_err(dev, "Failed to disable regulator: %d\n", ret); return ret; } - da8xx_ohci->reg_enabled = 0; } return 0;