From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 128CFC4360F for ; Fri, 29 Mar 2019 09:34:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D28B020643 for ; Fri, 29 Mar 2019 09:34:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vCeXahLL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="0BSzGfvn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D28B020643 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dAsfYwwNM9SRS0yI7XIwYnA7WHYdbHZKxPwGWuwZGO0=; b=vCeXahLLtRfsd0 hs9sn3zhbfFoJkxTe1hOjF/efmvypmLsdfjJkfYhmGuJFZYIP6BgTOVcyQF9NWTTT0RmgvNadnkcR DyAYr+48dhWr3CHSynJiAr5FPZsGhNDiR4oxMoDDjKkq0SWAlBzBYTxr8tpyUx7eu5SXT2sCk2Jc5 pito/VOGeXWm/hUmoBNZ0TIAtxJ+l7tuF9DyQKLCjW6de6zKkE4rlu6ZmCojeh0ICQtH5VnUJoI6B YFwJC9tV95B+oSJYJYJJ70CeAaeAu7jfcxcdZx7fHXNzlxBeZd0/+Vf/9eyZ1iN1U4plCMD6uPLl0 7C7LfuiyfMzPqdf1ZPXQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9nto-0001vV-LY; Fri, 29 Mar 2019 09:34:08 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9ntR-0001UG-PV for linux-arm-kernel@lists.infradead.org; Fri, 29 Mar 2019 09:33:47 +0000 Received: by mail-wm1-x343.google.com with SMTP id o25so1751824wmf.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=SHw0lpOCDzMmxjkYOSoi3sz7f0hlqTf4B3Y5X4HBSREeE8HLtQUkcz/pl3TgXth0te 29Dt6UOb/AEyE6r76AUygIvmSqc1eLyjZ7H1B95wq1/0eQtokuKHhxGan1MukjDSRQOx 9xGx1AGfVFRCO+V3yh/yyUBQEdDwUdhLTe3qynKGWh8kWIRIUtBW2/ZdffXVaZJ/vMh7 F3X/aLBleiEmfMw8AD6Sb0K5kKwoZ+1QkM3XwLGNLmDQybHXJD02NQ/B0ESDQxLL1CSa H816f8mTq1RmwxzsyejgZo1nUeeMkEz34l3MQVRSi/X3gOIunOvFvNy3i8V2Hb3YeVQQ yXbw== X-Gm-Message-State: APjAAAWbMLIMjTRnsumgxgqMB4xa8PjZHJwZict79PTuqWPJSdF8rYeg CyIgEnUMjzFrcKc/3Ui6/HQFCA== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190329_023345_939828_78AA6145 X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; -- 2.21.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel