struct adp5520_gpio *dev;
uint8_t reg_val;
- dev = container_of(chip, struct adp5520_gpio, gpio_chip);
+ dev = gpiochip_get_data(chip);
/*
* There are dedicated registers for GPIO IN/OUT.
unsigned off, int val)
{
struct adp5520_gpio *dev;
- dev = container_of(chip, struct adp5520_gpio, gpio_chip);
+ dev = gpiochip_get_data(chip);
if (val)
adp5520_set_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]);
static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off)
{
struct adp5520_gpio *dev;
- dev = container_of(chip, struct adp5520_gpio, gpio_chip);
+ dev = gpiochip_get_data(chip);
clear_bit(off, &dev->output);
{
struct adp5520_gpio *dev;
int ret = 0;
- dev = container_of(chip, struct adp5520_gpio, gpio_chip);
+ dev = gpiochip_get_data(chip);
set_bit(off, &dev->output);
goto err;
}
- ret = gpiochip_add(&dev->gpio_chip);
+ ret = gpiochip_add_data(&dev->gpio_chip, dev);
if (ret)
goto err;