]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pwm: atmel: Drop driver local locking
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>
Tue, 24 Jun 2025 18:15:37 +0000 (20:15 +0200)
committerUwe Kleine-König <ukleinek@kernel.org>
Mon, 7 Jul 2025 06:39:35 +0000 (08:39 +0200)
The two functions making use of the lock are only called transitively from
.apply(). Calls to .apply() are already serialized by the pwm core so the
lock in the driver has no effect and can safely be dropped.

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

index b2f0abbbad630a3b3240f08a52f4706e5c70b383..06d22d0f7b261419384d2399f76969fb3a79895b 100644 (file)
@@ -91,9 +91,6 @@ struct atmel_pwm_chip {
         * hardware.
         */
        u32 update_pending;
-
-       /* Protects .update_pending */
-       spinlock_t lock;
 };
 
 static inline struct atmel_pwm_chip *to_atmel_pwm_chip(struct pwm_chip *chip)
@@ -145,8 +142,6 @@ static void atmel_pwm_update_pending(struct atmel_pwm_chip *chip)
 
 static void atmel_pwm_set_pending(struct atmel_pwm_chip *chip, unsigned int ch)
 {
-       spin_lock(&chip->lock);
-
        /*
         * Clear pending flags in hardware because otherwise there might still
         * be a stale flag in ISR.
@@ -154,16 +149,12 @@ static void atmel_pwm_set_pending(struct atmel_pwm_chip *chip, unsigned int ch)
        atmel_pwm_update_pending(chip);
 
        chip->update_pending |= (1 << ch);
-
-       spin_unlock(&chip->lock);
 }
 
 static int atmel_pwm_test_pending(struct atmel_pwm_chip *chip, unsigned int ch)
 {
        int ret = 0;
 
-       spin_lock(&chip->lock);
-
        if (chip->update_pending & (1 << ch)) {
                atmel_pwm_update_pending(chip);
 
@@ -171,8 +162,6 @@ static int atmel_pwm_test_pending(struct atmel_pwm_chip *chip, unsigned int ch)
                        ret = 1;
        }
 
-       spin_unlock(&chip->lock);
-
        return ret;
 }
 
@@ -509,7 +498,6 @@ static int atmel_pwm_probe(struct platform_device *pdev)
        atmel_pwm->data = of_device_get_match_data(&pdev->dev);
 
        atmel_pwm->update_pending = 0;
-       spin_lock_init(&atmel_pwm->lock);
 
        atmel_pwm->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(atmel_pwm->base))