diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-03-16 02:54:45 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-03-16 02:54:45 +0300 |
commit | 245f0db0de926601353776085e6f6a4c974c5615 (patch) | |
tree | b493e9e726f4a898041f7861d0df328aa1a348a1 /drivers/gpio/gpio-intel-mid.c | |
parent | 24672bdfb357b91bed0ea8d432241bf7bdefc8a8 (diff) | |
parent | b562e44f507e863c6792946e4e1b1449fbbac85d (diff) | |
download | linux-245f0db0de926601353776085e6f6a4c974c5615.tar.xz |
Merge tag 'v4.5' into next
Merge with Linux 4.5 to get PROPERTY_ENTRY_INTEGER() that is needed to
fix pxa/raumfeld rotary encoder properties.
Diffstat (limited to 'drivers/gpio/gpio-intel-mid.c')
-rw-r--r-- | drivers/gpio/gpio-intel-mid.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-intel-mid.c b/drivers/gpio/gpio-intel-mid.c index 70097472b02c..cdaba13cb8e8 100644 --- a/drivers/gpio/gpio-intel-mid.c +++ b/drivers/gpio/gpio-intel-mid.c @@ -78,15 +78,10 @@ struct intel_mid_gpio { struct pci_dev *pdev; }; -static inline struct intel_mid_gpio *to_intel_gpio_priv(struct gpio_chip *gc) -{ - return container_of(gc, struct intel_mid_gpio, chip); -} - static void __iomem *gpio_reg(struct gpio_chip *chip, unsigned offset, enum GPIO_REG reg_type) { - struct intel_mid_gpio *priv = to_intel_gpio_priv(chip); + struct intel_mid_gpio *priv = gpiochip_get_data(chip); unsigned nreg = chip->ngpio / 32; u8 reg = offset / 32; @@ -96,7 +91,7 @@ static void __iomem *gpio_reg(struct gpio_chip *chip, unsigned offset, static void __iomem *gpio_reg_2bit(struct gpio_chip *chip, unsigned offset, enum GPIO_REG reg_type) { - struct intel_mid_gpio *priv = to_intel_gpio_priv(chip); + struct intel_mid_gpio *priv = gpiochip_get_data(chip); unsigned nreg = chip->ngpio / 32; u8 reg = offset / 16; @@ -120,7 +115,7 @@ static int intel_gpio_get(struct gpio_chip *chip, unsigned offset) { void __iomem *gplr = gpio_reg(chip, offset, GPLR); - return readl(gplr) & BIT(offset % 32); + return !!(readl(gplr) & BIT(offset % 32)); } static void intel_gpio_set(struct gpio_chip *chip, unsigned offset, int value) @@ -138,7 +133,7 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct intel_mid_gpio *priv = to_intel_gpio_priv(chip); + struct intel_mid_gpio *priv = gpiochip_get_data(chip); void __iomem *gpdr = gpio_reg(chip, offset, GPDR); u32 value; unsigned long flags; @@ -161,7 +156,7 @@ static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { - struct intel_mid_gpio *priv = to_intel_gpio_priv(chip); + struct intel_mid_gpio *priv = gpiochip_get_data(chip); void __iomem *gpdr = gpio_reg(chip, offset, GPDR); unsigned long flags; @@ -185,7 +180,7 @@ static int intel_gpio_direction_output(struct gpio_chip *chip, static int intel_mid_irq_type(struct irq_data *d, unsigned type) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct intel_mid_gpio *priv = to_intel_gpio_priv(gc); + struct intel_mid_gpio *priv = gpiochip_get_data(gc); u32 gpio = irqd_to_hwirq(d); unsigned long flags; u32 value; @@ -304,7 +299,7 @@ MODULE_DEVICE_TABLE(pci, intel_gpio_ids); static void intel_mid_irq_handler(struct irq_desc *desc) { struct gpio_chip *gc = irq_desc_get_handler_data(desc); - struct intel_mid_gpio *priv = to_intel_gpio_priv(gc); + struct intel_mid_gpio *priv = gpiochip_get_data(gc); struct irq_data *data = irq_desc_get_irq_data(desc); struct irq_chip *chip = irq_data_get_irq_chip(data); u32 base, gpio, mask; @@ -392,7 +387,7 @@ static int intel_gpio_probe(struct pci_dev *pdev, priv->reg_base = pcim_iomap_table(pdev)[0]; priv->chip.label = dev_name(&pdev->dev); - priv->chip.dev = &pdev->dev; + priv->chip.parent = &pdev->dev; priv->chip.request = intel_gpio_request; priv->chip.direction_input = intel_gpio_direction_input; priv->chip.direction_output = intel_gpio_direction_output; @@ -406,7 +401,7 @@ static int intel_gpio_probe(struct pci_dev *pdev, spin_lock_init(&priv->lock); pci_set_drvdata(pdev, priv); - retval = gpiochip_add(&priv->chip); + retval = gpiochip_add_data(&priv->chip, priv); if (retval) { dev_err(&pdev->dev, "gpiochip_add error %d\n", retval); return retval; |