From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
To: Jonas Jelonek <jelonek.jonas@gmail.com>,
Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Thomas Richard <thomas.richard@bootlin.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: [PATCH] gpio: line-mux: remove bits already handled by GPIO core
Date: Wed, 7 Jan 2026 09:58:33 +0100 [thread overview]
Message-ID: <20260107085833.17338-1-bartosz.golaszewski@oss.qualcomm.com> (raw)
GPIO core already handles checking the offset against the number of
GPIOs as well as missing any of the GPIO chip callbacks. Remove the
unnecessary bits.
Also, the offset check was off-by-one as reported by Dan.
Fixes: 2b03d9a40cd1 ("gpio: add gpio-line-mux driver")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/aV4b6GAGz1zyf8Xy@stanley.mountain/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/gpio/gpio-line-mux.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/gpio/gpio-line-mux.c b/drivers/gpio/gpio-line-mux.c
index a4f384306218..62548fbd3ca0 100644
--- a/drivers/gpio/gpio-line-mux.c
+++ b/drivers/gpio/gpio-line-mux.c
@@ -29,9 +29,6 @@ static int gpio_lmux_gpio_get(struct gpio_chip *gc, unsigned int offset)
struct gpio_lmux *glm = gpiochip_get_data(gc);
int ret;
- if (offset > gc->ngpio)
- return -EINVAL;
-
ret = mux_control_select_delay(glm->mux, glm->gpio_mux_states[offset],
MUX_SELECT_DELAY_US);
if (ret < 0)
@@ -42,12 +39,6 @@ static int gpio_lmux_gpio_get(struct gpio_chip *gc, unsigned int offset)
return ret;
}
-static int gpio_lmux_gpio_set(struct gpio_chip *gc, unsigned int offset,
- int value)
-{
- return -EOPNOTSUPP;
-}
-
static int gpio_lmux_gpio_get_direction(struct gpio_chip *gc,
unsigned int offset)
{
@@ -80,7 +71,6 @@ static int gpio_lmux_probe(struct platform_device *pdev)
glm->gc.parent = dev;
glm->gc.get = gpio_lmux_gpio_get;
- glm->gc.set = gpio_lmux_gpio_set;
glm->gc.get_direction = gpio_lmux_gpio_get_direction;
glm->mux = devm_mux_control_get(dev, NULL);
--
2.47.3
next reply other threads:[~2026-01-07 8:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-07 8:58 Bartosz Golaszewski [this message]
2026-01-07 9:25 ` Jonas Jelonek
2026-01-09 8:58 ` 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=20260107085833.17338-1-bartosz.golaszewski@oss.qualcomm.com \
--to=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=jelonek.jonas@gmail.com \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.richard@bootlin.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
all inboxes | Powered by JetHome®