static int kempld_gpio_get(struct gpio_chip *chip, unsigned offset)
{
- struct kempld_gpio_data *gpio
- = container_of(chip, struct kempld_gpio_data, chip);
+ struct kempld_gpio_data *gpio = gpiochip_get_data(chip);
struct kempld_device_data *pld = gpio->pld;
return !!kempld_gpio_get_bit(pld, KEMPLD_GPIO_LVL_NUM(offset), offset);
static void kempld_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
- struct kempld_gpio_data *gpio
- = container_of(chip, struct kempld_gpio_data, chip);
+ struct kempld_gpio_data *gpio = gpiochip_get_data(chip);
struct kempld_device_data *pld = gpio->pld;
kempld_get_mutex(pld);
static int kempld_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{
- struct kempld_gpio_data *gpio
- = container_of(chip, struct kempld_gpio_data, chip);
+ struct kempld_gpio_data *gpio = gpiochip_get_data(chip);
struct kempld_device_data *pld = gpio->pld;
kempld_get_mutex(pld);
static int kempld_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
int value)
{
- struct kempld_gpio_data *gpio
- = container_of(chip, struct kempld_gpio_data, chip);
+ struct kempld_gpio_data *gpio = gpiochip_get_data(chip);
struct kempld_device_data *pld = gpio->pld;
kempld_get_mutex(pld);
static int kempld_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
{
- struct kempld_gpio_data *gpio
- = container_of(chip, struct kempld_gpio_data, chip);
+ struct kempld_gpio_data *gpio = gpiochip_get_data(chip);
struct kempld_device_data *pld = gpio->pld;
return !kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset);
return -ENODEV;
}
- ret = gpiochip_add(chip);
+ ret = gpiochip_add_data(chip, gpio);
if (ret) {
dev_err(dev, "Could not register GPIO chip\n");
return ret;