Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: line-mux: remove bits already handled by GPIO core

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/
Tested-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Reviewed-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://lore.kernel.org/r/20260107085833.17338-1-bartosz.golaszewski@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

-10
-10
drivers/gpio/gpio-line-mux.c
··· 29 29 struct gpio_lmux *glm = gpiochip_get_data(gc); 30 30 int ret; 31 31 32 - if (offset > gc->ngpio) 33 - return -EINVAL; 34 - 35 32 ret = mux_control_select_delay(glm->mux, glm->gpio_mux_states[offset], 36 33 MUX_SELECT_DELAY_US); 37 34 if (ret < 0) ··· 37 40 ret = gpiod_get_raw_value_cansleep(glm->muxed_gpio); 38 41 mux_control_deselect(glm->mux); 39 42 return ret; 40 - } 41 - 42 - static int gpio_lmux_gpio_set(struct gpio_chip *gc, unsigned int offset, 43 - int value) 44 - { 45 - return -EOPNOTSUPP; 46 43 } 47 44 48 45 static int gpio_lmux_gpio_get_direction(struct gpio_chip *gc, ··· 71 80 glm->gc.parent = dev; 72 81 73 82 glm->gc.get = gpio_lmux_gpio_get; 74 - glm->gc.set = gpio_lmux_gpio_set; 75 83 glm->gc.get_direction = gpio_lmux_gpio_get_direction; 76 84 77 85 glm->mux = devm_mux_control_get(dev, NULL);