Commit d177850d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 3312db01 9a413589
Loading
Loading
Loading
Loading
+1 −32
Original line number Diff line number Diff line
@@ -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>;
                };
            };
        };
    };
+1 −2
Original line number Diff line number Diff line
@@ -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;
+1 −3
Original line number Diff line number Diff line
@@ -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;