Re: [RFT PATCH 6/7] gpio: exar: switch to using regmap
From: Bartosz Golaszewski
Date: Wed Nov 04 2020 - 11:33:00 EST
On Mon, Oct 26, 2020 at 3:18 PM Bartosz Golaszewski <brgl@xxxxxxxx> wrote:
>
> From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
>
> We can simplify the code in gpio-exar by using regmap. This allows us to
> drop the mutex (regmap provides its own locking) and we can also reuse
> regmap's bit operations instead of implementing our own update function.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>
[snip]
>
> static int exar_direction_output(struct gpio_chip *chip, unsigned int offset,
> int value)
> {
> - exar_set_value(chip, offset, value);
> - return exar_set_direction(chip, 0, offset);
> + struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip);
> + unsigned int addr = exar_offset_to_sel_addr(exar_gpio, offset);
> + unsigned int bit = exar_offset_to_bit(exar_gpio, offset);
> +
> + regmap_clear_bits(exar_gpio->regs, addr, BIT(bit));
> +
> + return 0;
> }
>
Upon closer look I noticed this now ignores the value argument. I
doubt however it's the culprit of the crash Jan reported.
[snip]
Bartosz