Skip to content

reset: major reset core refactoring

Bartosz Golaszewski linux-doc lkml 3 versions – Applied

Status from this message: Applied to reset/next, thanks!

Get series with b4
b4 am [email protected] change-id 20251222-reset-core-refactor-5fad7197cbcf

Versions newest first

  1. v3 Latest14 patches 15 repliesApplied
  2. v214 patches 12 repliesSuperseded
  3. v115 patches 7 repliesSuperseded

Changes in v3 from the cover letter

- make kerneldocs for new locks more precise
- in patch 10: rework the release path to fix a race between
reset_control_get() and reset_control_put()
- in patch 13: in case neither of_node nor fwnode is set: try to get the
fwnode from rcdev->dev and if that too fails: bail out with -EINVAL
- Link to v2: https://patch.msgid.link/[email protected]

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/14reset: gpio: remove unneeded OF-node putdrivers/reset/reset-gpio.c+0 -100 replies
2/14reset: gpio: add a devlink between reset-gpio and its consumerdrivers/reset/core.c+55 -240 replies
3/14reset: gpio: simplify fallback device matchingdrivers/reset/core.c drivers/reset/reset-gpio.c include/linux/reset-controller.h+6 -180 replies
4/14reset: gpio: remove unneeded auxiliary_set_drvdata()drivers/reset/reset-gpio.c+0 -20 replies
5/14reset: warn on reset-gpio releasedrivers/reset/core.c+1 -11 reply
6/14reset: fold ida_alloc() into reset_create_gpio_aux_device()drivers/reset/core.c+14 -151 reply
7/14reset: use lock guards in reset coredrivers/reset/core.c+25 -300 replies
8/14reset: handle removing supplier before consumersdrivers/reset/core.c+91 -171 reply
9/14reset: protect struct reset_controller_dev with its own mutexdrivers/reset/core.c include/linux/reset-controller.h+30 -171 reply
10/14reset: protect struct reset_control with its own mutexdrivers/reset/core.c+36 -321 reply
11/14reset: convert of_reset_control_get_count() to using firmware nodesdrivers/reset/core.c+27 -90 replies
12/14reset: convert the core API to using firmware nodesDocumentation/driver-api/reset.rst drivers/reset/core.c include/linux/reset.h+46 -310 replies
13/14reset: convert reset core to using firmware nodesdrivers/reset/core.c include/linux/reset-controller.h+112 -688 replies
14/14reset: gpio: make the driver fwnode-agnosticdrivers/reset/reset-gpio.c+5 -50 replies

Reviews trailers per patch

All 14 patches have a Reviewed-by or Acked-by.

PatchPhilipp Zabel
1/14R-b
2/14R-b
3/14R-b
4/14R-b
5/14R-b
6/14R-b
7/14R-b
8/14R-b
9/14R-b
10/14R-b
11/14R-b
12/14R-b
13/14R-b
14/14R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/14] reset: major reset core refactoring

Here is the promised refactoring of the reset core. The main goal of the series is to make the reset subsystem fwnode-agnostic - meaning it can work with all kinds of firmware nodes instead of being OF-centric - but there are some other related changes in here as well. I'm sending it all out for review to give Phillipp a better picture of the end result but individual pieces can be picked up earlier if accepted.

The series is logically split into several parts:

Patches 1-5: Several reset-gpio improvements. Most are not very controversial but I included a reworked version of the patch adding a firmware device link between the auxiliary reset device and its consumers.

Patches 6-7: Just general improvements.

Patch 8: Before we support all firmware nodes (even software nodes for which no devlinks are created) we need to make sure reset drivers can survive a sudden unbinding of the supplier with consumers still holding references to the controller. This patch addresses it using SRCU.

Patches 9,10: Rework locking in reset core. Make locking fine-grained instead of using a single global lock for everything.

Patches 11-14: Make reset core use fwnode as primary source of device properties and references. Convert reset-gpio to becoming the first fwnode-agnostic driver.

---
Changes in v3:
- make kerneldocs for new locks more precise
- in patch 10: rework the release path to fix a race between
reset_control_get() and reset_control_put()
- in patch 13: in case neither of_node nor fwnode is set: try to get the
fwnode from rcdev->dev and if that too fails: bail out with -EINVAL
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- fix lock guard usage
- tweak commit messages
- fix potential NULL-pointer dereference
- drop unneeded patch (squash it into another one)
- collect tags
- rebase on top of v7.0-rc1
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Bartosz Golaszewski (14):
reset: gpio: remove unneeded OF-node put
reset: gpio: add a devlink between reset-gpio and its consumer
reset: gpio: simplify fallback device matching
reset: gpio: remove unneeded auxiliary_set_drvdata()
reset: warn on reset-gpio release
reset: fold ida_alloc() into reset_create_gpio_aux_device()
reset: use lock guards in reset core
reset: handle removing supplier before consumers
reset: protect struct reset_controller_dev with its own mutex
reset: protect struct reset_control with its own mutex
reset: convert of_reset_control_get_count() to using firmware nodes
reset: convert the core API to using firmware nodes
reset: convert reset core to using firmware nodes
reset: gpio: make the driver fwnode-agnostic

 Documentation/driver-api/reset.rst |   1 -
 drivers/reset/core.c               | 503 ++++++++++++++++++++++++-------------
 drivers/reset/reset-gpio.c         |  27 +-
 include/linux/reset-controller.h   |  21 +-
 include/linux/reset.h              |  43 ++--
 5 files changed, 382 insertions(+), 213 deletions(-)

---
base-commit: 18faab1eb02810f006d269e923fe0964beff42d0
change-id: 20251222-reset-core-refactor-5fad7197cbcf

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>