<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/gpio/gpiolib.c, branch linux-4.6.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.6.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.6.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2016-07-27T15:42:10Z</updated>
<entry>
<title>Revert "gpiolib: Split GPIO flags parsing and GPIO configuration"</title>
<updated>2016-07-27T15:42:10Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2016-07-03T16:32:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2710687940b78c28ce1200f30a384637bf52723c'/>
<id>urn:sha1:2710687940b78c28ce1200f30a384637bf52723c</id>
<content type='text'>
commit 85b03b3033fd4eba82665b3b9902c095a08cc52f upstream.

This reverts commit 923b93e451db876d1479d3e4458fce14fec31d1c.

Make sure consumers do not overwrite gpio flags for pins that have
already been claimed.

While adding support for gpio drivers to refuse a request using
unsupported flags, the order of when the requested flag was checked and
the new flags were applied was reversed to that consumers could
overwrite flags for already requested gpios.

This not only affects device-tree setups where two drivers could request
the same gpio using conflicting configurations, but also allowed user
space to clear gpio flags for already claimed pins simply by attempting
to export them through the sysfs interface. By for example clearing the
FLAG_ACTIVE_LOW flag this way, user space could effectively change the
polarity of a signal.

Reverting this change obviously prevents gpio drivers from doing sanity
checks on the flags in their request callbacks. Fortunately only one
recently added driver (gpio-tps65218 in v4.6) appears to do this, and a
follow up patch could restore this functionality through a different
interface.

Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>gpio: make library immune to error pointers</title>
<updated>2016-07-27T15:42:10Z</updated>
<author>
<name>Linus Walleij</name>
</author>
<published>2016-06-16T09:55:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=70e0536488069faa8381a44f9e97a03c6c02e8d3'/>
<id>urn:sha1:70e0536488069faa8381a44f9e97a03c6c02e8d3</id>
<content type='text'>
commit c0a1ecb9f4e208f4b75d88fa9669748e3fd705ab upstream.

Most functions that take a GPIO descriptor in need to check the
descriptor for IS_ERR(). We do this mostly in the VALIDATE_DESC()
macro except for the gpiod_to_irq() function which needs special
handling.

Reported-by: Grygorii Strashko &lt;grygorii.strashko@ti.com&gt;
Reviewed-by: Grygorii Strashko &lt;grygorii.strashko@ti.com&gt;
Acked-by: Alexandre Courbot &lt;acourbot@nvidia.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>gpio: make sure gpiod_to_irq() returns negative on NULL desc</title>
<updated>2016-06-24T17:22:06Z</updated>
<author>
<name>Linus Walleij</name>
</author>
<published>2016-06-15T20:57:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c6ad700afe337609d7d0ee37be0e469f08e86a1a'/>
<id>urn:sha1:c6ad700afe337609d7d0ee37be0e469f08e86a1a</id>
<content type='text'>
commit 79bb71bd1d93197ce227fa167b450b633f30a52b upstream.

commit 54d77198fdfbc4f0fe11b4252c1d9c97d51a3264
("gpio: bail out silently on NULL descriptors")
doesn't work for gpiod_to_irq(): drivers assume that NULL
descriptors will give negative IRQ numbers in return.

It has been pointed out that returning 0 is NO_IRQ and that
drivers should be amended to treat this as an error, but that
is for the longer term: now let us repair the semantics.

Cc: Maxime Ripard &lt;maxime.ripard@free-electrons.com&gt;
Reported-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Tested-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>gpiolib: Fix unaligned used of reference counters</title>
<updated>2016-06-24T17:22:02Z</updated>
<author>
<name>Ricardo Ribalda Delgado</name>
</author>
<published>2016-06-03T17:10:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=55d32af72aba4e0310fc38a39ef38b2ac73163a5'/>
<id>urn:sha1:55d32af72aba4e0310fc38a39ef38b2ac73163a5</id>
<content type='text'>
commit f4833b8cc7edab57d3f3033e549111a546c2e02b upstream.

gpiolib relies on the reference counters to clean up the gpio_device
structure.

Although the number of get/put is properly aligned on gpiolib.c
itself, it does not take into consideration how the referece counters
are affected by other external functions such as cdev_add and device_add.

Because of this, after the last call to put_device, the reference counter
has a value of +3, therefore never calling gpiodevice_release.

Due to the fact that some of the device  has already been cleaned on
gpiochip_remove, the library will end up OOPsing the kernel (e.g. a call
to of_gpiochip_find_and_xlate).

Signed-off-by: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>gpiolib: Fix NULL pointer deference</title>
<updated>2016-06-24T17:22:02Z</updated>
<author>
<name>Ricardo Ribalda Delgado</name>
</author>
<published>2016-06-03T17:10:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d917611dc7234bc15662b07cde0ad4d5438277ce'/>
<id>urn:sha1:d917611dc7234bc15662b07cde0ad4d5438277ce</id>
<content type='text'>
commit 11f33a6d15bfa397867ac0d7f3481b6dd683286f upstream.

Under some circumstances, a gpiochip might be half cleaned from the
gpio_device list.

This patch makes sure that the chip pointer is still valid, before
calling the match function.

[  104.088296] BUG: unable to handle kernel NULL pointer dereference at
0000000000000090
[  104.089772] IP: [&lt;ffffffff813d2045&gt;] of_gpiochip_find_and_xlate+0x15/0x80
[  104.128273] Call Trace:
[  104.129802]  [&lt;ffffffff813d2030&gt;] ? of_parse_own_gpio+0x1f0/0x1f0
[  104.131353]  [&lt;ffffffff813cd910&gt;] gpiochip_find+0x60/0x90
[  104.132868]  [&lt;ffffffff813d21ba&gt;] of_get_named_gpiod_flags+0x9a/0x120
...
[  104.141586]  [&lt;ffffffff8163d12b&gt;] gpio_led_probe+0x11b/0x360

Signed-off-by: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>gpio: bail out silently on NULL descriptors</title>
<updated>2016-06-24T17:22:02Z</updated>
<author>
<name>Linus Walleij</name>
</author>
<published>2016-05-30T14:48:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ecfb6ce5c09ce1fbfde39418123d4fc8ab4b7985'/>
<id>urn:sha1:ecfb6ce5c09ce1fbfde39418123d4fc8ab4b7985</id>
<content type='text'>
commit 54d77198fdfbc4f0fe11b4252c1d9c97d51a3264 upstream.

In fdeb8e1547cb9dd39d5d7223b33f3565cf86c28e
("gpio: reflect base and ngpio into gpio_device")
assumed that GPIO descriptors are either valid or error
pointers, but gpiod_get_[index_]optional() actually return
NULL descriptors and then all subsequent calls should just
bail out.

Cc: Sergei Shtylyov &lt;sergei.shtylyov@cogentembedded.com&gt;
Cc: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Cc: Andrew Lunn &lt;andrew@lunn.ch&gt;
Fixes: fdeb8e1547cb ("gpio: reflect base and ngpio into gpio_device")
Reported-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>gpiolib: Defer gpio device setup until after gpiolib initialization</title>
<updated>2016-04-08T08:10:09Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2016-03-31T15:11:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=159f3cd92f17c61a4e2a47456de5865b114ef88e'/>
<id>urn:sha1:159f3cd92f17c61a4e2a47456de5865b114ef88e</id>
<content type='text'>
Since commit ff2b13592299 ("gpio: make the gpiochip a real device"),
attempts to add a gpio chip prior to gpiolib initialization cause
the system to crash. This happens because gpio_bus_type has not been
registered yet. Defer creating gpio devices until after gpiolib has
been initialized to fix the problem.

Cc: Greg Ungerer &lt;gerg@uclinux.org&gt;
Cc: Alexandre Courbot &lt;gnurou@gmail.com&gt;
Fixes: ff2b13592299 ("gpio: make the gpiochip a real device")
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>gpiolib: Do not use devm functions when registering gpio chip</title>
<updated>2016-04-08T08:10:09Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2016-03-31T15:11:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=476e2fc5cd430bbe17598833e79f8e8b9e4bbbc7'/>
<id>urn:sha1:476e2fc5cd430bbe17598833e79f8e8b9e4bbbc7</id>
<content type='text'>
It is possible that a gpio chip is registered before the gpiolib
initialization code has run. This means we can not use devm_ functions
to allocate memory at that time. Do it the old fashioned way.

Cc: Alexandre Courbot &lt;gnurou@gmail.com&gt;
Cc: Greg Ungerer &lt;gerg@uclinux.org&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>gpio / ACPI: ignore GpioInt() GPIOs when requesting GPIO_OUT_*</title>
<updated>2016-04-08T08:10:08Z</updated>
<author>
<name>Dmitry Torokhov</name>
</author>
<published>2016-03-24T17:50:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=25487533ff311014b0cc39ed7fd721c114e1b11f'/>
<id>urn:sha1:25487533ff311014b0cc39ed7fd721c114e1b11f</id>
<content type='text'>
When firmware does not use _DSD properties that allow properly name GPIO
resources, the kernel falls back on parsing _CRS resources, and will
return entries described as GpioInt() as general purpose GPIOs even
though they are meant to be used simply as interrupt sources for the
device:

Device (ETSA)
{
	Name (_HID, "ELAN0001")
	...

	Method(_CRS, 0x0, NotSerialized)
	{
		Name(BUF0,ResourceTemplate ()
		{
			I2CSerialBus(
				0x10,                     /* SlaveAddress */
				ControllerInitiated,      /* SlaveMode */
				400000,                   /* ConnectionSpeed */
				AddressingMode7Bit,       /* AddressingMode */
				"\\_SB.I2C1",             /* ResourceSource */
			)
			GpioInt (Edge, ActiveLow, ExclusiveAndWake, PullNone,,
				 "\\_SB.GPSW") { BOARD_TOUCH_GPIO_INDEX }
		} )
		Return (BUF0)
	}
...
}

This gives troubles with drivers such as Elan Touchscreen driver
(elants_i2c) that uses devm_gpiod_get to look up "reset" GPIO line and
decide whether the driver is responsible for powering up and resetting
the device, or firmware is. In the above case the lookup succeeds, we
map GPIO as output and later fail to request client-&gt;irq interrupt that
is mapped to the same GPIO.

Let's ignore resources described as GpioInt() while parsing _CRS when
requesting output GPIOs (but allow them when requesting GPIOD_ASIS or
GPIOD_IN as some drivers, such as i2c-hid, do request GPIO as input and
then map it to interrupt with gpiod_to_irq).

Acked-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Signed-off-by: Dmitry Torokhov &lt;dtor@chromium.org&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>gpiolib: Fix comment referring to gpio_*() in gpiod_*()</title>
<updated>2016-03-16T12:11:11Z</updated>
<author>
<name>Geert Uytterhoeven</name>
</author>
<published>2016-03-14T15:24:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1cfab8f8b397f7d95ad43f72ed9a1fa7d26e210e'/>
<id>urn:sha1:1cfab8f8b397f7d95ad43f72ed9a1fa7d26e210e</id>
<content type='text'>
Fixes: 79a9becda8940deb ("gpiolib: export descriptor-based GPIO interface")
Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
</feed>
