Changes since RFC v2:
* u8500 and platform_data removal included in this series to make the
dependency crystal clear
* fixed a build failure when adding the callback (Thanks, Sergey!)
This series passes now my improved buildscripts. Buildbots are
happy, too.
* mention why "Contact:" information was dropped (Thanks, Andy!)
* small changes to commit messages
* added tags (Thanks, everyone!)
* dropped RFC status
* rebased to 7.0-rc2
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-2 remove the meanwhile unused
platform_data. Patches 3-9 abstract access to internal
structures away using helpers. Patch 10 then moves 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 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
Happy hacking,
Wolfram
Wolfram Sang (15):
hwspinlock: u8500: delete driver
hwspinlock: remove now unused pdata from header file
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/treewide: refactor consumer.h from public header
Documentation/locking/hwspinlock.rst | 2 +-
MAINTAINERS | 3 +-
drivers/base/regmap/regmap.c | 2 +-
drivers/hwspinlock/Kconfig | 10 --
drivers/hwspinlock/Makefile | 1 -
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/hwspinlock/u8500_hsem.c | 155 ------------------
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} | 57 +------
include/linux/hwspinlock/provider.h | 60 +++++++
23 files changed, 268 insertions(+), 444 deletions(-)
delete mode 100644 drivers/hwspinlock/hwspinlock_internal.h
delete mode 100644 drivers/hwspinlock/u8500_hsem.c
rename include/linux/{hwspinlock.h => hwspinlock/consumer.h} (87%)
create mode 100644 include/linux/hwspinlock/provider.h
--
2.51.0