[RFC PATCH 0/4] hwspinlock: refactor headers into public provider/consumer pair

Wolfram Sang
2026-01-25T18:51:56Z

TLDR: I want to create a hwspinlock provider outside of the hwspinlock
directory. So, I refactored the headers into a provider/consumer pair.
Which seems to me like a reasonable seperation anyhow. No functional
changes. My build tests went fine and buildbots are happy, too.

Longer explanation:

There is a device (MFIS) in newer Renesas SoCs which combines various
things like hwspinlocks, mailboxes and other stuff. Sadly, these are not
strictly separated. Registers are kind of mixed and its register
unprotection scheme will need one of its own locks. I tried various
paths to handle this device (MFD, auxiliary bus) but I concluded that
the sub-device dependencies give enough reasons for a single driver in
drivers/soc/. So, this series will allow me to instantiate a hwspinlock
provider from the other directory.

Patches 1+2 do the actual refactoring with a fallback being in place. I
used '-B' with git-format-patch in this RFC, so the actual changes are
more visible when the headers are moved.

Patch 3 converts all the users. There are not many. We could try to get
all the acks for this single patch. Or I can break it into single
patches and send them to subsystems. I don't mind.

Patch 4 simply removes the fallback.

Looking forward to comments on this approach. If the hwspinlock
maintainers like it as is, I would kindly propose to apply patches 1+2
after 7.0-rc1 comes out. This might sound a bit hasty, but a) I want to
avoid chasing a moving target and b) this would remove one dependency of
the hwspinlock driver I originally intend to upstream, of course.

I would take care of patches 3+4 as needed.

A branch can be found here:

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

Patches are based on linux-next as of 2026-01-21.

Opinions?

Thanks and happy hacking,

Wolfram

Wolfram Sang (4):
hwspinlock: refactor existing headers into provider.h
hwspinlock: refactor existing headers into consumer.h
treewide: convert hwspinlock users to the new consumer header file
hwspinlock: remove old header file

Documentation/locking/hwspinlock.rst | 2 +-
MAINTAINERS | 2 +-
drivers/base/regmap/regmap.c | 2 +-
drivers/hwspinlock/hwspinlock_core.c | 5 +--
drivers/hwspinlock/omap_hwspinlock.c | 4 +-
drivers/hwspinlock/qcom_hwspinlock.c | 4 +-
drivers/hwspinlock/sprd_hwspinlock.c | 4 +-
drivers/hwspinlock/stm32_hwspinlock.c | 4 +-
drivers/hwspinlock/sun6i_hwspinlock.c | 4 +-
drivers/hwspinlock/u8500_hsem.c | 5 +--
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} | 22 ++--------
.../linux/hwspinlock/provider.h | 40 ++++++++++++-------
20 files changed, 49 insertions(+), 65 deletions(-)
rename include/linux/{hwspinlock.h => hwspinlock/consumer.h} (94%)
rename drivers/hwspinlock/hwspinlock_internal.h => include/linux/hwspinlock/provider.h (78%)

--
2.47.3