Blob Blame History Raw
From 62adc6f33d6f3c0f4831389dec0f82ea6e9a489f Mon Sep 17 00:00:00 2001
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Date: Mon, 3 Feb 2020 14:16:16 +0100
Subject: [PATCH] gpiolib: fix gpio_do_set_config()
Git-commit: 62adc6f33d6f3c0f4831389dec0f82ea6e9a489f
Patch-mainline: v5.6-rc2
References: bsc#1180682

Commit d90f36851d65 ("gpiolib: have a single place of calling
set_config()") introduced a regression where we don't pass the right
variable as argument to the set_config() callback of gpio driver from
gpio_set_config(). After reverting two additional patches that came
on top of it - this addresses the issue by changing the type of the last
argument of gpio_do_set_config() to unsigned long and making sure the
packed config variable is actually used in gpio_set_config().

Fixes: d90f36851d65 ("gpiolib: have a single place of calling set_config()")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/gpio/gpiolib.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2951,12 +2951,12 @@ EXPORT_SYMBOL_GPL(gpiochip_free_own_desc
  */
 
 static int gpio_do_set_config(struct gpio_chip *gc, unsigned int offset,
-			      enum pin_config_param mode)
+			      unsigned long config)
 {
 	if (!gc->set_config)
 		return -ENOTSUPP;
 
-	return gc->set_config(gc, offset, mode);
+	return gc->set_config(gc, offset, config);
 }
 
 static int gpio_set_config(struct gpio_chip *gc, unsigned int offset,
@@ -2976,7 +2976,7 @@ static int gpio_set_config(struct gpio_c
 	}
 
 	config = PIN_CONF_PACKED(mode, arg);
-	return gpio_do_set_config(gc, offset, mode);
+	return gpio_do_set_config(gc, offset, config);
 }
 
 /**