mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Areeb Ul Haq Mirza <auhmirza02@gmail.com>
To: Robert Jarzmik <robert.jarzmik@free.fr>,
	Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Areeb Ul Haq Mirza <auhmirza02@gmail.com>
Subject: [PATCH] gpio: pxa: stop reading gpio_chip::base in direction callbacks
Date: Thu, 24 Sep 2026 15:02:42 +0100	[thread overview]
Message-ID: <20260924140242.126159-1-auhmirza02@gmail.com> (raw)

__gpio_is_inverted() identifies GPIO86-89 on PXA26x by comparing its
argument against hardware line numbers, and its other callers pass the
hardware index from irqd_to_hwirq(). The direction_input() and
direction_output() callbacks instead pass chip->base + offset.

Pass the offset directly, which is the same conversion that commit
566e684e70cb ("gpio: pxa: use new pinctrl GPIO helpers") made for the
pinctrl calls in these functions.

No functional change: the driver never sets chip->base, which stays
zero because struct pxa_gpio_chip is allocated with devm_kzalloc().
This removes a dependency on gpio_chip::base,
as tracked in drivers/gpio/TODO.

Signed-off-by: Areeb Ul Haq Mirza <auhmirza02@gmail.com>
---
Compile-tested only (arm64, COMPILE_TEST, W=1 and sparse clean).

 drivers/gpio/gpio-pxa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 2b5da973f51f..3ff21e899278 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -268,7 +268,7 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 	spin_lock_irqsave(&gpio_lock, flags);
 
 	value = readl_relaxed(base + GPDR_OFFSET);
-	if (__gpio_is_inverted(chip->base + offset))
+	if (__gpio_is_inverted(offset))
 		value |= mask;
 	else
 		value &= ~mask;
@@ -297,7 +297,7 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
 	spin_lock_irqsave(&gpio_lock, flags);
 
 	tmp = readl_relaxed(base + GPDR_OFFSET);
-	if (__gpio_is_inverted(chip->base + offset))
+	if (__gpio_is_inverted(offset))
 		tmp &= ~mask;
 	else
 		tmp |= mask;

base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
-- 
2.43.0


                 reply	other threads:[~2026-09-24 14:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260924140242.126159-1-auhmirza02@gmail.com \
    --to=auhmirza02@gmail.com \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robert.jarzmik@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®