From patchwork Mon Jun 10 17:10:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 166338 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1272031ilk; Mon, 10 Jun 2019 10:11:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUmXfQxs+0O8wC/K4v5yaS9tgNQaZU61NDLaHbzDjU4tS3Yk3y3TnjFiBYo41qrf+b1ZGZ X-Received: by 2002:a17:902:9a84:: with SMTP id w4mr72250352plp.241.1560186700640; Mon, 10 Jun 2019 10:11:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560186700; cv=none; d=google.com; s=arc-20160816; b=ArMErUI8F2Y1pPSG2QKbsokVCM7piO4GZ/+Vn8MHiR5G9Qs65OZ1TkBsILDTvztCmv 5BhsPdx4WatMhWguQ1Fl9rBluxRd6OCGZDBrto6b1vI+cj07SkEWp5RV8vbZZ/HTEcT3 l2MMIhAhIqa+0RYZkF9GcQhNtWX0PyMLbS2dlrpuYlgBZX2v+3WiXdi9u16Sj0abgR2r HMImbgqCMWUL2G7XlZMYWcGkhWqq5GAde9WRZZiwWxBvA01Jp7loH87U3V9MCZOJ8usl sVWe4bFsb0N3z/2v8eCgFiTR3AQUOXyTTzTXdIL0PFKZC6+AaPw8dQ+5F7u+O0w54S5E U25w== 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=WNL2UJTUUU6SRtjGfZDQQT6BCUW7ZKQ0up9DfYalQrQ=; b=s1lxQoccgjA48caHh7VNCjQDWlxDIZmkwmOwOzN041iqEFqdOsD8XSrE97Zq/twf2v GFh2uNjjRNggAteGrPAOTcpihQwSNpySjYJfGegepqGyC/AEn/aoACRDsR3xR7xWyIz8 2dkk6z6dKvTOFjL40+JsI6q2hpBPNIogBU1k/+2BuqjDSqUUz3RxzpGwPy9ZaAoF5DVk Ae3bV0K7ND43OnsqtuVpH/4qALOkjYP7DUKyAU0GGjjL185aK9Qtzef3erf7gDnCte+o OOQoG9R5qkLnPEOr8ySY8qGQmFVZsv+g3bOryqhZIAy+Us7zCj52Dn89msQSutyyolVi c1jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=eOXivUP5; 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 ay3si9766370plb.298.2019.06.10.10.11.40; Mon, 10 Jun 2019 10:11:40 -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=eOXivUP5; 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 S2387923AbfFJRLj (ORCPT + 5 others); Mon, 10 Jun 2019 13:11:39 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:47274 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387415AbfFJRLj (ORCPT ); Mon, 10 Jun 2019 13:11:39 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5AHBWdk069004; Mon, 10 Jun 2019 12:11:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1560186692; bh=WNL2UJTUUU6SRtjGfZDQQT6BCUW7ZKQ0up9DfYalQrQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=eOXivUP5JFRoF9lmxBpqUtLUkDwr2f+12z1wTyqHIA8KybZJ54m1wXTmtQZyawtU4 /ptB6skik/2qEEw8lclyxvcFnvBQVeVAHgYAc8DxqaB7BQFSHJ1W5Ai3ZN46M3iIC+ g+esuqP6XtHjWdK4+dGdcpi0YMk31HrIbXU1Og4k= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5AHBWlr079763 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 12:11:32 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE114.ent.ti.com (157.170.170.25) 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:31 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE115.ent.ti.com (157.170.170.26) 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:31 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5AHBVlC066255; Mon, 10 Jun 2019 12:11:31 -0500 From: Grygorii Strashko To: Russell King , Linus Walleij , Tony Lindgren CC: Bartosz Golaszewski , , , , Santosh Shilimkar , Russell King , Grygorii Strashko Subject: [PATCH-next 03/20] gpio: gpio-omap: remove remainder of list management Date: Mon, 10 Jun 2019 20:10:46 +0300 Message-ID: <20190610171103.30903-4-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 Commit c4791bc6e3a6 ("gpio: omap: drop omap_gpio_list") removed the list head and addition to the list head of each gpio bank, but failed to remove the list_del() call and the node inside struct gpio_bank. Remove these too. Fixes: c4791bc6e3a6 ("gpio: omap: drop omap_gpio_list") Signed-off-by: Russell King Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-omap.c | 2 -- 1 file changed, 2 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 44b214e5cefb..708a135e2f0c 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -47,7 +47,6 @@ struct gpio_regs { }; struct gpio_bank { - struct list_head node; void __iomem *base; int irq; u32 non_wakeup_gpios; @@ -1641,7 +1640,6 @@ static int omap_gpio_remove(struct platform_device *pdev) struct gpio_bank *bank = platform_get_drvdata(pdev); cpu_pm_unregister_notifier(&bank->nb); - list_del(&bank->node); gpiochip_remove(&bank->chip); pm_runtime_disable(&pdev->dev); if (bank->dbck_flag) From patchwork Mon Jun 10 17:10:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 166339 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1272131ilk; Mon, 10 Jun 2019 10:11:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbsiHR4RpWevfn4wptTEdhG4TwzK00tOw5i2NNwuZeSyR4oy3Y5mOh+ccypCq4VcUd0I+S X-Received: by 2002:a65:44c8:: with SMTP id g8mr16411301pgs.443.1560186705764; Mon, 10 Jun 2019 10:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560186705; cv=none; d=google.com; s=arc-20160816; b=XlIwxwiW6hO6+nNe/l5uo+rPJaEsinMz5RcWn9OlhtdXQYqK3x9eBoXjFvEOvzN2tw Wv/OHjMQgIETZkF4jupBkoiJPaQIZZg/RZ9ChuiGqAkxKbRG+C5st2cg10tObLbwUJib HVbWUJmhu2nQOkmByjisgQZgYNufaW3QufEEqkrx6gCm5/rJBf4Qh/yMAwucbFdyD0Z9 IC7KfVAwI8EVbS+8OJI36SZ9MaRnAi/EG7WJxRi5iH5PS9XpLlUgNNtoIEYGgwCOdbha LfhBqfLCxDnkVu85R/omZH4noOWnCeuj7s2YDuxMypHGejKFDoD0oEdIafk4Mus7DeXj /Avw== 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=tu/SUu2V3efavxkNRHESxd84IC8q2p3Gcgu5d5DU25I=; b=MTeqGYQ5RZF1RhzszO8ZW3YhkBBwQvFTvQz2cu7P2VhJxkp2HjohBrVOGuJ/zlF9CD 9KGMfJW8XuwzBzjlegelLtC5diO6xTF9834k/FaaZcpukLkGOt0no69zaIeD64Gr7tId w+6Sfsbm8D+4IIGF88lW2wpkLRpXCDCFhDMYoEECZ9QdsutgkKEFadkoJKgH8bvQzJQZ xjk7X00+psZu0i8+St044mK8N6A5NjvgbaNYrwFrxLW8pOUN9IVA4y50B8axc7HW7JCD sPjz3I3rX2QKqrVRrDIXBf+4Q4tdk6AOFIfwllElzZSVK/JC1YMsOxSIQib+X7OVSldt cEAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=GI378v7w; 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 r185si9932792pgr.10.2019.06.10.10.11.45; Mon, 10 Jun 2019 10:11:45 -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=GI378v7w; 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 S2387986AbfFJRLp (ORCPT + 5 others); Mon, 10 Jun 2019 13:11:45 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:44286 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387415AbfFJRLo (ORCPT ); Mon, 10 Jun 2019 13:11:44 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5AHBd7L121407; Mon, 10 Jun 2019 12:11:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1560186699; bh=tu/SUu2V3efavxkNRHESxd84IC8q2p3Gcgu5d5DU25I=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=GI378v7wpKOtFuPuyuqv9VJaKZ7pZOD/cEOgUDCEOeW83/5mDgpftc5Y1ZRJUG0RW vcMxQWDv10jTM4JpAGCj6A3yzddTmFJ13KfY/RX27XxELxf0fKu8kjrzcvUxb67k2a xunkxf2yskJt0nmx/fECidoA3C9TznS6ocC8eDW8= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5AHBdff045001 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 12:11:39 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE108.ent.ti.com (157.170.170.38) 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:38 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE113.ent.ti.com (157.170.170.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:38 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5AHBbFk050644; Mon, 10 Jun 2019 12:11:38 -0500 From: Grygorii Strashko To: Russell King , Linus Walleij , Tony Lindgren CC: Bartosz Golaszewski , , , , Santosh Shilimkar , Russell King , Grygorii Strashko Subject: [PATCH-next 04/20] gpio: gpio-omap: clean up edge interrupt handling Date: Mon, 10 Jun 2019 20:10:47 +0300 Message-ID: <20190610171103.30903-5-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 The edge interrupt handling was effectively: isr = ISR_reg & enabled; if (bank->level_mask) level_mask = bank->level_mask & enabled; else level_mask = 0; edge = isr & ~level_mask; When bank->level_mask is zero, level_mask will be computed as zero anyway, so the if() statement is redundant. We are then left with: isr = ISR_reg & enabled; level_mask = bank->level_mask & enabled; edge = isr & ~level_mask; This can be simplified further to: isr = ISR_reg & enabled; edge = isr & ~bank->level_mask; since the second mask with 'enabled' is redundant. Improve the associated comment as well. Signed-off-by: Russell King Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-omap.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 708a135e2f0c..01da1c17bb20 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -733,7 +733,7 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank) { void __iomem *isr_reg = NULL; - u32 enabled, isr, level_mask; + u32 enabled, isr, edge; unsigned int bit; struct gpio_bank *bank = gpiobank; unsigned long wa_lock_flags; @@ -753,16 +753,14 @@ static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank) enabled = omap_get_gpio_irqbank_mask(bank); isr = readl_relaxed(isr_reg) & enabled; - if (bank->level_mask) - level_mask = bank->level_mask & enabled; - else - level_mask = 0; - - /* clear edge sensitive interrupts before handler(s) are - called so that we don't miss any interrupt occurred while - executing them */ - if (isr & ~level_mask) - omap_clear_gpio_irqbank(bank, isr & ~level_mask); + /* + * Clear edge sensitive interrupts before calling handler(s) + * so subsequent edge transitions are not missed while the + * handlers are running. + */ + edge = isr & ~bank->level_mask; + if (edge) + omap_clear_gpio_irqbank(bank, edge); raw_spin_unlock_irqrestore(&bank->lock, lock_flags); From patchwork Mon Jun 10 17:10:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 166341 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1272410ilk; Mon, 10 Jun 2019 10:12:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjJpkLQbQ8af/GL0oZoC/C61wmIt4LYBmWkxp/swTDGa8s5S3TGMPf99MxlBtZbKL6Cmfn X-Received: by 2002:a17:902:42a5:: with SMTP id h34mr33983826pld.16.1560186723380; Mon, 10 Jun 2019 10:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560186723; cv=none; d=google.com; s=arc-20160816; b=vno4apvnZFN4+h1cTUr2K2Jc551D0Eam1O6kDpVI4+sMUWHIt0U8tV2GcnpT5EpBe8 fg2UQ9klSJY8o/Qoy4AHum/NRZlrjPdQc1Rzk75HwHmwIEEMJCvbeeVXAZ/JAKYoOovc G6ZGbIb32GehAS5/ZoBywJnJABbm0Cp3enyu34Qjqpt5CxhMARlgcWe2mGz14UnZBk5D BFnmrolZrojDGzPJisS8GrwSSwI4wm2EQ07rj0A/o57AHps0e5UO/p/2I1NX3+K1uWPz EBzK4BrrgXfpNj3Yx5iOJBflZHKc0Ede0bSSUnE7UUg5MGFXFAf7VNCOOWAv+sgw59nn gmyA== 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=TuqR0tjSyc/vB0nQFmM5342CE4L+35tfFSIcGQDFXP0=; b=uTGenr3pGXLa4FkxPmnqHBpDlUHJGRJjPk1lbWqifq9Ic2KrPDOf9BwtoUQFhzNj7T NaMjumz9rnnFSaHC1vPX1Tnk3X7VIR3qYBzyCojK83HCvNwwEJgLyI0jddxsu/9DmUjG Ka/Zhbr4pthpzQzZ8Olu3SA6hWYM+s2daXwAJcnJ3yIywraqIT6/E8TP6uZwljG8xzfh 8ZJ9NEs+pdng7dCdIXGlrmv9SHL1k9llx0/N9lrnYwLoqJPE4mrlshFGGjpjiX6+SXW0 A2rDf4chdj6z0jrqNjzMN+C5A5JxegWOzY0XpRJcKfeKANL9zy201g70kDtTmqQqRwC9 DSNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=DRH4bVZ9; 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.03; Mon, 10 Jun 2019 10:12:03 -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=DRH4bVZ9; 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 S2388030AbfFJRMC (ORCPT + 5 others); Mon, 10 Jun 2019 13:12:02 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:57636 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387415AbfFJRMC (ORCPT ); Mon, 10 Jun 2019 13:12:02 -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 x5AHBqo2056883; Mon, 10 Jun 2019 12:11:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1560186712; bh=TuqR0tjSyc/vB0nQFmM5342CE4L+35tfFSIcGQDFXP0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=DRH4bVZ9Aw4fFz5aVpWB4UlsxLjXZR31ID074DlsKiWZ6rFRcdhzW7mPtdx32+9Ya YgvwcaH1EUcjKm5iSbg2JzL9wNraq/Ne+ZdsDMwelG4mHftlJE5tjyhKiXQWt72Exo zeCpJiURxx0RkEWhmQnPlJdGY/fRxniRpQSc/N1k= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5AHBqbb079970 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 12:11:52 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE112.ent.ti.com (157.170.170.23) 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:52 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE107.ent.ti.com (157.170.170.37) 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:52 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5AHBpx1050793; Mon, 10 Jun 2019 12:11:51 -0500 From: Grygorii Strashko To: Russell King , Linus Walleij , Tony Lindgren CC: Bartosz Golaszewski , , , , Santosh Shilimkar , Russell King , Grygorii Strashko Subject: [PATCH-next 06/20] gpio: gpio-omap: move omap_gpio_request() and omap_gpio_free() Date: Mon, 10 Jun 2019 20:10:49 +0300 Message-ID: <20190610171103.30903-7-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 Move these two functions to live beside the rest of the gpio chip implementation, rather than in the middle of the irq chip implementation. Signed-off-by: Russell King Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-omap.c | 64 ++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 32 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 04e3da55e39c..cc320d09d074 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -689,38 +689,6 @@ static int omap_gpio_wake_enable(struct irq_data *d, unsigned int enable) return irq_set_irq_wake(bank->irq, enable); } -static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) -{ - struct gpio_bank *bank = gpiochip_get_data(chip); - unsigned long flags; - - pm_runtime_get_sync(chip->parent); - - raw_spin_lock_irqsave(&bank->lock, flags); - omap_enable_gpio_module(bank, offset); - bank->mod_usage |= BIT(offset); - raw_spin_unlock_irqrestore(&bank->lock, flags); - - return 0; -} - -static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) -{ - struct gpio_bank *bank = gpiochip_get_data(chip); - unsigned long flags; - - raw_spin_lock_irqsave(&bank->lock, flags); - bank->mod_usage &= ~(BIT(offset)); - if (!LINE_USED(bank->irq_usage, offset)) { - omap_set_gpio_direction(bank, offset, 1); - omap_clear_gpio_debounce(bank, offset); - } - omap_disable_gpio_module(bank, offset); - raw_spin_unlock_irqrestore(&bank->lock, flags); - - pm_runtime_put(chip->parent); -} - /* * We need to unmask the GPIO bank interrupt as soon as possible to * avoid missing GPIO interrupts for other lines in the bank. @@ -951,6 +919,38 @@ static inline void omap_mpuio_init(struct gpio_bank *bank) /*---------------------------------------------------------------------*/ +static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) +{ + struct gpio_bank *bank = gpiochip_get_data(chip); + unsigned long flags; + + pm_runtime_get_sync(chip->parent); + + raw_spin_lock_irqsave(&bank->lock, flags); + omap_enable_gpio_module(bank, offset); + bank->mod_usage |= BIT(offset); + raw_spin_unlock_irqrestore(&bank->lock, flags); + + return 0; +} + +static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) +{ + struct gpio_bank *bank = gpiochip_get_data(chip); + unsigned long flags; + + raw_spin_lock_irqsave(&bank->lock, flags); + bank->mod_usage &= ~(BIT(offset)); + if (!LINE_USED(bank->irq_usage, offset)) { + omap_set_gpio_direction(bank, offset, 1); + omap_clear_gpio_debounce(bank, offset); + } + omap_disable_gpio_module(bank, offset); + raw_spin_unlock_irqrestore(&bank->lock, flags); + + pm_runtime_put(chip->parent); +} + static int omap_gpio_get_direction(struct gpio_chip *chip, unsigned offset) { struct gpio_bank *bank; 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) From patchwork Mon Jun 10 17:10:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 166344 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1272854ilk; Mon, 10 Jun 2019 10:12:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFgmWBMHNFapXa6BZbYF+dZvfuZvPsM3X6A2pXDgyxPmab94sofFN7vD9yQ+LgdPn0qM0x X-Received: by 2002:a17:90a:216c:: with SMTP id a99mr21403298pje.3.1560186747113; Mon, 10 Jun 2019 10:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560186747; cv=none; d=google.com; s=arc-20160816; b=d7MCOxOo2DnJduK96QYg75+Tzc4XzST1f0km5qnWtDxdR+VaOHW9cxIQEEF70ogdGH j/WKbiEfZLNI6D82gWCfKfvqpGLyE3PK2BGGJdwR9aNUm4u/7OzjiVBzaRbHMIMQerCw Yt/BLuoKFaYcFWIhJnYovjtEmQyJA/vylLstwOsfBhzNP+MamMh8XNpjcCFTyye40iOS 9sbd938Qww5PzJ2DP66trks3qhloPolfJ+hr2VTuHIkYp90CkL94VYBvUGmLLb4BTLY8 Y4Vj+2X8mIFTlnjeasQlnDcXtdNXGMke+jgis1jv0JjaFAVj/e4gHfOgLxS6zxpMtMBp K4Lw== 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=cIdme23WQcOOfsiyIH4tk+2i2ShkvU9NXxOhEA9MTjU=; b=Z0PSInZKDjYY+qxF984FmDTurArMQNTjuyCOOmK3g4HFG7cHOirVUc61slxgdsQVKa wTQoCC4rhlqVHLpFTq5dn+XALgNk79Bm2OQfotOgIJlC+JLJ2kvLk6XhGs3xR2TU1lWX jc06VtJzl3oJGcP+rCmFC9j/Zg2aAKEfaamT8NRjINT/eXIMbZK4FdCg2Pi4Ltpl4S8X QVITHpaTF4q+elITmrLy9V/DTk1QcaORXgNUNm4NsSGZRBAHTW3sqHQoaj68y1LQFy76 mjvRHjngH9JP7dbUybrASMgpocVqKfV2AQ7yqCy0aHe36mhw4Xwre33c5Rj38EbXi6OA 6CEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=bb79OS+Z; 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 a17si21913pjq.31.2019.06.10.10.12.26; Mon, 10 Jun 2019 10:12:27 -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=bb79OS+Z; 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 S2388254AbfFJRM0 (ORCPT + 5 others); Mon, 10 Jun 2019 13:12:26 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:44440 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388217AbfFJRMZ (ORCPT ); Mon, 10 Jun 2019 13:12:25 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5AHCJNS121561; Mon, 10 Jun 2019 12:12:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1560186739; bh=cIdme23WQcOOfsiyIH4tk+2i2ShkvU9NXxOhEA9MTjU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=bb79OS+ZyaXmWfw8J0sZ/ISy3xgxY1eMrYNNQqVCtdBp51Jrj8X98IFYdip9H/7fN w+Ep14xeECiVG5eVQ4rHhm4nf2oGeYaFadFGWjb8+sm7ZA6Can3Ng5RJhjfQVTDkFK UTtvbue0G9xHquKXXCFIedHLBan+zTEO4SvzeBrE= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5AHCJIM080627 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 12:12:19 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE109.ent.ti.com (10.64.6.30) 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:12:18 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE102.ent.ti.com (10.64.6.23) 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:12:18 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5AHCIpU067517; Mon, 10 Jun 2019 12:12:18 -0500 From: Grygorii Strashko To: Russell King , Linus Walleij , Tony Lindgren CC: Bartosz Golaszewski , , , , Santosh Shilimkar , Russell King , Grygorii Strashko Subject: [PATCH-next 10/20] gpio: gpio-omap: simplify set_multiple() Date: Mon, 10 Jun 2019 20:10:53 +0300 Message-ID: <20190610171103.30903-11-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 One of the reasons for set_multiple() to exist is to allow multiple GPIOs on the same chip to be changed simultaneously - see commit 5f42424354f5 ("gpiolib: allow simultaneous setting of multiple GPIO outputs"): - Simultaneous glitch-free setting of multiple pins on any kind of parallel bus attached to GPIOs provided they all reside on the same chip and bank. In order for this to work, we should not use the atomic set/clear registers, but instead read-modify-write the dataout register. We already take the spinlock to ensure that happens atomically, so move the code into the set_multiple() function and kill the two helper functions. Signed-off-by: Russell King Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-omap.c | 45 +++++++--------------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index a26decc5c611..8fdac6e4a929 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -74,8 +74,6 @@ struct gpio_bank { int context_loss_count; void (*set_dataout)(struct gpio_bank *bank, unsigned gpio, int enable); - void (*set_dataout_multiple)(struct gpio_bank *bank, - unsigned long *mask, unsigned long *bits); int (*get_context_loss_count)(struct device *dev); struct omap_gpio_reg_offs *regs; @@ -146,35 +144,6 @@ static void omap_set_gpio_dataout_mask(struct gpio_bank *bank, unsigned offset, bank->context.dataout = l; } -/* set multiple data out values using dedicate set/clear register */ -static void omap_set_gpio_dataout_reg_multiple(struct gpio_bank *bank, - unsigned long *mask, - unsigned long *bits) -{ - void __iomem *reg = bank->base; - u32 l; - - l = *bits & *mask; - writel_relaxed(l, reg + bank->regs->set_dataout); - bank->context.dataout |= l; - - l = ~*bits & *mask; - writel_relaxed(l, reg + bank->regs->clr_dataout); - bank->context.dataout &= ~l; -} - -/* set multiple data out values using mask register */ -static void omap_set_gpio_dataout_mask_multiple(struct gpio_bank *bank, - unsigned long *mask, - unsigned long *bits) -{ - void __iomem *reg = bank->base + bank->regs->dataout; - u32 l = (readl_relaxed(reg) & ~*mask) | (*bits & *mask); - - writel_relaxed(l, reg); - bank->context.dataout = l; -} - static inline void omap_gpio_rmw(void __iomem *base, u32 reg, u32 mask, bool set) { int l = readl_relaxed(base + reg); @@ -1037,10 +1006,14 @@ static void omap_gpio_set_multiple(struct gpio_chip *chip, unsigned long *mask, unsigned long *bits) { struct gpio_bank *bank = gpiochip_get_data(chip); + void __iomem *reg = bank->base + bank->regs->dataout; unsigned long flags; + u32 l; raw_spin_lock_irqsave(&bank->lock, flags); - bank->set_dataout_multiple(bank, mask, bits); + l = (readl_relaxed(reg) & ~*mask) | (*bits & *mask); + writel_relaxed(l, reg); + bank->context.dataout = l; raw_spin_unlock_irqrestore(&bank->lock, flags); } @@ -1530,14 +1503,10 @@ static int omap_gpio_probe(struct platform_device *pdev) pdata->get_context_loss_count; } - if (bank->regs->set_dataout && bank->regs->clr_dataout) { + if (bank->regs->set_dataout && bank->regs->clr_dataout) bank->set_dataout = omap_set_gpio_dataout_reg; - bank->set_dataout_multiple = omap_set_gpio_dataout_reg_multiple; - } else { + else bank->set_dataout = omap_set_gpio_dataout_mask; - bank->set_dataout_multiple = - omap_set_gpio_dataout_mask_multiple; - } raw_spin_lock_init(&bank->lock); raw_spin_lock_init(&bank->wa_lock); From patchwork Mon Jun 10 17:10:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 166353 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1273963ilk; Mon, 10 Jun 2019 10:13:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlluCRVFlVk4ZEhqB+oww1y2+qHi4Whs4PdreG7rhAUNrApShLf5OQRXYMKNLe1/PTf1k6 X-Received: by 2002:a62:6d47:: with SMTP id i68mr76405789pfc.189.1560186800761; Mon, 10 Jun 2019 10:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560186800; cv=none; d=google.com; s=arc-20160816; b=I1qshznbEJ1geCv3iOuPtdcYNI2TiajcQqjm57AFP2y12y3cplOw1Z+U4qOL3sLc3W kP65FX+Ez4xoj0UNh1YvCdvtqBX3R7CacHPdrx88jlnEhGkHekvjtLFE9pSVXGteX+cv bucAoyHdB/dn9uXYvm32Awfwba/BJ2EgDV7At1diB+E48JQ+SFQnAlS0eH0UHQFEbcit uCsxdRP9vjCzV0pwgiUTNSxZekbHPOHpjMTdIoCz8Og6ygyDeknm/yCiA/VkHw2Sd0+W 66QWW2e1xIqx6s5QyqhaST+GFqgHJ5cEuZCfWzzYikHTDOQ0qIz05L4ardSB/tChzOkv Ww8w== 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=Z575S9olDMLpCethO+TC+EKmcyRYsczz36ohGuMtYWo=; b=djvKxNteNG7EYOeXhqPR5H1BNk10Td1Xwcxwq2fLSfC0yWu+dFWtXFW/eFBOUJHYZa JcSAkt6Lm7cQJro9UWUk/tC+SEWo8e047aUs3yAmmaax7GXAgggBKx1NIy6rm6ju71IA rrphYP9Yx5hDyN63Db9ZRixNrBXx0HA6mAiT+FDs/113ogEa1vyA54xaDjnuAzoXz+7F aAUApFkQFc8lCuB7zeX9cvq9LsLmucHR4yuN+MiU2znTz2ds03pBi1pKtd5SlwOLHN67 v1+/yfcRYpF3RjwOFzYp+dR1KrE2vdospaUnkj7MvOfbvm0stVKn9ul2UcY5UIkfOvNL vMXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ougQjhc6; 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 cj14si10503411plb.141.2019.06.10.10.13.20; Mon, 10 Jun 2019 10:13:20 -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=ougQjhc6; 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 S1727997AbfFJRNT (ORCPT + 5 others); Mon, 10 Jun 2019 13:13:19 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:57844 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387495AbfFJRND (ORCPT ); Mon, 10 Jun 2019 13:13:03 -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 x5AHCsIm057127; Mon, 10 Jun 2019 12:12:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1560186774; bh=Z575S9olDMLpCethO+TC+EKmcyRYsczz36ohGuMtYWo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ougQjhc6T67WEzIZlZZqImuxlPpVxQC9c+I8XPjBXo42XdIx2RNjz6fKfP2Qr1P0f 6IhaW4dM4Kru1NTvvatIZyCzUoBPW/9EL7O4fw+b6dFYohNpKUkWCdrGT61JZd4i8b fBgfZ3u/udVxshTjiMwtCEmcevro1FQ05Z+T0v4A= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5AHCsQS081099 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 12:12:54 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE108.ent.ti.com (157.170.170.38) 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:12:54 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE104.ent.ti.com (157.170.170.34) 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:12:54 -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 x5AHCr5F039807; Mon, 10 Jun 2019 12:12:53 -0500 From: Grygorii Strashko To: Russell King , Linus Walleij , Tony Lindgren CC: Bartosz Golaszewski , , , , Santosh Shilimkar , Russell King , Grygorii Strashko Subject: [PATCH-next 16/20] gpio: gpio-omap: clean up omap_gpio_restore_context() Date: Mon, 10 Jun 2019 20:10:59 +0300 Message-ID: <20190610171103.30903-17-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 Use local variables to store the base iomem address and regs table pointer like omap_gpio_init_context() does. Not only does this make the function neater, it also avoids unnecessary reloads of the same data multiple times. Signed-off-by: Russell King Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-omap.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c24a91b2df97..1c5fa12bcf9f 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1094,32 +1094,26 @@ static void omap_gpio_init_context(struct gpio_bank *p) static void omap_gpio_restore_context(struct gpio_bank *bank) { - writel_relaxed(bank->context.wake_en, - bank->base + bank->regs->wkup_en); - writel_relaxed(bank->context.ctrl, bank->base + bank->regs->ctrl); - writel_relaxed(bank->context.leveldetect0, - bank->base + bank->regs->leveldetect0); - writel_relaxed(bank->context.leveldetect1, - bank->base + bank->regs->leveldetect1); - writel_relaxed(bank->context.risingdetect, - bank->base + bank->regs->risingdetect); - writel_relaxed(bank->context.fallingdetect, - bank->base + bank->regs->fallingdetect); - writel_relaxed(bank->context.dataout, - bank->base + bank->regs->dataout); - writel_relaxed(bank->context.oe, bank->base + bank->regs->direction); + struct omap_gpio_reg_offs *regs = bank->regs; + void __iomem *base = bank->base; + + writel_relaxed(bank->context.wake_en, base + regs->wkup_en); + writel_relaxed(bank->context.ctrl, base + regs->ctrl); + writel_relaxed(bank->context.leveldetect0, base + regs->leveldetect0); + writel_relaxed(bank->context.leveldetect1, base + regs->leveldetect1); + writel_relaxed(bank->context.risingdetect, base + regs->risingdetect); + writel_relaxed(bank->context.fallingdetect, base + regs->fallingdetect); + writel_relaxed(bank->context.dataout, base + regs->dataout); + writel_relaxed(bank->context.oe, base + regs->direction); if (bank->dbck_enable_mask) { - writel_relaxed(bank->context.debounce, bank->base + - bank->regs->debounce); + writel_relaxed(bank->context.debounce, base + regs->debounce); writel_relaxed(bank->context.debounce_en, - bank->base + bank->regs->debounce_en); + base + regs->debounce_en); } - writel_relaxed(bank->context.irqenable1, - bank->base + bank->regs->irqenable); - writel_relaxed(bank->context.irqenable2, - bank->base + bank->regs->irqenable2); + writel_relaxed(bank->context.irqenable1, base + regs->irqenable); + writel_relaxed(bank->context.irqenable2, base + regs->irqenable2); } static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context) From patchwork Mon Jun 10 17:11:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 166354 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1273983ilk; Mon, 10 Jun 2019 10:13:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqymm7jbxQmbQNzCmrkXTaEMKmtGsSOBE9KBKjYmXsN3hWt5igZbeuK2Xm14/pGLwrZSK0vt X-Received: by 2002:a17:90a:ca11:: with SMTP id x17mr17047736pjt.107.1560186801717; Mon, 10 Jun 2019 10:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560186801; cv=none; d=google.com; s=arc-20160816; b=Pi2Z8d+HPeOLO0OeYWNkqcYRw8Y5aQOCqL+6wt7Y+xnlxo76MVbm0l51iFyx/+bYJj mcl+YRNNTVOTFrebaD3X2RL/dxUK3F55xJ8skiBASqoW3vf20zwHauacs3Enct8yCSlW i/OQLEkcWFkcwazXOyx0edHdwd9PTX37EKAGnFqIhsI3bLqX21TYku5pC7D3RVzELjwP g5vNA2FaaWslHg1xGWlHZHn7lnsitr5R689M9E5f66PH+GTkGqUOYtgULVvVFTolYtJe BC+0TWtJGEyXf7o+nAqtn3rlvATPQkCTWKrWlWxvZ2rqzpF2RioNZarmlvatzIh3Xkod ptZg== 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=SNBUl0AgT9mDHDFh2idiGb/Cxs8x27UMIHDIZ9dVyA0=; b=z2UMDGWZIR/dEG/9n55hXpxykDAqHO15k3V7kIvWxNhcSthSiqcjBkGrXCetY0OPOE UlG7Sj7Qx3y9oFGhzgYzOI1mp9Q2hJAyAM4uLPEYN3aMqBgeLizKzt+Ikr+F6TU6gE9S IDYqXBMgcnJ4fBaWnw2nUE/or22w7uvfW71T59SS0gfgC7WUfOHxd1AEuNlag9ZuzaG4 N2SQIALKeTWRSXNFFPRQvftoZ958rYyP9v0MN3ZhSP/gAPYh/gKLlShl3D2HY9tx/j/R Hf5Q6CPRBHPHTtWrpcnzQiEPYj3crSOuN3yLcSOpW7+Y9olaFViYMMSZ0DjMlscng8zr 1WDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="bk/jLN7J"; 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 cj14si10503411plb.141.2019.06.10.10.13.21; Mon, 10 Jun 2019 10:13:21 -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="bk/jLN7J"; 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 S1728584AbfFJRNV (ORCPT + 5 others); Mon, 10 Jun 2019 13:13:21 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:44604 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728549AbfFJRNU (ORCPT ); Mon, 10 Jun 2019 13:13:20 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5AHDBKD121923; Mon, 10 Jun 2019 12:13:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1560186791; bh=SNBUl0AgT9mDHDFh2idiGb/Cxs8x27UMIHDIZ9dVyA0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=bk/jLN7JU0Xwhpv1oxdpoIqxrYHN0mmIkWOUuyHSkPnX7Iy0b/CX2pdRKgdZJlo9X iUOG/vnrJTs8sX/Sh+CH9BAWQVbHcmbFOFQ8+9FkkKMogcmkmr29K/cZ+jWNYHwRsa GDzxciiiJaBIMTr3GcIgfKh0sPrpGkDm+CZ74HLw= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5AHDA4b047205 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2019 12:13:10 -0500 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE115.ent.ti.com (10.64.6.36) 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:13:10 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE113.ent.ti.com (10.64.6.34) 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:13:10 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5AHD9fs052679; Mon, 10 Jun 2019 12:13:10 -0500 From: Grygorii Strashko To: Russell King , Linus Walleij , Tony Lindgren CC: Bartosz Golaszewski , , , , Santosh Shilimkar , Russell King , Grygorii Strashko Subject: [PATCH-next 20/20] gpio: gpio-omap: clean up register access in omap2_set_gpio_debounce() Date: Mon, 10 Jun 2019 20:11:03 +0300 Message-ID: <20190610171103.30903-21-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 Signed-off-by: Russell King Signed-off-by: Grygorii Strashko --- drivers/gpio/gpio-omap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 94b10dfbff3f..52592eac0895 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -181,7 +181,6 @@ static inline void omap_gpio_dbck_disable(struct gpio_bank *bank) static int omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned offset, unsigned debounce) { - void __iomem *reg; u32 val; u32 l; bool enable = !!debounce; @@ -198,8 +197,7 @@ static int omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned offset, l = BIT(offset); clk_enable(bank->dbck); - reg = bank->base + bank->regs->debounce; - writel_relaxed(debounce, reg); + writel_relaxed(debounce, bank->base + bank->regs->debounce); val = omap_gpio_rmw(bank->base + bank->regs->debounce_en, l, enable); bank->dbck_enable_mask = val;