Skip to content

Commit d177850

Browse files
committed
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
2 parents 3312db0 + 9a41358 commit d177850

File tree

3 files changed

+3
-37
lines changed

3 files changed

+3
-37
lines changed

Documentation/devicetree/bindings/hwlock/ti,omap-hwspinlock.yaml

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,39 +39,8 @@ additionalProperties: false
3939
examples:
4040

4141
- |
42-
/* OMAP4 SoCs */
43-
hwspinlock: spinlock@4a0f6000 {
42+
spinlock@4a0f6000 {
4443
compatible = "ti,omap4-hwspinlock";
4544
reg = <0x4a0f6000 0x1000>;
4645
#hwlock-cells = <1>;
4746
};
48-
49-
- |
50-
/ {
51-
/* K3 AM65x SoCs */
52-
model = "Texas Instruments K3 AM654 SoC";
53-
compatible = "ti,am654-evm", "ti,am654";
54-
#address-cells = <2>;
55-
#size-cells = <2>;
56-
57-
bus@100000 {
58-
compatible = "simple-bus";
59-
#address-cells = <2>;
60-
#size-cells = <2>;
61-
ranges = <0x00 0x00100000 0x00 0x00100000 0x00 0x00020000>, /* ctrl mmr */
62-
<0x00 0x30800000 0x00 0x30800000 0x00 0x0bc00000>; /* Main NavSS */
63-
64-
bus@30800000 {
65-
compatible = "simple-mfd";
66-
#address-cells = <2>;
67-
#size-cells = <2>;
68-
ranges = <0x00 0x30800000 0x00 0x30800000 0x00 0x0bc00000>;
69-
70-
spinlock@30e00000 {
71-
compatible = "ti,am654-hwspinlock";
72-
reg = <0x00 0x30e00000 0x00 0x1000>;
73-
#hwlock-cells = <1>;
74-
};
75-
};
76-
};
77-
};

drivers/hwspinlock/sprd_hwspinlock.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev)
9393
return -ENODEV;
9494

9595
sprd_hwlock = devm_kzalloc(&pdev->dev,
96-
sizeof(struct sprd_hwspinlock_dev) +
97-
SPRD_HWLOCKS_NUM * sizeof(*lock),
96+
struct_size(sprd_hwlock, bank.lock, SPRD_HWLOCKS_NUM),
9897
GFP_KERNEL);
9998
if (!sprd_hwlock)
10099
return -ENOMEM;

drivers/hwspinlock/stm32_hwspinlock.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,13 @@ static int stm32_hwspinlock_probe(struct platform_device *pdev)
7373
struct device *dev = &pdev->dev;
7474
struct stm32_hwspinlock *hw;
7575
void __iomem *io_base;
76-
size_t array_size;
7776
int i, ret;
7877

7978
io_base = devm_platform_ioremap_resource(pdev, 0);
8079
if (IS_ERR(io_base))
8180
return PTR_ERR(io_base);
8281

83-
array_size = STM32_MUTEX_NUM_LOCKS * sizeof(struct hwspinlock);
84-
hw = devm_kzalloc(dev, sizeof(*hw) + array_size, GFP_KERNEL);
82+
hw = devm_kzalloc(dev, struct_size(hw, bank.lock, STM32_MUTEX_NUM_LOCKS), GFP_KERNEL);
8583
if (!hw)
8684
return -ENOMEM;
8785

0 commit comments

Comments
 (0)