summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-ts5500.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/gpio-ts5500.c')
-rw-r--r--drivers/gpio/gpio-ts5500.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/gpio/gpio-ts5500.c b/drivers/gpio/gpio-ts5500.c
index b29a102d1..5f945083f 100644
--- a/drivers/gpio/gpio-ts5500.c
+++ b/drivers/gpio/gpio-ts5500.c
@@ -185,11 +185,6 @@ static const struct ts5500_dio ts5500_lcd[] = {
TS5500_DIO_IN_IRQ(0x73, 7, 1),
};
-static inline struct ts5500_priv *ts5500_gc_to_priv(struct gpio_chip *chip)
-{
- return container_of(chip, struct ts5500_priv, gpio_chip);
-}
-
static inline void ts5500_set_mask(u8 mask, u8 addr)
{
u8 val = inb(addr);
@@ -206,7 +201,7 @@ static inline void ts5500_clear_mask(u8 mask, u8 addr)
static int ts5500_gpio_input(struct gpio_chip *chip, unsigned offset)
{
- struct ts5500_priv *priv = ts5500_gc_to_priv(chip);
+ struct ts5500_priv *priv = gpiochip_get_data(chip);
const struct ts5500_dio line = priv->pinout[offset];
unsigned long flags;
@@ -225,7 +220,7 @@ static int ts5500_gpio_input(struct gpio_chip *chip, unsigned offset)
static int ts5500_gpio_get(struct gpio_chip *chip, unsigned offset)
{
- struct ts5500_priv *priv = ts5500_gc_to_priv(chip);
+ struct ts5500_priv *priv = gpiochip_get_data(chip);
const struct ts5500_dio line = priv->pinout[offset];
return !!(inb(line.value_addr) & line.value_mask);
@@ -233,7 +228,7 @@ static int ts5500_gpio_get(struct gpio_chip *chip, unsigned offset)
static int ts5500_gpio_output(struct gpio_chip *chip, unsigned offset, int val)
{
- struct ts5500_priv *priv = ts5500_gc_to_priv(chip);
+ struct ts5500_priv *priv = gpiochip_get_data(chip);
const struct ts5500_dio line = priv->pinout[offset];
unsigned long flags;
@@ -255,7 +250,7 @@ static int ts5500_gpio_output(struct gpio_chip *chip, unsigned offset, int val)
static void ts5500_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
{
- struct ts5500_priv *priv = ts5500_gc_to_priv(chip);
+ struct ts5500_priv *priv = gpiochip_get_data(chip);
const struct ts5500_dio line = priv->pinout[offset];
unsigned long flags;
@@ -269,7 +264,7 @@ static void ts5500_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
static int ts5500_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
- struct ts5500_priv *priv = ts5500_gc_to_priv(chip);
+ struct ts5500_priv *priv = gpiochip_get_data(chip);
const struct ts5500_dio *block = priv->pinout;
const struct ts5500_dio line = block[offset];
@@ -315,7 +310,8 @@ static void ts5500_disable_irq(struct ts5500_priv *priv)
else if (priv->hwirq == 1)
ts5500_clear_mask(BIT(6), 0x7d); /* LCD_RS on IRQ1 */
else
- dev_err(priv->gpio_chip.dev, "invalid hwirq %d\n", priv->hwirq);
+ dev_err(priv->gpio_chip.parent, "invalid hwirq %d\n",
+ priv->hwirq);
spin_unlock_irqrestore(&priv->lock, flags);
}
@@ -346,7 +342,7 @@ static int ts5500_dio_probe(struct platform_device *pdev)
priv->gpio_chip.owner = THIS_MODULE;
priv->gpio_chip.label = name;
- priv->gpio_chip.dev = dev;
+ priv->gpio_chip.parent = dev;
priv->gpio_chip.direction_input = ts5500_gpio_input;
priv->gpio_chip.direction_output = ts5500_gpio_output;
priv->gpio_chip.get = ts5500_gpio_get;
@@ -413,7 +409,7 @@ static int ts5500_dio_probe(struct platform_device *pdev)
break;
}
- ret = gpiochip_add(&priv->gpio_chip);
+ ret = gpiochip_add_data(&priv->gpio_chip, priv);
if (ret) {
dev_err(dev, "failed to register the gpio chip\n");
return ret;