GPIO fixes for the v3.13 series:

- Fix compile warnings.
 
 - Fix overly talkative diagnostic messages from usual use
   cases wrt GPIO descriptors.
 
 - Add a documentation 00-INDEX
 
 - Use platform GPIOs as fallback when ACPI or device tree is
   used as the primary means to get GPIO lines.
 
 - A bug fix for the MPC8572/MPC8536 fixing erroneous input data.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.15 (GNU/Linux)
 
 iQIcBAABAgAGBQJSnzPDAAoJEEEQszewGV1zCBkP/RPG63uZXUbedQsDj81CEZmt
 qUR5e8EloSBiUKulI4KIgufVrlBsiZlHRza/Fmw3uOH5T35rWtHkv4rPjZcxNVYh
 wzHIoiQK9fe86chhDSVoBytTX3MkTdAIPmVUuiP6yUgWWU1Z5HVQIGUlydz44Iqk
 bY3DF3HTX9n6skbIXYQ25QUnWRgvcESYJJuQlwOMMEfXXZJpFBxY0Pifborm99wY
 eMyAs6EjSnNJxWLFwBe0YteoppVa1OlaEmMt+sodWhDuNAXFx10dBZluvLposjMh
 wWXObKVnhJcWWqb4B0CZmMI19zBmNRyt0PqT7n/VtTwR4LEYo9c5yPbexOlra0xO
 eDkhOiaVpN2p1B3yLxOf1uX1KvpN/Wg8A+Ht5i2j/Dl8WUpxtir4568a/aFWLT7G
 Ho/fJxjhEvXhvZhdR0RPlFBVhzqi8E6K4dz2TrPOJCZJ1gCN1uzYLHb6pWmQsDRf
 YlvXD9gRRFeuI3tKqOlVEcrzVCKJIj9lPuRD5QIY6hVzLVTYPLrCEv11I9rHCc3d
 wCdjgLHlq3btiEFv2caN680PkmWyMfm8BWn06S7oGA3k4MrcDIksST9874lhk6nb
 jkf+wkrfVLWBO0IMxzqTJVznf3SYHDV7zg5Pdh55rFPb7NOng81IwbMeXvKfESix
 RGR/66Dg30qoyPuEApYI
 =PJQJ
 -----END PGP SIGNATURE-----

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

Pull GPIO fixes from Linus Walleij:
 "Here are a few more GPIO patches, we're a bit noisy for being the GPIO
  subsystem, mostly due to the new descriptor API, but all is getting
  into shape.

   - Fix compile warnings

   - Fix overly talkative diagnostic messages from usual use cases wrt
     GPIO descriptors

   - Add a documentation 00-INDEX

   - Use platform GPIOs as fallback when ACPI or device tree is used as
     the primary means to get GPIO lines

   - A bug fix for the MPC8572/MPC8536 fixing erroneous input data"

* tag 'gpio-v3.13-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpiolib: change a warning to debug message when failing to get gpio
  powerpc/gpio: Fix the wrong GPIO input data on MPC8572/MPC8536
  gpiolib: use platform GPIO mappings as fallback
  Documentation: gpiolib: add 00-INDEX file
  gpiolib: fix lookup of platform-mapped GPIOs
  gpiolib: add missing declarations
This commit is contained in:
Linus Torvalds 2013-12-04 08:59:33 -08:00
commit 8ecffd7914
4 changed files with 38 additions and 7 deletions

View file

@ -0,0 +1,14 @@
00-INDEX
- This file
gpio.txt
- Introduction to GPIOs and their kernel interfaces
consumer.txt
- How to obtain and use GPIOs in a driver
driver.txt
- How to write a GPIO driver
board.txt
- How to assign GPIOs to a consumer device and a function
sysfs.txt
- Information about the GPIO sysfs interface
gpio-legacy.txt
- Historical documentation of the deprecated GPIO integer interface

View file

@ -70,10 +70,14 @@ static int mpc8572_gpio_get(struct gpio_chip *gc, unsigned int gpio)
u32 val;
struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
struct mpc8xxx_gpio_chip *mpc8xxx_gc = to_mpc8xxx_gpio_chip(mm);
u32 out_mask, out_shadow;
val = in_be32(mm->regs + GPIO_DAT) & ~in_be32(mm->regs + GPIO_DIR);
out_mask = in_be32(mm->regs + GPIO_DIR);
return (val | mpc8xxx_gc->data) & mpc8xxx_gpio2mask(gpio);
val = in_be32(mm->regs + GPIO_DAT) & ~out_mask;
out_shadow = mpc8xxx_gc->data & out_mask;
return (val | out_shadow) & mpc8xxx_gpio2mask(gpio);
}
static int mpc8xxx_gpio_get(struct gpio_chip *gc, unsigned int gpio)

View file

@ -2368,7 +2368,7 @@ static struct gpio_desc *gpiod_find(struct device *dev, const char *con_id,
continue;
}
if (chip->ngpio >= p->chip_hwnum) {
if (chip->ngpio <= p->chip_hwnum) {
dev_warn(dev, "GPIO chip %s has %d GPIOs\n",
chip->label, chip->ngpio);
continue;
@ -2418,7 +2418,7 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
const char *con_id,
unsigned int idx)
{
struct gpio_desc *desc;
struct gpio_desc *desc = NULL;
int status;
enum gpio_lookup_flags flags = 0;
@ -2431,13 +2431,23 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
} else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) {
dev_dbg(dev, "using ACPI for GPIO lookup\n");
desc = acpi_find_gpio(dev, con_id, idx, &flags);
} else {
}
/*
* Either we are not using DT or ACPI, or their lookup did not return
* a result. In that case, use platform lookup as a fallback.
*/
if (!desc || IS_ERR(desc)) {
struct gpio_desc *pdesc;
dev_dbg(dev, "using lookup tables for GPIO lookup");
desc = gpiod_find(dev, con_id, idx, &flags);
pdesc = gpiod_find(dev, con_id, idx, &flags);
/* If used as fallback, do not replace the previous error */
if (!IS_ERR(pdesc) || !desc)
desc = pdesc;
}
if (IS_ERR(desc)) {
dev_warn(dev, "lookup for GPIO %s failed\n", con_id);
dev_dbg(dev, "lookup for GPIO %s failed\n", con_id);
return desc;
}

View file

@ -2,9 +2,12 @@
#define __LINUX_GPIO_DRIVER_H
#include <linux/types.h>
#include <linux/module.h>
struct device;
struct gpio_desc;
struct of_phandle_args;
struct device_node;
struct seq_file;
/**