diff options
Diffstat (limited to 'drivers/gpio/gpio-tz1090.c')
-rw-r--r-- | drivers/gpio/gpio-tz1090.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/gpio/gpio-tz1090.c b/drivers/gpio/gpio-tz1090.c index 87bb1b1ee..ca958e0f6 100644 --- a/drivers/gpio/gpio-tz1090.c +++ b/drivers/gpio/gpio-tz1090.c @@ -62,7 +62,6 @@ struct tz1090_gpio_bank { int irq; char label[16]; }; -#define to_bank(c) container_of(c, struct tz1090_gpio_bank, chip) /** * struct tz1090_gpio - Overall GPIO device private data @@ -187,7 +186,7 @@ static inline int tz1090_gpio_read_bit(struct tz1090_gpio_bank *bank, static int tz1090_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); tz1090_gpio_set_bit(bank, REG_GPIO_DIR, offset); return 0; @@ -196,7 +195,7 @@ static int tz1090_gpio_direction_input(struct gpio_chip *chip, static int tz1090_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, int output_value) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); int lstat; __global_lock2(lstat); @@ -212,9 +211,9 @@ static int tz1090_gpio_direction_output(struct gpio_chip *chip, */ static int tz1090_gpio_get(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); - return tz1090_gpio_read_bit(bank, REG_GPIO_DIN, offset); + return !!tz1090_gpio_read_bit(bank, REG_GPIO_DIN, offset); } /* @@ -223,14 +222,14 @@ static int tz1090_gpio_get(struct gpio_chip *chip, unsigned int offset) static void tz1090_gpio_set(struct gpio_chip *chip, unsigned int offset, int output_value) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); tz1090_gpio_mod_bit(bank, REG_GPIO_DOUT, offset, output_value); } static int tz1090_gpio_request(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); int ret; ret = pinctrl_request_gpio(chip->base + offset); @@ -245,7 +244,7 @@ static int tz1090_gpio_request(struct gpio_chip *chip, unsigned int offset) static void tz1090_gpio_free(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); pinctrl_free_gpio(chip->base + offset); @@ -254,7 +253,7 @@ static void tz1090_gpio_free(struct gpio_chip *chip, unsigned int offset) static int tz1090_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); if (!bank->domain) return -EINVAL; @@ -425,7 +424,7 @@ static int tz1090_gpio_bank_probe(struct tz1090_gpio_bank_info *info) snprintf(bank->label, sizeof(bank->label), "tz1090-gpio-%u", info->index); bank->chip.label = bank->label; - bank->chip.dev = dev; + bank->chip.parent = dev; bank->chip.direction_input = tz1090_gpio_direction_input; bank->chip.direction_output = tz1090_gpio_direction_output; bank->chip.get = tz1090_gpio_get; @@ -440,7 +439,7 @@ static int tz1090_gpio_bank_probe(struct tz1090_gpio_bank_info *info) bank->chip.ngpio = 30; /* Add the GPIO bank */ - gpiochip_add(&bank->chip); + gpiochip_add_data(&bank->chip, bank); /* Get the GPIO bank IRQ if provided */ bank->irq = irq_of_parse_and_map(np, 0); |