public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [RFC v2 PATCH 00/13] hwspinlock: move device alloc into core and refactor includes
@ 2026-02-15 22:54 Wolfram Sang
  2026-02-15 22:54 ` [RFC PATCH v2 01/13] hwspinlock: add helpers to retrieve core data Wolfram Sang
                   ` (13 more replies)
  0 siblings, 14 replies; 25+ messages in thread
From: Wolfram Sang @ 2026-02-15 22:54 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Andy Shevchenko, linux-arm-kernel, Wolfram Sang, Alexandre Torgue,
	Andy Shevchenko, Antonio Borneo, Arnd Bergmann, Baolin Wang,
	Bjorn Andersson, Boqun Feng, Chen-Yu Tsai, Chunyan Zhang,
	Danilo Krummrich, David Lechner, driver-core, Greg Kroah-Hartman,
	Ingo Molnar, Jernej Skrabec, Jonathan Cameron, Jonathan Corbet,
	Konrad Dybcio, Lee Jones, Linus Walleij, linux-arm-msm, linux-doc,
	linux-gpio, linux-iio, linux-omap, linux-remoteproc, linux-spi,
	linux-stm32, linux-sunxi, Mark Brown, Maxime Coquelin,
	Nuno Sá, Orson Zhai, Peter Zijlstra, Rafael J. Wysocki,
	Samuel Holland, Shuah Khan, Srinivas Kandagatla, Thomas Gleixner,
	Waiman Long, Wilken Gottwalt, Will Deacon

My ultimate goal is to allow hwspinlock provider drivers outside of the
subsystem directory. It turned out that a simple split of the headers
files into a public provider and a public consumer header file is not
enough because core internal structure need to stay hidden. Even more,
their opaqueness could and should even be increased. That would also
allow the core to handle the de-/allocation of the hwspinlock device
itself.

This series does all that. Patches 1-7 abstract access to internal
structures away using helpers. Patch 8 then move hwspinlock device
handling to the core, simplifying drivers. The remaining patches
refactor the headers until the internal one is gone and the public ones
are divided into provider and consumer parts. More details are given in
the patch descriptions.

One note about using a callback to initialize hwspinlock priv: I also
experimented with a dedicated 'set_priv' helper function. It felt a bit
clumsy to me. Drivers would need to save the 'bank' pointer again and
iterate over it. Because most drivers will only have a simple callback
anyhow, it looked leaner to me.

This series is based on the cleanup series "hwspinlock: remove
platform_data from subsystem" and has been tested on a Renesas
SparrowHawk board (R-Car V4H) with a yet-to-be-upstreamed hwspinlock
driver for the MFIS IP core. A branch can be found here (the MFIS driver
is still WIP):

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/hwspinlock/refactor-alloc-buildtest

Buildbots seem to be happy, too.

Looking forward to comments. I especially wonder if the last patch
should stay as-is or if it should be broken out, so individual
subsystems can pick up their part (with a fallback in place, of course,
until the last user is converted).

Happy hacking,

   Wolfram


Wolfram Sang (13):
  hwspinlock: add helpers to retrieve core data
  hwspinlock: add callback to fill private data of a hwspinlock
  hwspinlock: omap: use new callback to initialize hwspinlock priv
  hwspinlock: qcom: use new callback to initialize hwspinlock priv
  hwspinlock: sprd: use new callback to initialize hwspinlock priv
  hwspinlock: stm32: use new callback to initialize hwspinlock priv
  hwspinlock: sun6i: use new callback to initialize hwspinlock priv
  hwspinlock: handle hwspinlock device allocation in the core
  hwspinlock: move entries from internal to public header
  hwspinlock: remove internal header
  hwspinlock: sort include and update copyright
  hwspinlock: refactor provider.h from public header
  hwspinlock: refactor consumer.h from public header

 Documentation/locking/hwspinlock.rst          |   2 +-
 MAINTAINERS                                   |   2 +-
 drivers/base/regmap/regmap.c                  |   2 +-
 drivers/hwspinlock/hwspinlock_core.c          | 129 +++++++++++++-----
 drivers/hwspinlock/hwspinlock_internal.h      |  72 ----------
 drivers/hwspinlock/omap_hwspinlock.c          |  29 ++--
 drivers/hwspinlock/qcom_hwspinlock.c          |  69 +++++-----
 drivers/hwspinlock/sprd_hwspinlock.c          |  41 +++---
 drivers/hwspinlock/stm32_hwspinlock.c         |  28 ++--
 drivers/hwspinlock/sun6i_hwspinlock.c         |  38 ++----
 drivers/iio/adc/sc27xx_adc.c                  |   2 +-
 drivers/irqchip/irq-stm32mp-exti.c            |   2 +-
 drivers/mfd/syscon.c                          |   2 +-
 drivers/nvmem/sc27xx-efuse.c                  |   2 +-
 drivers/nvmem/sprd-efuse.c                    |   2 +-
 drivers/pinctrl/stm32/pinctrl-stm32.c         |   2 +-
 drivers/soc/qcom/smem.c                       |   2 +-
 drivers/spi/spi-sprd-adi.c                    |   2 +-
 .../{hwspinlock.h => hwspinlock/consumer.h}   |  29 +---
 include/linux/hwspinlock/provider.h           |  60 ++++++++
 20 files changed, 268 insertions(+), 249 deletions(-)
 delete mode 100644 drivers/hwspinlock/hwspinlock_internal.h
 rename include/linux/{hwspinlock.h => hwspinlock/consumer.h} (93%)
 create mode 100644 include/linux/hwspinlock/provider.h

-- 
2.51.0



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2026-02-18 19:57 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-15 22:54 [RFC v2 PATCH 00/13] hwspinlock: move device alloc into core and refactor includes Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 01/13] hwspinlock: add helpers to retrieve core data Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 02/13] hwspinlock: add callback to fill private data of a hwspinlock Wolfram Sang
2026-02-16  8:05   ` Sergey Shtylyov
2026-02-16  8:29     ` Wolfram Sang
2026-02-16 10:12       ` Geert Uytterhoeven
2026-02-16 10:53         ` Wolfram Sang
2026-02-16 16:12           ` Sergey Shtylyov
2026-02-16 16:54             ` Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 03/13] hwspinlock: omap: use new callback to initialize hwspinlock priv Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 04/13] hwspinlock: qcom: " Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 05/13] hwspinlock: sprd: " Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 06/13] hwspinlock: stm32: " Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 07/13] hwspinlock: sun6i: " Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 08/13] hwspinlock: handle hwspinlock device allocation in the core Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 09/13] hwspinlock: move entries from internal to public header Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 10/13] hwspinlock: remove internal header Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 11/13] hwspinlock: sort include and update copyright Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 12/13] hwspinlock: refactor provider.h from public header Wolfram Sang
2026-02-15 22:54 ` [RFC PATCH v2 13/13] hwspinlock: refactor consumer.h " Wolfram Sang
2026-02-16  7:37   ` Andy Shevchenko
2026-02-16 16:07   ` Mark Brown
2026-02-18 19:56   ` Jonathan Cameron
2026-02-16  7:40 ` [RFC v2 PATCH 00/13] hwspinlock: move device alloc into core and refactor includes Andy Shevchenko
2026-02-16  8:34   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox