]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pwm: clps711x: Drop driver local locking
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Tue, 24 Jun 2025 18:15:38 +0000 (20:15 +0200)
committerUwe Kleine-König <ukleinek@kernel.org>
Mon, 7 Jul 2025 06:39:35 +0000 (08:39 +0200)
The pwm core serializes calls to .apply(), so the spinlock adds no
additional protection. Disabling the irq is also irrelevant as the driver
isn't an atomic one and so the callbacks cannot be called from atomic
context.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/d4931dc0c0d657d80722cfe7d97cb4fb4ccec90e.1750788649.git.u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
drivers/pwm/pwm-clps711x.c

index 04559a9de718bc38ea8870d34909f2cf3a2248e5..2c92ce7548723036186dcb6e5053679155508dd1 100644 (file)
@@ -14,7 +14,6 @@
 struct clps711x_chip {
        void __iomem *pmpcon;
        struct clk *clk;
-       spinlock_t lock;
 };
 
 static inline struct clps711x_chip *to_clps711x_chip(struct pwm_chip *chip)
@@ -42,7 +41,6 @@ static int clps711x_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
        struct clps711x_chip *priv = to_clps711x_chip(chip);
        /* PWM0 - bits 4..7, PWM1 - bits 8..11 */
        u32 shift = (pwm->hwpwm + 1) * 4;
-       unsigned long flags;
        u32 pmpcon, val;
 
        if (state->polarity != PWM_POLARITY_NORMAL)
@@ -56,15 +54,11 @@ static int clps711x_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
        else
                val = 0;
 
-       spin_lock_irqsave(&priv->lock, flags);
-
        pmpcon = readl(priv->pmpcon);
        pmpcon &= ~(0xf << shift);
        pmpcon |= val << shift;
        writel(pmpcon, priv->pmpcon);
 
-       spin_unlock_irqrestore(&priv->lock, flags);
-
        return 0;
 }
 
@@ -93,8 +87,6 @@ static int clps711x_pwm_probe(struct platform_device *pdev)
 
        chip->ops = &clps711x_pwm_ops;
 
-       spin_lock_init(&priv->lock);
-
        return devm_pwmchip_add(&pdev->dev, chip);
 }