From patchwork Mon Jun 10 17:10:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 166342 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1272467ilk; Mon, 10 Jun 2019 10:12:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3YZT/o6QDu7BVRqRQOp2LRrby98jMFkQplpeRcDrvSKblam6XXXwCvtTeK/a3lrFLtsUS X-Received: by 2002:a63:570c:: with SMTP id l12mr16766556pgb.252.1560186726592; Mon, 10 Jun 2019 10:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560186726; cv=none; d=google.com; s=arc-20160816; b=ND3LIysS465C3lp8YEvrHuVQ4QvOST2hrHm7pNhps+8umODxJnwGW4XmS7OD/E1mog WtNojWXdFXplGXsRFOcZ7+dqxPDV12A6FFJ57FZGqtT7B1VAXr809n7KSmdW9vM85P0Z rz6xqiitXqYBL300Xde/zNFBOdIVeF0u1X1DsyRQL1auyBdGpWEZ/zi108Kv+R3KdQYp ZXvq4ufU7D1jstthVu86gFCGpN6evpMWxROAFLjHrN4TMFA+Co3hGdZ8kC/qKZUlfT+q SrpQ7pgE3aENmNwASLdQcZ/tPjR7Z22njcjmZTAlXp+ucp31O8OWTByX0q/N7+wt4XHz xIpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=5bloGzVqTd/4YnCS64tBw8jwXGnghbwGp6k4yGdxJeA=; b=Dtxq9vX24PhJdd+wuWNzHDs11/s2mNFVaLWiN6pS4zfXhX4Klk+SxbAHJCIqg+3zJm dgJIpIvEuppaV/YPqMROppjUHcyGaMz//Pikzbgb1vI7HgnTLwDFV0HnAfdX/ECxJIVE 9vyXczM+Die4vM6gzAF6fBlki+kTbMtQNeO/1TLrz18oVHyBe+ta3nPxoiuNLje+7kQB vxXzmW6qt6/AaR8nKXFtGxf+GD9Q47bpbIoubi7GDHwKCLJ+TM6tmrhOeZmJotHF6pBS qxo3hmwH6fuunqaNAhk2A8wq+VyuhCCbyJRfeSGC8oWuSSpvZPW4jW3JcqNOmu1UDivc PCPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=w8e0dO06; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si3612749pgn.550.2019.06.10.10.12.06; Mon, 10 Jun 2019 10:12:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=w8e0dO06; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388119AbfFJRMF (ORCPT + 5 others); Mon, 10 Jun 2019 13:12:05 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:57646 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387415AbfFJRMF (ORCPT ); Mon, 10 Jun 2019 13:12:05 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5AHBx7q056908; Mon, 10 Jun 2019 12:11:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1560186719; bh=5bloGzVqTd/4YnCS64tBw8jwXGnghbwGp6k4yGdxJeA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=w8e0dO06BkOe0ffohVsy1LgFdYaLupvdHH20O2w8M/IUtaS8w66zYKf/mlSTyxrlQ nSBSw5GIv2gnEE5ZfdaN4v+GhxUCjy1s+Yiv0N6HevoCpoQpLeG1d05p2K3mgTR8sz fecc+O2FIzMUYiQq0vuttv+24ah/71fTaKxMdRS8= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5AHBxaQ080097 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 12:11:59 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 10 Jun 2019 12:11:58 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 10 Jun 2019 12:11:58 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5AHBvja038748; Mon, 10 Jun 2019 12:11:58 -0500 From: Grygorii Strashko To: Russell King , Linus Walleij , Tony Lindgren CC: Bartosz Golaszewski , , , , Santosh Shilimkar , Russell King , Grygorii Strashko Subject: [PATCH-next 07/20] gpio: gpio-omap: simplify omap_gpio_get_direction() Date: Mon, 10 Jun 2019 20:10:50 +0300 Message-ID: <20190610171103.30903-8-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190610171103.30903-1-grygorii.strashko@ti.com> References: <20190610171103.30903-1-grygorii.strashko@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Russell King Architectures are single-copy atomic, which means that simply reading a register is an inherently atomic operation. There is no need to take a spinlock here. Signed-off-by: Russell King Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-omap.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index cc320d09d074..44a4287cce9e 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -953,17 +953,10 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) static int omap_gpio_get_direction(struct gpio_chip *chip, unsigned offset) { - struct gpio_bank *bank; - unsigned long flags; - void __iomem *reg; - int dir; + struct gpio_bank *bank = gpiochip_get_data(chip); - bank = gpiochip_get_data(chip); - reg = bank->base + bank->regs->direction; - raw_spin_lock_irqsave(&bank->lock, flags); - dir = !!(readl_relaxed(reg) & BIT(offset)); - raw_spin_unlock_irqrestore(&bank->lock, flags); - return dir; + return !!(readl_relaxed(bank->base + bank->regs->direction) & + BIT(offset)); } static int omap_gpio_input(struct gpio_chip *chip, unsigned offset)