[PATCH 0/6] input: use device_for_each_child_node_scoped()

Javier Carrasco posted 6 patches 1 year, 10 months ago
drivers/input/joystick/adc-joystick.c     | 16 +++++-----------
drivers/input/keyboard/adc-keys.c         |  5 +----
drivers/input/keyboard/gpio_keys.c        |  4 +---
drivers/input/keyboard/gpio_keys_polled.c |  4 +---
drivers/input/keyboard/qt1050.c           | 12 ++++--------
drivers/input/misc/iqs269a.c              |  7 ++-----
6 files changed, 14 insertions(+), 34 deletions(-)
[PATCH 0/6] input: use device_for_each_child_node_scoped()
Posted by Javier Carrasco 1 year, 10 months ago
Switch to the _scoped() version introduced in commit 365130fd47af
("device property: Introduce device_for_each_child_node_scoped()")
to remove the need for manual calling of fwnode_handle_put() in the
paths where the code exits the loop early. This modification simplifies
the code and eliminates the risk of leaking memory if any early exit is
added without de-allocating the child node.

There are six users of the non-scoped version in the input subsystem:

- iqs269a
- qt1050
- gpio_keys
- gpio_keys_polled
- adc-keys
- adc-joystick

This series is based on the master branch of linux-next (next-20240412)
to have access to the scoped version of device_for_each_child_node().

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Javier Carrasco (6):
      input: iqs269a: use device_for_each_child_node_scoped()
      input: qt1050: use device_for_each_child_node_scoped()
      input: gpio_keys: use device_for_each_child_node_scoped()
      input: gpio_keys_polled: use device_for_each_child_node_scoped()
      input: adc-keys: use device_for_each_child_node_scoped()
      input: adc-joystick: use device_for_each_child_node_scoped()

 drivers/input/joystick/adc-joystick.c     | 16 +++++-----------
 drivers/input/keyboard/adc-keys.c         |  5 +----
 drivers/input/keyboard/gpio_keys.c        |  4 +---
 drivers/input/keyboard/gpio_keys_polled.c |  4 +---
 drivers/input/keyboard/qt1050.c           | 12 ++++--------
 drivers/input/misc/iqs269a.c              |  7 ++-----
 6 files changed, 14 insertions(+), 34 deletions(-)
---
base-commit: 9ed46da14b9b9b2ad4edb3b0c545b6dbe5c00d39
change-id: 20240404-input_device_for_each_child_node_scoped-0a55a76ad7ee

Best regards,
-- 
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Re: [PATCH 0/6] input: use device_for_each_child_node_scoped()
Posted by Dmitry Torokhov 1 year, 6 months ago
On Fri, Apr 12, 2024 at 10:57:29PM +0200, Javier Carrasco wrote:
> Switch to the _scoped() version introduced in commit 365130fd47af
> ("device property: Introduce device_for_each_child_node_scoped()")
> to remove the need for manual calling of fwnode_handle_put() in the
> paths where the code exits the loop early. This modification simplifies
> the code and eliminates the risk of leaking memory if any early exit is
> added without de-allocating the child node.
> 
> There are six users of the non-scoped version in the input subsystem:
> 
> - iqs269a
> - qt1050
> - gpio_keys
> - gpio_keys_polled
> - adc-keys
> - adc-joystick
> 
> This series is based on the master branch of linux-next (next-20240412)
> to have access to the scoped version of device_for_each_child_node().
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>

Applied the series (after adjusting qt1050 patch), thank you.

-- 
Dmitry