Skip to contentSkip to conversation

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

PATCH Applied Bartosz Golaszewski 2 participants 3 messages Jan 7 – Jan 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/gpio/gpio-line-mux.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/gpio/gpio-line-mux.c +0 -10
index a4f384306218..62548fbd3ca0 100644
@@ -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);
Signature · 1 line
2.47.3
maintainer Tested-by Reviewed-by on v1 1/1
#1 lore raw

Hi Bartosz,

Quoted 42 lines · Bartosz Golaszewski

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")
---
 drivers/gpio/gpio-line-mux.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/gpio/gpio-line-mux.c +0 -9
index a4f384306218..62548fbd3ca0 100644
@@ -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)
 {

drivers/gpio/gpio-line-mux.c static int gpio_lmux_probe(struct platform_device *pdev) · line 76

Quoted 7 lines
drivers/gpio/gpio-line-mux.c +0 -1
@@ -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);

Thanks a lot for taking care of that!

Best,
Jonas

author Applied
#2 lore raw
In reply to Bartosz Golaszewski
Quoted 8 lines · Bartosz Golaszewski

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.

[...]

Applied, thanks!

[1/1] gpio: line-mux: remove bits already handled by GPIO core

      commit: e034e058897a12bc856f8b22d1796964c742f732

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>