From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Ludovic Desroches <ludovic.desroches@microchip.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Andy Shevchenko <andy@kernel.org>,
Thorsten Scherer <t.scherer@eckelmann.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Orson Zhai <orsonzhai@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Chunyan Zhang <zhang.lyra@gmail.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH 08/12] gpio: stmpe: use new GPIO line value setter callbacks
Date: Wed, 25 Jun 2025 12:33:31 +0200 [thread overview]
Message-ID: <20250625-gpiochip-set-rv-gpio-round2-v1-8-bc110a3b52ff@linaro.org> (raw)
In-Reply-To: <20250625-gpiochip-set-rv-gpio-round2-v1-0-bc110a3b52ff@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-stmpe.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index dce8ff322e4722f6f97a9850772c7fe7defd9989..0a270156e0bea2f2a6914da6743df6d15b0870f5 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -54,7 +54,7 @@ static int stmpe_gpio_get(struct gpio_chip *chip, unsigned offset)
return !!(ret & mask);
}
-static void stmpe_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
+static int stmpe_gpio_set(struct gpio_chip *chip, unsigned int offset, int val)
{
struct stmpe_gpio *stmpe_gpio = gpiochip_get_data(chip);
struct stmpe *stmpe = stmpe_gpio->stmpe;
@@ -67,9 +67,9 @@ static void stmpe_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
* For them we need to write 0 to clear and 1 to set.
*/
if (stmpe->regs[STMPE_IDX_GPSR_LSB] == stmpe->regs[STMPE_IDX_GPCR_LSB])
- stmpe_set_bits(stmpe, reg, mask, val ? mask : 0);
- else
- stmpe_reg_write(stmpe, reg, mask);
+ return stmpe_set_bits(stmpe, reg, mask, val ? mask : 0);
+
+ return stmpe_reg_write(stmpe, reg, mask);
}
static int stmpe_gpio_get_direction(struct gpio_chip *chip,
@@ -98,8 +98,11 @@ static int stmpe_gpio_direction_output(struct gpio_chip *chip,
struct stmpe *stmpe = stmpe_gpio->stmpe;
u8 reg = stmpe->regs[STMPE_IDX_GPDR_LSB + (offset / 8)];
u8 mask = BIT(offset % 8);
+ int ret;
- stmpe_gpio_set(chip, offset, val);
+ ret = stmpe_gpio_set(chip, offset, val);
+ if (ret)
+ return ret;
return stmpe_set_bits(stmpe, reg, mask, mask);
}
@@ -133,7 +136,7 @@ static const struct gpio_chip template_chip = {
.direction_input = stmpe_gpio_direction_input,
.get = stmpe_gpio_get,
.direction_output = stmpe_gpio_direction_output,
- .set = stmpe_gpio_set,
+ .set_rv = stmpe_gpio_set,
.request = stmpe_gpio_request,
.can_sleep = true,
};
--
2.48.1
next prev parent reply other threads:[~2025-06-25 13:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 10:33 [PATCH 00/12] gpio: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 01/12] gpio: sama5d2-piobu: " Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 02/12] gpio: sch311x: " Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 03/12] gpio: sch: " Bartosz Golaszewski
2025-06-25 12:45 ` Andy Shevchenko
2025-06-25 10:33 ` [PATCH 04/12] gpio: siox: " Bartosz Golaszewski
2025-06-30 5:36 ` Thorsten Scherer
2025-06-25 10:33 ` [PATCH 05/12] gpio: spear-spics: remove unneeded callbacks Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 06/12] gpio: spear-spics: use new GPIO line value setter callbacks Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 07/12] gpio: sprd: " Bartosz Golaszewski
2025-06-26 1:12 ` Baolin Wang
2025-06-25 10:33 ` Bartosz Golaszewski [this message]
2025-07-03 21:55 ` [PATCH 08/12] gpio: stmpe: " Linus Walleij
2025-06-25 10:33 ` [PATCH 09/12] gpio: stp-xway: " Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 10/12] gpio: syscon: " Bartosz Golaszewski
2025-06-25 10:33 ` [PATCH 11/12] gpio: tangier: " Bartosz Golaszewski
2025-06-25 12:45 ` Andy Shevchenko
2025-06-25 10:33 ` [PATCH 12/12] gpio: tc3589x: " Bartosz Golaszewski
2025-07-03 21:55 ` Linus Walleij
2025-07-02 9:10 ` [PATCH 00/12] gpio: " Bartosz Golaszewski
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=20250625-gpiochip-set-rv-gpio-round2-v1-8-bc110a3b52ff@linaro.org \
--to=brgl@bgdev.pl \
--cc=alexandre.torgue@foss.st.com \
--cc=andy@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=ludovic.desroches@microchip.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=orsonzhai@gmail.com \
--cc=t.scherer@eckelmann.de \
--cc=zhang.lyra@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).