spinlock_t lock;
};
-static inline struct mb86s70_gpio_chip *chip_to_mb86s70(struct gpio_chip *gc)
-{
- return container_of(gc, struct mb86s70_gpio_chip, gc);
-}
-
static int mb86s70_gpio_request(struct gpio_chip *gc, unsigned gpio)
{
- struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc);
+ struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc);
unsigned long flags;
u32 val;
static void mb86s70_gpio_free(struct gpio_chip *gc, unsigned gpio)
{
- struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc);
+ struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc);
unsigned long flags;
u32 val;
static int mb86s70_gpio_direction_input(struct gpio_chip *gc, unsigned gpio)
{
- struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc);
+ struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc);
unsigned long flags;
unsigned char val;
static int mb86s70_gpio_direction_output(struct gpio_chip *gc,
unsigned gpio, int value)
{
- struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc);
+ struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc);
unsigned long flags;
unsigned char val;
static int mb86s70_gpio_get(struct gpio_chip *gc, unsigned gpio)
{
- struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc);
+ struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc);
return !!(readl(gchip->base + PDR(gpio)) & OFFSET(gpio));
}
static void mb86s70_gpio_set(struct gpio_chip *gc, unsigned gpio, int value)
{
- struct mb86s70_gpio_chip *gchip = chip_to_mb86s70(gc);
+ struct mb86s70_gpio_chip *gchip = gpiochip_get_data(gc);
unsigned long flags;
unsigned char val;
platform_set_drvdata(pdev, gchip);
- ret = gpiochip_add(&gchip->gc);
+ ret = gpiochip_add_data(&gchip->gc, gchip);
if (ret) {
dev_err(&pdev->dev, "couldn't register gpio driver\n");
clk_disable_unprepare(gchip->clk);