Commit 083f0f2c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gpio-v5.3-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
 "Here is a (hopefully last) set of GPIO fixes for the v5.3 kernel
  cycle. Two are pretty core:

   - Fix not reporting open drain/source lines to userspace as "input"

   - Fix a minor build error found in randconfigs

   - Fix a chip select quirk on the Freescale SPI

   - Fix the irqchip initialization semantic order to reflect what it
     was using the old API"

* tag 'gpio-v5.3-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpio: Fix irqchip initialization order
  gpio: of: fix Freescale SPI CS quirk handling
  gpio: Fix build error of function redefinition
  gpiolib: never report open-drain/source lines as 'input' to user-space
parents 36146921 48057ed1
...@@ -363,7 +363,7 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, ...@@ -363,7 +363,7 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
/* Special handling for SPI GPIOs if used */ /* Special handling for SPI GPIOs if used */
if (IS_ERR(desc)) if (IS_ERR(desc))
desc = of_find_spi_gpio(dev, con_id, &of_flags); desc = of_find_spi_gpio(dev, con_id, &of_flags);
if (IS_ERR(desc)) { if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER) {
/* This quirk looks up flags and all */ /* This quirk looks up flags and all */
desc = of_find_spi_cs_gpio(dev, con_id, idx, flags); desc = of_find_spi_cs_gpio(dev, con_id, idx, flags);
if (!IS_ERR(desc)) if (!IS_ERR(desc))
......
...@@ -1091,9 +1091,11 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -1091,9 +1091,11 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (test_bit(FLAG_ACTIVE_LOW, &desc->flags)) if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
lineinfo.flags |= GPIOLINE_FLAG_ACTIVE_LOW; lineinfo.flags |= GPIOLINE_FLAG_ACTIVE_LOW;
if (test_bit(FLAG_OPEN_DRAIN, &desc->flags)) if (test_bit(FLAG_OPEN_DRAIN, &desc->flags))
lineinfo.flags |= GPIOLINE_FLAG_OPEN_DRAIN; lineinfo.flags |= (GPIOLINE_FLAG_OPEN_DRAIN |
GPIOLINE_FLAG_IS_OUT);
if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) if (test_bit(FLAG_OPEN_SOURCE, &desc->flags))
lineinfo.flags |= GPIOLINE_FLAG_OPEN_SOURCE; lineinfo.flags |= (GPIOLINE_FLAG_OPEN_SOURCE |
GPIOLINE_FLAG_IS_OUT);
if (copy_to_user(ip, &lineinfo, sizeof(lineinfo))) if (copy_to_user(ip, &lineinfo, sizeof(lineinfo)))
return -EFAULT; return -EFAULT;
...@@ -1371,21 +1373,13 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, ...@@ -1371,21 +1373,13 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
if (status) if (status)
goto err_remove_from_list; goto err_remove_from_list;
status = gpiochip_irqchip_init_valid_mask(chip);
if (status)
goto err_remove_from_list;
status = gpiochip_alloc_valid_mask(chip); status = gpiochip_alloc_valid_mask(chip);
if (status) if (status)
goto err_remove_irqchip_mask; goto err_remove_from_list;
status = gpiochip_add_irqchip(chip, lock_key, request_key);
if (status)
goto err_free_gpiochip_mask;
status = of_gpiochip_add(chip); status = of_gpiochip_add(chip);
if (status) if (status)
goto err_remove_chip; goto err_free_gpiochip_mask;
status = gpiochip_init_valid_mask(chip); status = gpiochip_init_valid_mask(chip);
if (status) if (status)
...@@ -1411,6 +1405,14 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, ...@@ -1411,6 +1405,14 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
machine_gpiochip_add(chip); machine_gpiochip_add(chip);
status = gpiochip_irqchip_init_valid_mask(chip);
if (status)
goto err_remove_acpi_chip;
status = gpiochip_add_irqchip(chip, lock_key, request_key);
if (status)
goto err_remove_irqchip_mask;
/* /*
* By first adding the chardev, and then adding the device, * By first adding the chardev, and then adding the device,
* we get a device node entry in sysfs under * we get a device node entry in sysfs under
...@@ -1422,21 +1424,21 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, ...@@ -1422,21 +1424,21 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
if (gpiolib_initialized) { if (gpiolib_initialized) {
status = gpiochip_setup_dev(gdev); status = gpiochip_setup_dev(gdev);
if (status) if (status)
goto err_remove_acpi_chip; goto err_remove_irqchip;
} }
return 0; return 0;
err_remove_irqchip:
gpiochip_irqchip_remove(chip);
err_remove_irqchip_mask:
gpiochip_irqchip_free_valid_mask(chip);
err_remove_acpi_chip: err_remove_acpi_chip:
acpi_gpiochip_remove(chip); acpi_gpiochip_remove(chip);
err_remove_of_chip: err_remove_of_chip:
gpiochip_free_hogs(chip); gpiochip_free_hogs(chip);
of_gpiochip_remove(chip); of_gpiochip_remove(chip);
err_remove_chip:
gpiochip_irqchip_remove(chip);
err_free_gpiochip_mask: err_free_gpiochip_mask:
gpiochip_free_valid_mask(chip); gpiochip_free_valid_mask(chip);
err_remove_irqchip_mask:
gpiochip_irqchip_free_valid_mask(chip);
err_remove_from_list: err_remove_from_list:
spin_lock_irqsave(&gpio_lock, flags); spin_lock_irqsave(&gpio_lock, flags);
list_del(&gdev->list); list_del(&gdev->list);
......
...@@ -241,30 +241,6 @@ static inline int irq_to_gpio(unsigned irq) ...@@ -241,30 +241,6 @@ static inline int irq_to_gpio(unsigned irq)
return -EINVAL; return -EINVAL;
} }
static inline int
gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
unsigned int gpio_offset, unsigned int pin_offset,
unsigned int npins)
{
WARN_ON(1);
return -EINVAL;
}
static inline int
gpiochip_add_pingroup_range(struct gpio_chip *chip,
struct pinctrl_dev *pctldev,
unsigned int gpio_offset, const char *pin_group)
{
WARN_ON(1);
return -EINVAL;
}
static inline void
gpiochip_remove_pin_ranges(struct gpio_chip *chip)
{
WARN_ON(1);
}
static inline int devm_gpio_request(struct device *dev, unsigned gpio, static inline int devm_gpio_request(struct device *dev, unsigned gpio,
const char *label) const char *label)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment