mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-14 06:24:53 +08:00
Two GPIO fixes for the v4.0 kernel series:
- Fix a translation problem in of_get_named_gpiod_flags() - Fix a long standing container_of() mistake in the TPS65912 driver. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJU9EyeAAoJEEEQszewGV1z16YP/1/sPyqZpj6f6Z9Q3shAffGY chDyxuaf8X7weiRd7vap93BPnnYJeJQkLQQCOEbsGmGsXOxLCIpqv6ShINYsRcnD aUnhVt6c9PxxkllfDaBJfKgXOa+M647Uj0Bzfkl2W9zuIJaeyGqUVOu7rvsFmf8f 44ofuNdHYKHgkFtcdhPthIHC3zhGpDUwKR4OUElgZd89sHLcIEYVT0KQddRY0qE/ RVb3KaP4FrlEL9vFrXABDsh9UufvN29gybAJSuCe/fgqdLAxTsOIoKktA8xNSXZR wWj47pjopRE1/GIJ03ug0boiv0eKwumvUwAn5xlrdJurcIGh0NrHSSF9JPCgMdSK 48+45k+MmYQPJVQG/n4NRgAUv10KbN+0u/4MViNLYzTQuGkoCriei7/FL5/04TOi 52xpdJ3Nf0R/ItzpPrmoNRx8vWzt7vg3SLiQi3kzeej9ej1DW+a9OvDeGiImAtKO MEx0Q3Nm5VNQ5kjiZaRan8/HK/Yys1fESqYdlbOxAEPRaCh3tl78x1jIN+ulivIn myyMyCn3H5y6DEYqORRyw97egqvCjLz6/BqIIuApKNVOy+gpkdmYtpL1GMEOWOJK J+w1fx7cnHXBhGAQHKgmqFvHF9L1Bqadd3RlvXk17XDhxM9mRWka4S4E+08/BEtb qL7OgdAzI0EPn0WxWBKM =5nhV -----END PGP SIGNATURE----- Merge tag 'gpio-v4.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO fixes from Linus Walleij: "Two GPIO fixes: - Fix a translation problem in of_get_named_gpiod_flags() - Fix a long standing container_of() mistake in the TPS65912 driver" * tag 'gpio-v4.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: tps65912: fix wrong container_of arguments gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node
This commit is contained in:
commit
023a6007a0
@ -26,9 +26,12 @@ struct tps65912_gpio_data {
|
||||
struct gpio_chip gpio_chip;
|
||||
};
|
||||
|
||||
#define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip)
|
||||
|
||||
static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset)
|
||||
{
|
||||
struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
|
||||
struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
|
||||
struct tps65912 *tps65912 = tps65912_gpio->tps65912;
|
||||
int val;
|
||||
|
||||
val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset);
|
||||
@ -42,7 +45,8 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset)
|
||||
static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,
|
||||
int value)
|
||||
{
|
||||
struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
|
||||
struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
|
||||
struct tps65912 *tps65912 = tps65912_gpio->tps65912;
|
||||
|
||||
if (value)
|
||||
tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset,
|
||||
@ -55,7 +59,8 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,
|
||||
static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset,
|
||||
int value)
|
||||
{
|
||||
struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
|
||||
struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
|
||||
struct tps65912 *tps65912 = tps65912_gpio->tps65912;
|
||||
|
||||
/* Set the initial value */
|
||||
tps65912_gpio_set(gc, offset, value);
|
||||
@ -66,7 +71,8 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset,
|
||||
|
||||
static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset)
|
||||
{
|
||||
struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio);
|
||||
struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc);
|
||||
struct tps65912 *tps65912 = tps65912_gpio->tps65912;
|
||||
|
||||
return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset,
|
||||
GPIO_CFG_MASK);
|
||||
|
@ -46,12 +46,13 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data)
|
||||
|
||||
ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags);
|
||||
if (ret < 0) {
|
||||
/* We've found the gpio chip, but the translation failed.
|
||||
* Return true to stop looking and return the translation
|
||||
* error via out_gpio
|
||||
/* We've found a gpio chip, but the translation failed.
|
||||
* Store translation error in out_gpio.
|
||||
* Return false to keep looking, as more than one gpio chip
|
||||
* could be registered per of-node.
|
||||
*/
|
||||
gg_data->out_gpio = ERR_PTR(ret);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
gg_data->out_gpio = gpiochip_get_desc(gc, ret);
|
||||
|
Loading…
Reference in New Issue
Block a user