linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: stm32: fix compile error and modernize
@ 2016-02-05 22:49 Linus Walleij
  2016-02-08 17:23 ` Maxime Coquelin
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2016-02-05 22:49 UTC (permalink / raw)
  To: linux-arm-kernel

- Fix the dev->parent assignment compile error
- Use gpiochip_get_data() to get the data pointer for the
  banks

Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
I don't even know how to compile test this, I hope it works,
Maxime can you verify?
---
 drivers/pinctrl/stm32/pinctrl-stm32.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
index d25d4a064bad..9a08222ecb72 100644
--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
+++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
@@ -6,7 +6,7 @@
  * Heavily based on Mediatek's pinctrl driver
  */
 #include <linux/clk.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -46,9 +46,6 @@
 #define gpio_range_to_bank(chip) \
 		container_of(chip, struct stm32_gpio_bank, range)
 
-#define gpio_chip_to_bank(chip) \
-		container_of(chip, struct stm32_gpio_bank, gpio_chip)
-
 static const char * const stm32_gpio_functions[] = {
 	"gpio", "af0", "af1",
 	"af2", "af3", "af4",
@@ -144,7 +141,7 @@ static void stm32_gpio_free(struct gpio_chip *chip, unsigned offset)
 
 static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-	struct stm32_gpio_bank *bank = gpio_chip_to_bank(chip);
+	struct stm32_gpio_bank *bank = gpiochip_get_data(chip);
 	int ret;
 
 	clk_enable(bank->clk);
@@ -158,7 +155,7 @@ static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset)
 
 static void stm32_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
-	struct stm32_gpio_bank *bank = gpio_chip_to_bank(chip);
+	struct stm32_gpio_bank *bank = gpiochip_get_data(chip);
 
 	__stm32_gpio_set(bank, offset, value);
 }
@@ -171,7 +168,7 @@ static int stm32_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 static int stm32_gpio_direction_output(struct gpio_chip *chip,
 	unsigned offset, int value)
 {
-	struct stm32_gpio_bank *bank = gpio_chip_to_bank(chip);
+	struct stm32_gpio_bank *bank = gpiochip_get_data(chip);
 
 	__stm32_gpio_set(bank, offset, value);
 	pinctrl_gpio_direction_output(chip->base + offset);
@@ -689,7 +686,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,
 	bank->gpio_chip.base = bank_nr * STM32_GPIO_PINS_PER_BANK;
 	bank->gpio_chip.ngpio = npins;
 	bank->gpio_chip.of_node = np;
-	bank->gpio_chip.dev = dev;
+	bank->gpio_chip.parent = dev;
 	spin_lock_init(&bank->lock);
 
 	of_property_read_string(np, "st,bank-name", &range->name);
@@ -699,7 +696,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,
 	range->pin_base = range->base = range->id * STM32_GPIO_PINS_PER_BANK;
 	range->npins = bank->gpio_chip.ngpio;
 	range->gc = &bank->gpio_chip;
-	err  = gpiochip_add(&bank->gpio_chip);
+	err = gpiochip_add_data(&bank->gpio_chip, bank);
 	if (err) {
 		dev_err(dev, "Failed to add gpiochip(%d)!\n", bank_nr);
 		return err;
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] pinctrl: stm32: fix compile error and modernize
  2016-02-05 22:49 [PATCH] pinctrl: stm32: fix compile error and modernize Linus Walleij
@ 2016-02-08 17:23 ` Maxime Coquelin
  0 siblings, 0 replies; 2+ messages in thread
From: Maxime Coquelin @ 2016-02-08 17:23 UTC (permalink / raw)
  To: linux-arm-kernel

2016-02-05 23:49 GMT+01:00 Linus Walleij <linus.walleij@linaro.org>:
> - Fix the dev->parent assignment compile error
> - Use gpiochip_get_data() to get the data pointer for the
>   banks
>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> I don't even know how to compile test this, I hope it works,
> Maxime can you verify?

Thanks Linus, I just tested your patch with success:
Tested-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>

About the compile testing, I have identified the problem last week,
and sent a v5 of the series.
I will discard this series, and will send you a patch that fixes
compile testing,
and also unneeded dependency with DT bindings header file.

Regards,
Maxime

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-08 17:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-05 22:49 [PATCH] pinctrl: stm32: fix compile error and modernize Linus Walleij
2016-02-08 17:23 ` Maxime Coquelin

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).