From patchwork Wed Mar 15 18:51:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Keeping X-Patchwork-Id: 9626455 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 9FC88604A9 for ; Wed, 15 Mar 2017 18:52:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9470120243 for ; Wed, 15 Mar 2017 18:52:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 895C527D4A; Wed, 15 Mar 2017 18:52:27 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2A9A220243 for ; Wed, 15 Mar 2017 18:52:27 +0000 (UTC) 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:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0NXj5kVZzmBc6P+b4X+MMEp1ssBOzkxoDDwgOEvyb38=; b=tdpwTQDKyeH++w g+9AhYxYGd5s9I/Jz/b33/uxqe8lnM7BoNQykwrWpjOB8TGK94UQnJz64Hy/TERvOOdSPDNJSu2Rr o/yygHxXT14UmVO3hKa0QIqCtq1H60hseEnsfHF67+pnGQi1JG9WWWaNU9EXJIQHevdVbFP5ClAHZ NrefijYhZsmBbf+9Teq4WGjciY2LdkDIn1OfXuaJTvmcyytYqyfcDETQfd4Vm4bG+/85YAdsf7BUB 3o2eqvqlMKdZFE5nlvr9fqw+d/cooRMPU+J6Qb96/LZUV9DyuiUf2KWIMAS9J8Sl9O3I7QDTEY2eU LyzMTEpmJt0WmskGU7/g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1coE25-0000y9-TM; Wed, 15 Mar 2017 18:52:25 +0000 Received: from dougal.metanate.com ([90.155.101.14] helo=metanate.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1coE1s-0000ZM-JJ; Wed, 15 Mar 2017 18:52:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=+YdcctFzkJA4LS6/wGELfeeCg6aIp2LPlzpgYTXh468=; b=c8GcMNKN53xWY5hs5kKDY8yCiW4r9+DqHBUngwDM3jz060zsjyqHWwKrhEgI8jHMl2zy52jhN59WfxJhpD3/Xq3ecKMKY5CTWaeMOFrGHcfLA5oxMZtE04zouUHq2QizdZsufV1HE90DWGUCrHXD9w47J2I6AnNHIYO6/yHA10S8nJRGTCnnPQsHsCeSoiyvYxPvx8TtuF82nEE+ftibWUNnGOv/vTkW5M3ZRoduBVRmByPxXjP+cC65WnPpdgB4mTQoGqAjA2b0kNgRFYp0LdQr5/6iDfnLg5I3cxqQN3ittCjMVAnyWgReHu37Fm3l79nfRmjI9B3tNthvLBjRAA==; Received: from brian ([192.168.88.1] helo=localhost.localdomain) by shrek.metanate.com with esmtpsa (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.83_RC2) (envelope-from ) id 1coE1G-0005XY-8O; Wed, 15 Mar 2017 18:51:34 +0000 Date: Wed, 15 Mar 2017 18:51:33 +0000 From: John Keeping To: Heiko Stuebner Subject: [PATCH v2.1 1/4] pinctrl: rockchip: remove unnecessary locking Message-ID: <20170315185133.38ee57a4.john@metanate.com> In-Reply-To: <20170315174654.15128-2-john@metanate.com> References: <20170315174654.15128-1-john@metanate.com> <20170315174654.15128-2-john@metanate.com> Organization: Metanate Ltd X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170315_115212_923235_080DFFCA X-CRM114-Status: GOOD ( 11.08 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-gpio@vger.kernel.org, Linus Walleij , Julia Cartwright , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP regmap_update_bits does its own locking and everything else accessed here is a local variable so there is no need to lock around it. Signed-off-by: John Keeping Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner --- v2.1: - Remove RK2928 locking in rockchip_set_pull() v2: - Also remove locking in rockchip_set_schmitt() --- drivers/pinctrl/pinctrl-rockchip.c | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 1e276dfe1763..1d835370c2c7 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -652,7 +652,6 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) int iomux_num = (pin / 8); struct regmap *regmap; int reg, ret, mask, mux_type; - unsigned long flags; u8 bit; u32 data, rmask; @@ -701,15 +700,11 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux) if (ctrl->iomux_recalc && (mux_type & IOMUX_RECALCED)) ctrl->iomux_recalc(bank->bank_num, pin, ®, &bit, &mask); - spin_lock_irqsave(&bank->slock, flags); - data = (mask << (bit + 16)); rmask = data | (data >> 16); data |= (mux & mask) << bit; ret = regmap_update_bits(regmap, reg, rmask, data); - spin_unlock_irqrestore(&bank->slock, flags); - return ret; } @@ -1135,7 +1130,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, struct rockchip_pinctrl *info = bank->drvdata; struct rockchip_pin_ctrl *ctrl = info->ctrl; struct regmap *regmap; - unsigned long flags; int reg, ret, i; u32 data, rmask, rmask_bits, temp; u8 bit; @@ -1163,8 +1157,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, return ret; } - spin_lock_irqsave(&bank->slock, flags); - switch (drv_type) { case DRV_TYPE_IO_1V8_3V0_AUTO: case DRV_TYPE_IO_3V3_ONLY: @@ -1185,17 +1177,14 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, rmask = BIT(15) | BIT(31); data |= BIT(31); ret = regmap_update_bits(regmap, reg, rmask, data); - if (ret) { - spin_unlock_irqrestore(&bank->slock, flags); + if (ret) return ret; - } rmask = 0x3 | (0x3 << 16); temp |= (0x3 << 16); reg += 0x4; ret = regmap_update_bits(regmap, reg, rmask, temp); - spin_unlock_irqrestore(&bank->slock, flags); return ret; case 18 ... 21: /* setting fully enclosed in the second register */ @@ -1203,7 +1192,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, bit -= 16; break; default: - spin_unlock_irqrestore(&bank->slock, flags); dev_err(info->dev, "unsupported bit: %d for pinctrl drive type: %d\n", bit, drv_type); return -EINVAL; @@ -1215,7 +1203,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, rmask_bits = RK3288_DRV_BITS_PER_PIN; break; default: - spin_unlock_irqrestore(&bank->slock, flags); dev_err(info->dev, "unsupported pinctrl drive type: %d\n", drv_type); return -EINVAL; @@ -1227,7 +1214,6 @@ static int rockchip_set_drive_perpin(struct rockchip_pin_bank *bank, data |= (ret << bit); ret = regmap_update_bits(regmap, reg, rmask, data); - spin_unlock_irqrestore(&bank->slock, flags); return ret; } @@ -1294,7 +1280,6 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, struct rockchip_pin_ctrl *ctrl = info->ctrl; struct regmap *regmap; int reg, ret, i, pull_type; - unsigned long flags; u8 bit; u32 data, rmask; @@ -1309,14 +1294,10 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, switch (ctrl->type) { case RK2928: - spin_lock_irqsave(&bank->slock, flags); - data = BIT(bit + 16); if (pull == PIN_CONFIG_BIAS_DISABLE) data |= BIT(bit); ret = regmap_write(regmap, reg, data); - - spin_unlock_irqrestore(&bank->slock, flags); break; case RK1108: case RK3188: @@ -1339,16 +1320,12 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, return ret; } - spin_lock_irqsave(&bank->slock, flags); - /* enable the write to the equivalent lower bits */ data = ((1 << RK3188_PULL_BITS_PER_PIN) - 1) << (bit + 16); rmask = data | (data >> 16); data |= (ret << bit); ret = regmap_update_bits(regmap, reg, rmask, data); - - spin_unlock_irqrestore(&bank->slock, flags); break; default: dev_err(info->dev, "unsupported pinctrl type\n"); @@ -1408,7 +1385,6 @@ static int rockchip_set_schmitt(struct rockchip_pin_bank *bank, struct rockchip_pin_ctrl *ctrl = info->ctrl; struct regmap *regmap; int reg, ret; - unsigned long flags; u8 bit; u32 data, rmask; @@ -1419,16 +1395,11 @@ static int rockchip_set_schmitt(struct rockchip_pin_bank *bank, if (ret) return ret; - spin_lock_irqsave(&bank->slock, flags); - /* enable the write to the equivalent lower bits */ data = BIT(bit + 16) | (enable << bit); rmask = BIT(bit + 16) | BIT(bit); - ret = regmap_update_bits(regmap, reg, rmask, data); - spin_unlock_irqrestore(&bank->slock, flags); - - return ret; + return regmap_update_bits(regmap, reg, rmask, data); } /*