hwspinlock updates for v5.18

This updates sprd and srm32 drivers to use struct_size() instead of
 their open-coded equivalents. It also cleans up the omap dt-bindings
 example.
 -----BEGIN PGP SIGNATURE-----
 
 iQJPBAABCAA5FiEEBd4DzF816k8JZtUlCx85Pw2ZrcUFAmJDwp8bHGJqb3JuLmFu
 ZGVyc3NvbkBsaW5hcm8ub3JnAAoJEAsfOT8Nma3FU30P/1klYMWH1U9wQfPFYghV
 mZDjzs5+uO8qVOoFZagcum7wsX8v/axFuP+COYTswth6M+aGii+Z+xf4OOSoBJYK
 kY6c9sVb5S1fUahQivWkpJadvCJzCcXi2Qqc9iF7nyXyktx6s5cJQ1++jY3wc11R
 wExxDBje2pD0t+1WLiSxvHG7pmRuzA1dzjqa/7q86Jc3lKzrPSKI0vEVLSWJYm3z
 xn00/dc2wB/+z+HVZJWSYS73EzxEImxL0hce2F0Mdfb7yw1fxlteFJarNmf4fY4I
 XBOJ0YdvFCIz6xfr58ojgKKVVsm6N7m6YOV9a1RwgzvTakEp3O2yFdT5sV4PAuvw
 9aM0j/r6FB0jk2rsSYroFaU50r1hAGQRW3xsDPzU8SRQxfFgqhGrWf3e05vL6IPy
 PkoEHDNNCCWhDToJLQjr5UaA5RSWLfDyCXzvf1Xg99koWW+pxPsi2evkauwDy+w4
 ieEi0EzfGgpdxUlBjmygWkFvKmxdwaW0coQDTdE1JQyo0jYe/WT8ChR3B1VNYvJS
 a2wDR+h+H1QS2MpTskbytzbnduIP598KwkE/zuPgV7Vo0ziicaRNtKRPR80vmY+b
 Lh/LZXSSaZ7KqsqRkoZijtPBpOt5ZnuG6EOCq/nZ0beE51IUm0rvtDzsFaheSpGA
 EvM7DKrYlsJTVYbUTzQWE9nl
 =Rvtc
 -----END PGP SIGNATURE-----

Merge tag 'hwlock-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux

Pull hwspinlock updates from Bjorn Andersson:
 "This updates sprd and srm32 drivers to use struct_size() instead of
  their open-coded equivalents. It also cleans up the omap dt-bindings
  example"

* tag 'hwlock-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux:
  hwspinlock: sprd: Use struct_size() helper in devm_kzalloc()
  hwspinlock: stm32: Use struct_size() helper in devm_kzalloc()
  dt-bindings: hwlock: omap: Remove redundant binding example
This commit is contained in:
Linus Torvalds 2022-03-30 10:47:48 -07:00
commit d177850d5d
3 changed files with 3 additions and 37 deletions

View File

@ -39,39 +39,8 @@ additionalProperties: false
examples:
- |
/* OMAP4 SoCs */
hwspinlock: spinlock@4a0f6000 {
spinlock@4a0f6000 {
compatible = "ti,omap4-hwspinlock";
reg = <0x4a0f6000 0x1000>;
#hwlock-cells = <1>;
};
- |
/ {
/* K3 AM65x SoCs */
model = "Texas Instruments K3 AM654 SoC";
compatible = "ti,am654-evm", "ti,am654";
#address-cells = <2>;
#size-cells = <2>;
bus@100000 {
compatible = "simple-bus";
#address-cells = <2>;
#size-cells = <2>;
ranges = <0x00 0x00100000 0x00 0x00100000 0x00 0x00020000>, /* ctrl mmr */
<0x00 0x30800000 0x00 0x30800000 0x00 0x0bc00000>; /* Main NavSS */
bus@30800000 {
compatible = "simple-mfd";
#address-cells = <2>;
#size-cells = <2>;
ranges = <0x00 0x30800000 0x00 0x30800000 0x00 0x0bc00000>;
spinlock@30e00000 {
compatible = "ti,am654-hwspinlock";
reg = <0x00 0x30e00000 0x00 0x1000>;
#hwlock-cells = <1>;
};
};
};
};

View File

@ -93,8 +93,7 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev)
return -ENODEV;
sprd_hwlock = devm_kzalloc(&pdev->dev,
sizeof(struct sprd_hwspinlock_dev) +
SPRD_HWLOCKS_NUM * sizeof(*lock),
struct_size(sprd_hwlock, bank.lock, SPRD_HWLOCKS_NUM),
GFP_KERNEL);
if (!sprd_hwlock)
return -ENOMEM;

View File

@ -73,15 +73,13 @@ static int stm32_hwspinlock_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct stm32_hwspinlock *hw;
void __iomem *io_base;
size_t array_size;
int i, ret;
io_base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(io_base))
return PTR_ERR(io_base);
array_size = STM32_MUTEX_NUM_LOCKS * sizeof(struct hwspinlock);
hw = devm_kzalloc(dev, sizeof(*hw) + array_size, GFP_KERNEL);
hw = devm_kzalloc(dev, struct_size(hw, bank.lock, STM32_MUTEX_NUM_LOCKS), GFP_KERNEL);
if (!hw)
return -ENOMEM;