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,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 8EC3EC10F13 for ; Thu, 11 Apr 2019 09:31:02 +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 4B9EE20850 for ; Thu, 11 Apr 2019 09:31:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uVlbSpeN"; 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="EgQOslsc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B9EE20850 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=BafmUt4AYcWhBR+AHDOZuzQRqF50AO1Tt/zMh43pvBw=; b=uVlbSpeNb37IRD 8n3rDk1mbQ5Ok0ViA3jQL1lJW3Ve6ik0gLWNF3d57/AJ+1ifDGh6BqHIBukSKqo2jEgtz/mR/W5RU MPVuhSNNFSsXFDrNc/GteF/XK2UeaXORRhILf/Txt0iMa+pEo0cqLYn5rHZND3HTF/7s4iIzUNO1Z Ie0ewi4rNOhIUDJ5saKJfiyrIJE9gEFHBkFsEXogbuUOuqOoPwafb8m+2W2Ey0Xu0eeE6K69O5Ms+ k7ha4pyfuxrm6JUiXRyqk0k0k2TpTpyH6mJZ1DYbxJKYKwTMuCWSlKR0NccBPOTIK8gi6Un5Z5X2W HMk+D8xI4Uc++auFK8jA==; 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 1hEW2q-0004k1-Js; Thu, 11 Apr 2019 09:30:56 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEW2T-0004HK-DM for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2019 09:30:35 +0000 Received: by mail-wr1-x441.google.com with SMTP id y7so6344541wrn.11 for ; Thu, 11 Apr 2019 02:30:33 -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=joOQiQILwSUQpc0pTrHcK/ya5VvWQmcmFsscTsVp5Yw=; b=EgQOslscCdg9QNMZU/Bmy89sWYhpPCz71b3AUgk9nLqxNHNg1pI/E5AN+sMPGwj0no dLLWajdIxgW6ZXMt0sD9MPDdhZey85TqREKHcEoQ5dItHGElCuMk+LDOKuV0CiuYAS3Z qx0krI14O7/bgOxhziDK099EixwkG4mR7RvOaXhf8yz/FGfnzV9o1QRcXvGpBpm9HvKN QlkJJ+JuuKpMyz4xOoSW03IcBBKcAz/HV9yKR4VnkBh4QcItjeS181kTJAURjl1ruz6A fkRxdxAgWImttXyvzhGfBpaEkZfdasotYPRLd/S7Pk19gH2BqHsm+Y1HzgRQ45Xgmfo9 K3ig== 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=joOQiQILwSUQpc0pTrHcK/ya5VvWQmcmFsscTsVp5Yw=; b=MIWZzurtF8ugAe7Dl2KEexMPm3hbxKQY3r/4Ut0mED17cjRd3j9rndZGAd3i44WTf4 +WPezN8g/OT00KH/RZGOuhTe864JNeqqNRb65d/XITQ1KsjvUut0mCHlDt5qMBceyDzQ 2ahMhMp4kGqUYr+YWznPXpB8BhXuaSQwClNgM81kYWG04ttyz/4lgGpmiQrTuhEsqhxL oO2LpyWBX86fFUOyrLPO/jzivPX2P5jNRnOG7982GaOmKlcV9HX/fQuMjc2zCflByw+N ihO1ZtHB7i+rKaav+Y/+Y1OI7C4W2jTaoSeXBqAruJOfDJt949R46EclleOAsDKHlDNy 5cwg== X-Gm-Message-State: APjAAAXRcEdGD4PmFDeK499JgHAs1IQ73SRIGqOMLWmavQ9Il31mMxy6 TCARZjm8hKE/tR3yG4HVjPwfTQ== X-Google-Smtp-Source: APXvYqyUOAE+neN/xsO+xoLZUe6zOOYX4bRL3Bf0Vlw1KF3Q1rQEfh4MaSvn1jgF2DVc2WcCsdXfAw== X-Received: by 2002:a5d:6988:: with SMTP id g8mr30852625wru.117.1554975032038; Thu, 11 Apr 2019 02:30:32 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id a9sm37517228wrt.29.2019.04.11.02.30.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 02:30:31 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Subject: [PATCH v4 2/6] usb: ohci-da8xx: let the regulator framework keep track of use count Date: Thu, 11 Apr 2019 11:30:20 +0200 Message-Id: <20190411093024.23555-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190411093024.23555-1-brgl@bgdev.pl> References: <20190411093024.23555-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190411_023033_638616_0CC5ECBF X-CRM114-Status: GOOD ( 12.59 ) 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 Acked-by: Alan Stern --- 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..209a262b5565 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 { 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