diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2016-02-05 17:47:13 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-02-05 17:47:13 -0500 |
commit | 1300568ac129a83f321fdb74e397942f583c8321 (patch) | |
tree | 35ce5ce956422319df68a8950adfbd1d94fba4e0 /drivers/pinctrl/stm32 | |
parent | 25cbac7716be6a8d5c57534645ca472d2e4be1fd (diff) |
pinctrl: stm32: fix compile error and modernize
- 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>
Diffstat (limited to 'drivers/pinctrl/stm32')
-rw-r--r-- | drivers/pinctrl/stm32/pinctrl-stm32.c | 15 |
1 files 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 @@ | |||
6 | * Heavily based on Mediatek's pinctrl driver | 6 | * Heavily based on Mediatek's pinctrl driver |
7 | */ | 7 | */ |
8 | #include <linux/clk.h> | 8 | #include <linux/clk.h> |
9 | #include <linux/gpio.h> | 9 | #include <linux/gpio/driver.h> |
10 | #include <linux/io.h> | 10 | #include <linux/io.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/of.h> | 12 | #include <linux/of.h> |
@@ -46,9 +46,6 @@ | |||
46 | #define gpio_range_to_bank(chip) \ | 46 | #define gpio_range_to_bank(chip) \ |
47 | container_of(chip, struct stm32_gpio_bank, range) | 47 | container_of(chip, struct stm32_gpio_bank, range) |
48 | 48 | ||
49 | #define gpio_chip_to_bank(chip) \ | ||
50 | container_of(chip, struct stm32_gpio_bank, gpio_chip) | ||
51 | |||
52 | static const char * const stm32_gpio_functions[] = { | 49 | static const char * const stm32_gpio_functions[] = { |
53 | "gpio", "af0", "af1", | 50 | "gpio", "af0", "af1", |
54 | "af2", "af3", "af4", | 51 | "af2", "af3", "af4", |
@@ -144,7 +141,7 @@ static void stm32_gpio_free(struct gpio_chip *chip, unsigned offset) | |||
144 | 141 | ||
145 | static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset) | 142 | static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset) |
146 | { | 143 | { |
147 | struct stm32_gpio_bank *bank = gpio_chip_to_bank(chip); | 144 | struct stm32_gpio_bank *bank = gpiochip_get_data(chip); |
148 | int ret; | 145 | int ret; |
149 | 146 | ||
150 | clk_enable(bank->clk); | 147 | clk_enable(bank->clk); |
@@ -158,7 +155,7 @@ static int stm32_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
158 | 155 | ||
159 | static void stm32_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 156 | static void stm32_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
160 | { | 157 | { |
161 | struct stm32_gpio_bank *bank = gpio_chip_to_bank(chip); | 158 | struct stm32_gpio_bank *bank = gpiochip_get_data(chip); |
162 | 159 | ||
163 | __stm32_gpio_set(bank, offset, value); | 160 | __stm32_gpio_set(bank, offset, value); |
164 | } | 161 | } |
@@ -171,7 +168,7 @@ static int stm32_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
171 | static int stm32_gpio_direction_output(struct gpio_chip *chip, | 168 | static int stm32_gpio_direction_output(struct gpio_chip *chip, |
172 | unsigned offset, int value) | 169 | unsigned offset, int value) |
173 | { | 170 | { |
174 | struct stm32_gpio_bank *bank = gpio_chip_to_bank(chip); | 171 | struct stm32_gpio_bank *bank = gpiochip_get_data(chip); |
175 | 172 | ||
176 | __stm32_gpio_set(bank, offset, value); | 173 | __stm32_gpio_set(bank, offset, value); |
177 | pinctrl_gpio_direction_output(chip->base + offset); | 174 | pinctrl_gpio_direction_output(chip->base + offset); |
@@ -689,7 +686,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, | |||
689 | bank->gpio_chip.base = bank_nr * STM32_GPIO_PINS_PER_BANK; | 686 | bank->gpio_chip.base = bank_nr * STM32_GPIO_PINS_PER_BANK; |
690 | bank->gpio_chip.ngpio = npins; | 687 | bank->gpio_chip.ngpio = npins; |
691 | bank->gpio_chip.of_node = np; | 688 | bank->gpio_chip.of_node = np; |
692 | bank->gpio_chip.dev = dev; | 689 | bank->gpio_chip.parent = dev; |
693 | spin_lock_init(&bank->lock); | 690 | spin_lock_init(&bank->lock); |
694 | 691 | ||
695 | of_property_read_string(np, "st,bank-name", &range->name); | 692 | of_property_read_string(np, "st,bank-name", &range->name); |
@@ -699,7 +696,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, | |||
699 | range->pin_base = range->base = range->id * STM32_GPIO_PINS_PER_BANK; | 696 | range->pin_base = range->base = range->id * STM32_GPIO_PINS_PER_BANK; |
700 | range->npins = bank->gpio_chip.ngpio; | 697 | range->npins = bank->gpio_chip.ngpio; |
701 | range->gc = &bank->gpio_chip; | 698 | range->gc = &bank->gpio_chip; |
702 | err = gpiochip_add(&bank->gpio_chip); | 699 | err = gpiochip_add_data(&bank->gpio_chip, bank); |
703 | if (err) { | 700 | if (err) { |
704 | dev_err(dev, "Failed to add gpiochip(%d)!\n", bank_nr); | 701 | dev_err(dev, "Failed to add gpiochip(%d)!\n", bank_nr); |
705 | return err; | 702 | return err; |