<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/gpio/gpiolib.c, branch linux-5.0.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.0.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.0.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-05-16T17:40:26Z</updated>
<entry>
<title>gpio: Fix gpiochip_add_data_with_key() error path</title>
<updated>2019-05-16T17:40:26Z</updated>
<author>
<name>Geert Uytterhoeven</name>
</author>
<published>2019-04-24T13:59:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=26f70c4e0aef85b2bf3bfedb5061bab7d9a5d8a2'/>
<id>urn:sha1:26f70c4e0aef85b2bf3bfedb5061bab7d9a5d8a2</id>
<content type='text'>
[ Upstream commit 357798909164bf423eac6a78ff7da7e98d2d7f7f ]

The err_remove_chip block is too coarse, and may perform cleanup that
must not be done.  E.g. if of_gpiochip_add() fails, of_gpiochip_remove()
is still called, causing:

    OF: ERROR: Bad of_node_put() on /soc/gpio@e6050000
    CPU: 1 PID: 20 Comm: kworker/1:1 Not tainted 5.1.0-rc2-koelsch+ #407
    Hardware name: Generic R-Car Gen2 (Flattened Device Tree)
    Workqueue: events deferred_probe_work_func
    [&lt;c020ec74&gt;] (unwind_backtrace) from [&lt;c020ae58&gt;] (show_stack+0x10/0x14)
    [&lt;c020ae58&gt;] (show_stack) from [&lt;c07c1224&gt;] (dump_stack+0x7c/0x9c)
    [&lt;c07c1224&gt;] (dump_stack) from [&lt;c07c5a80&gt;] (kobject_put+0x94/0xbc)
    [&lt;c07c5a80&gt;] (kobject_put) from [&lt;c0470420&gt;] (gpiochip_add_data_with_key+0x8d8/0xa3c)
    [&lt;c0470420&gt;] (gpiochip_add_data_with_key) from [&lt;c0473738&gt;] (gpio_rcar_probe+0x1d4/0x314)
    [&lt;c0473738&gt;] (gpio_rcar_probe) from [&lt;c052fca8&gt;] (platform_drv_probe+0x48/0x94)

and later, if a GPIO consumer tries to use a GPIO from a failed
controller:

    WARNING: CPU: 0 PID: 1 at lib/refcount.c:156 kobject_get+0x38/0x4c
    refcount_t: increment on 0; use-after-free.
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.1.0-rc2-koelsch+ #407
    Hardware name: Generic R-Car Gen2 (Flattened Device Tree)
    [&lt;c020ec74&gt;] (unwind_backtrace) from [&lt;c020ae58&gt;] (show_stack+0x10/0x14)
    [&lt;c020ae58&gt;] (show_stack) from [&lt;c07c1224&gt;] (dump_stack+0x7c/0x9c)
    [&lt;c07c1224&gt;] (dump_stack) from [&lt;c0221580&gt;] (__warn+0xd0/0xec)
    [&lt;c0221580&gt;] (__warn) from [&lt;c02215e0&gt;] (warn_slowpath_fmt+0x44/0x6c)
    [&lt;c02215e0&gt;] (warn_slowpath_fmt) from [&lt;c07c58fc&gt;] (kobject_get+0x38/0x4c)
    [&lt;c07c58fc&gt;] (kobject_get) from [&lt;c068b3ec&gt;] (of_node_get+0x14/0x1c)
    [&lt;c068b3ec&gt;] (of_node_get) from [&lt;c0686f24&gt;] (of_find_node_by_phandle+0xc0/0xf0)
    [&lt;c0686f24&gt;] (of_find_node_by_phandle) from [&lt;c0686fbc&gt;] (of_phandle_iterator_next+0x68/0x154)
    [&lt;c0686fbc&gt;] (of_phandle_iterator_next) from [&lt;c0687fe4&gt;] (__of_parse_phandle_with_args+0x40/0xd0)
    [&lt;c0687fe4&gt;] (__of_parse_phandle_with_args) from [&lt;c0688204&gt;] (of_parse_phandle_with_args_map+0x100/0x3ac)
    [&lt;c0688204&gt;] (of_parse_phandle_with_args_map) from [&lt;c0471240&gt;] (of_get_named_gpiod_flags+0x38/0x380)
    [&lt;c0471240&gt;] (of_get_named_gpiod_flags) from [&lt;c046f864&gt;] (gpiod_get_from_of_node+0x24/0xd8)
    [&lt;c046f864&gt;] (gpiod_get_from_of_node) from [&lt;c0470aa4&gt;] (devm_fwnode_get_index_gpiod_from_child+0xa0/0x144)
    [&lt;c0470aa4&gt;] (devm_fwnode_get_index_gpiod_from_child) from [&lt;c05f425c&gt;] (gpio_keys_probe+0x418/0x7bc)
    [&lt;c05f425c&gt;] (gpio_keys_probe) from [&lt;c052fca8&gt;] (platform_drv_probe+0x48/0x94)

Fix this by splitting the cleanup block, and adding a missing call to
gpiochip_irqchip_remove().

Fixes: 28355f81969962cf ("gpio: defer probe if pinctrl cannot be found")
Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Reviewed-by: Mukesh Ojha &lt;mojha@codeaurora.org&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>gpiolib: fix line event timestamps for nested irqs</title>
<updated>2019-01-23T16:24:01Z</updated>
<author>
<name>Bartosz Golaszewski</name>
</author>
<published>2019-01-04T10:24:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1033be58992f818dc564196ded2bcc3f360bc297'/>
<id>urn:sha1:1033be58992f818dc564196ded2bcc3f360bc297</id>
<content type='text'>
Nested interrupts run inside the calling thread's context and the top
half handler is never called which means that we never read the
timestamp.

This issue came up when trying to read line events from a gpiochip
using regmap_irq_chip for interrupts.

Fix it by reading the timestamp from the irq thread function if it's
still 0 by the time the second handler is called.

Fixes: d58f2bf261fd ("gpio: Timestamp events in hardirq handler")
Cc: stable@vger.kernel.org
Signed-off-by: Bartosz Golaszewski &lt;bgolaszewski@baylibre.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'gpio-v4.21-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio</title>
<updated>2018-12-29T04:00:21Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2018-12-29T04:00:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=24dc83635ffe3c93d8122099a83ee228c9b7e4f7'/>
<id>urn:sha1:24dc83635ffe3c93d8122099a83ee228c9b7e4f7</id>
<content type='text'>
Pull GPIO updates from Linus Walleij:
 "This is the bulk of GPIO changes for the v4.21 kernel series.

  Core changes:

   - Some core changes are already in outside of this pull request as
     they came through the regulator tree, most notably
     devm_gpiod_unhinge() that removes devres refcount management from a
     GPIO descriptor. This is needed in subsystems such as regulators
     where the regulator core need to take over the reference counting
     and lifecycle management for a GPIO descriptor.

   - We dropped devm_gpiochip_remove() and devm_gpio_chip_match() as
     nothing needs it. We can bring it back if need be.

   - Add a global TODO so people see where we are going. This helps
     setting the direction now that we are two GPIO maintainers.

   - Handle the MMC CD/WP properties in the device tree core. (The bulk
     of patches activating this code is already merged through the
     MMC/SD tree.)

   - Augment gpiochip_request_own_desc() to pass a flag so we as
     gpiochips can request lines as active low or open drain etc even
     from ourselves.

  New drivers:

   - New driver for Cadence GPIO blocks.

   - New driver for Atmel SAMA5D2 PIOBU GPIO lines.

  Driver improvements:

   - A major refactoring of the PCA953x driver - this driver has been
     around for ages, and is now modernized to reduce code duplication
     that has stacked up and is using regmap to read write and cache
     registers.

   - Intel drivers are now maintained in a separate tree and start with
     a round of cleanups and unifications"

* tag 'gpio-v4.21-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (99 commits)
  gpio: sama5d2-piobu: Depend on OF_GPIO
  gpio: Add Cadence GPIO driver
  dt-bindings: gpio: Add bindings for Cadence GPIO
  gpiolib-acpi: remove unused variable 'err', cleans up build warning
  gpio: mxs: read pin level directly instead of using .get
  gpio: aspeed: remove duplicated statement
  gpio: add driver for SAMA5D2 PIOBU pins
  dt-bindings: arm: atmel: describe SECUMOD usage as a GPIO controller
  gpio/mmc/of: Respect polarity in the device tree
  dt-bindings: gpio: rcar: Add r8a774c0 (RZ/G2E) support
  memory: omap-gpmc: Get the header of the enum
  ARM: omap1: Fix new user of gpiochip_request_own_desc()
  gpio: pca953x: Add regmap dependency for PCA953x driver
  gpio: raspberrypi-exp: decrease refcount on firmware dt node
  gpiolib: Fix return value of gpio_to_desc() stub if !GPIOLIB
  gpio: pca953x: Restore registers after suspend/resume cycle
  gpio: pca953x: Zap single use of pca953x_read_single()
  gpio: pca953x: Zap ad-hoc reg_output cache
  gpio: pca953x: Zap ad-hoc reg_direction cache
  gpio: pca953x: Perform basic regmap conversion
  ...
</content>
</entry>
<entry>
<title>gpio: Pass a flag to gpiochip_request_own_desc()</title>
<updated>2018-12-14T13:24:33Z</updated>
<author>
<name>Linus Walleij</name>
</author>
<published>2018-09-04T11:31:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=21abf103818a4735e80fb0ab03934bed8ae9a028'/>
<id>urn:sha1:21abf103818a4735e80fb0ab03934bed8ae9a028</id>
<content type='text'>
Before things go out of hand, make it possible to pass
flags when requesting "own" descriptors from a gpio_chip.
This is necessary if the chip wants to request a GPIO with
active low semantics, for example.

Cc: Janusz Krzysztofik &lt;jmkrzyszt@gmail.com&gt;
Cc: Thomas Petazzoni &lt;thomas.petazzoni@free-electrons.com&gt;
Cc: Jason Cooper &lt;jason@lakedaemon.net&gt;
Cc: Jiri Kosina &lt;jkosina@suse.cz&gt;
Cc: Roger Quadros &lt;rogerq@ti.com&gt;
Reviewed-by: Gregory CLEMENT &lt;gregory.clement@free-electrons.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-4.21</title>
<updated>2018-12-11T20:44:49Z</updated>
<author>
<name>Mark Brown</name>
</author>
<published>2018-12-11T20:44:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e6202e8249aa7115af65f2d80b43c132816224ef'/>
<id>urn:sha1:e6202e8249aa7115af65f2d80b43c132816224ef</id>
<content type='text'>
</content>
</entry>
<entry>
<title>gpio: Enable nonexclusive gpiods from DT nodes</title>
<updated>2018-12-11T01:04:12Z</updated>
<author>
<name>Linus Walleij</name>
</author>
<published>2018-12-06T12:43:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ec757001c818c175e6b610e8ef80c2a25d1ed1a5'/>
<id>urn:sha1:ec757001c818c175e6b610e8ef80c2a25d1ed1a5</id>
<content type='text'>
This makes gpiod_get_from_of_node() respect the
GPIOD_FLAGS_BIT_NONEXCLUSIVE flag which is especially
nice when getting regulator GPIOs right out of device
tree nodes.

Suggested-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Fixes: b0ce7b29bfcd ("regulator/gpio: Allow nonexclusive GPIO access")
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Reviewed-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Tested-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Reviewed-by: Charles Keepax &lt;ckeepax@opensource.cirrus.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>gpio: drop devm_gpio_chip_match()</title>
<updated>2018-11-15T08:58:15Z</updated>
<author>
<name>Laurent Pinchart</name>
</author>
<published>2018-11-07T23:15:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0696d79456881e79c025cee35950e4a8334ce853'/>
<id>urn:sha1:0696d79456881e79c025cee35950e4a8334ce853</id>
<content type='text'>
Commit 48207d7595d2 ("gpio: drop devm_gpiochip_remove()") dropped the
last user of drop devm_gpio_chip_match(), causing a defined but not used
compilation warning. Fix it by removing the function.

Fixes: 48207d7595d2 ("gpio: drop devm_gpiochip_remove()")
Signed-off-by: Laurent Pinchart &lt;laurent.pinchart+renesas@ideasonboard.com&gt;
Acked-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Acked-by: Olof Johansson &lt;olof@lixom.net&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>gpio: don't free unallocated ida on gpiochip_add_data_with_key() error path</title>
<updated>2018-11-09T10:16:57Z</updated>
<author>
<name>Vladimir Zapolskiy</name>
</author>
<published>2018-11-02T13:39:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a05a14049999598a3bb6fab12db6b768a0215522'/>
<id>urn:sha1:a05a14049999598a3bb6fab12db6b768a0215522</id>
<content type='text'>
The change corrects the error path in gpiochip_add_data_with_key()
by avoiding to call ida_simple_remove(), if ida_simple_get() returns
an error.

Note that ida_simple_remove()/ida_free() throws a BUG(), if id argument
is negative, it allows to easily check the correctness of the fix by
fuzzing the return value from ida_simple_get().

Fixes: ff2b13592299 ("gpio: make the gpiochip a real device")
Cc: stable@vger.kernel.org # v4.6+
Signed-off-by: Vladimir Zapolskiy &lt;vz@mleia.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>gpiolib: Fix possible use after free on label</title>
<updated>2018-11-05T07:54:42Z</updated>
<author>
<name>Muchun Song</name>
</author>
<published>2018-11-01T13:12:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=18534df419041e6c1f4b41af56ee7d41f757815c'/>
<id>urn:sha1:18534df419041e6c1f4b41af56ee7d41f757815c</id>
<content type='text'>
gpiod_request_commit() copies the pointer to the label passed as
an argument only to be used later. But there's a chance the caller
could immediately free the passed string(e.g., local variable).
This could trigger a use after free when we use gpio label(e.g.,
gpiochip_unlock_as_irq(), gpiochip_is_requested()).

To be on the safe side: duplicate the string with kstrdup_const()
so that if an unaware user passes an address to a stack-allocated
buffer, we won't get the arbitrary label.

Also fix gpiod_set_consumer_name().

Signed-off-by: Muchun Song &lt;smuchun@gmail.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>gpio: drop devm_gpiochip_remove()</title>
<updated>2018-11-05T07:54:42Z</updated>
<author>
<name>Uwe Kleine-König</name>
</author>
<published>2018-10-05T19:42:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=48207d7595d2be604e21228e5a93aaff17e4b808'/>
<id>urn:sha1:48207d7595d2be604e21228e5a93aaff17e4b808</id>
<content type='text'>
There is hardly any reason to call devm_gpiochip_remove() because the
driver core handles calling gpiochip_remove() automatically.

To make it harder to introduce new (and probably unneeded) callers, drop
the function.

Signed-off-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
</feed>
