]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: nx - Rename devdata_mutex to devdata_spinlock
authorVishal Chourasia <vishalc@linux.ibm.com>
Tue, 15 Oct 2024 10:55:51 +0000 (16:25 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 28 Oct 2024 10:32:36 +0000 (18:32 +0800)
Rename devdata_mutex to devdata_spinlock to accurately reflect its
implementation as a spinlock.

[1] v1 https://lore.kernel.org/all/ZwyqD-w5hEhrnqTB@linux.ibm.com

Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/nx/nx-common-pseries.c

index 35f2d0d8507ed7747d362b9490789dae7c9c4144..a0eb900383af757d71b142bec52ba8cacca3dc7a 100644 (file)
@@ -133,7 +133,7 @@ struct nx842_devdata {
 };
 
 static struct nx842_devdata __rcu *devdata;
-static DEFINE_SPINLOCK(devdata_mutex);
+static DEFINE_SPINLOCK(devdata_spinlock);
 
 #define NX842_COUNTER_INC(_x) \
 static inline void nx842_inc_##_x( \
@@ -750,15 +750,15 @@ static int nx842_OF_upd(struct property *new_prop)
        if (!new_devdata)
                return -ENOMEM;
 
-       spin_lock_irqsave(&devdata_mutex, flags);
+       spin_lock_irqsave(&devdata_spinlock, flags);
        old_devdata = rcu_dereference_check(devdata,
-                       lockdep_is_held(&devdata_mutex));
+                       lockdep_is_held(&devdata_spinlock));
        if (old_devdata)
                of_node = old_devdata->dev->of_node;
 
        if (!old_devdata || !of_node) {
                pr_err("%s: device is not available\n", __func__);
-               spin_unlock_irqrestore(&devdata_mutex, flags);
+               spin_unlock_irqrestore(&devdata_spinlock, flags);
                kfree(new_devdata);
                return -ENODEV;
        }
@@ -810,7 +810,7 @@ out:
                        old_devdata->max_sg_len);
 
        rcu_assign_pointer(devdata, new_devdata);
-       spin_unlock_irqrestore(&devdata_mutex, flags);
+       spin_unlock_irqrestore(&devdata_spinlock, flags);
        synchronize_rcu();
        dev_set_drvdata(new_devdata->dev, new_devdata);
        kfree(old_devdata);
@@ -821,13 +821,13 @@ error_out:
                dev_info(old_devdata->dev, "%s: device disabled\n", __func__);
                nx842_OF_set_defaults(new_devdata);
                rcu_assign_pointer(devdata, new_devdata);
-               spin_unlock_irqrestore(&devdata_mutex, flags);
+               spin_unlock_irqrestore(&devdata_spinlock, flags);
                synchronize_rcu();
                dev_set_drvdata(new_devdata->dev, new_devdata);
                kfree(old_devdata);
        } else {
                dev_err(old_devdata->dev, "%s: could not update driver from hardware\n", __func__);
-               spin_unlock_irqrestore(&devdata_mutex, flags);
+               spin_unlock_irqrestore(&devdata_spinlock, flags);
        }
 
        if (!ret)
@@ -1045,9 +1045,9 @@ static int nx842_probe(struct vio_dev *viodev,
                return -ENOMEM;
        }
 
-       spin_lock_irqsave(&devdata_mutex, flags);
+       spin_lock_irqsave(&devdata_spinlock, flags);
        old_devdata = rcu_dereference_check(devdata,
-                       lockdep_is_held(&devdata_mutex));
+                       lockdep_is_held(&devdata_spinlock));
 
        if (old_devdata && old_devdata->vdev != NULL) {
                dev_err(&viodev->dev, "%s: Attempt to register more than one instance of the hardware\n", __func__);
@@ -1062,7 +1062,7 @@ static int nx842_probe(struct vio_dev *viodev,
        nx842_OF_set_defaults(new_devdata);
 
        rcu_assign_pointer(devdata, new_devdata);
-       spin_unlock_irqrestore(&devdata_mutex, flags);
+       spin_unlock_irqrestore(&devdata_spinlock, flags);
        synchronize_rcu();
        kfree(old_devdata);
 
@@ -1101,7 +1101,7 @@ static int nx842_probe(struct vio_dev *viodev,
        return 0;
 
 error_unlock:
-       spin_unlock_irqrestore(&devdata_mutex, flags);
+       spin_unlock_irqrestore(&devdata_spinlock, flags);
        if (new_devdata)
                kfree(new_devdata->counters);
        kfree(new_devdata);
@@ -1122,12 +1122,12 @@ static void nx842_remove(struct vio_dev *viodev)
 
        crypto_unregister_alg(&nx842_pseries_alg);
 
-       spin_lock_irqsave(&devdata_mutex, flags);
+       spin_lock_irqsave(&devdata_spinlock, flags);
        old_devdata = rcu_dereference_check(devdata,
-                       lockdep_is_held(&devdata_mutex));
+                       lockdep_is_held(&devdata_spinlock));
        of_reconfig_notifier_unregister(&nx842_of_nb);
        RCU_INIT_POINTER(devdata, NULL);
-       spin_unlock_irqrestore(&devdata_mutex, flags);
+       spin_unlock_irqrestore(&devdata_spinlock, flags);
        synchronize_rcu();
        dev_set_drvdata(&viodev->dev, NULL);
        if (old_devdata)
@@ -1257,11 +1257,11 @@ static void __exit nx842_pseries_exit(void)
 
        crypto_unregister_alg(&nx842_pseries_alg);
 
-       spin_lock_irqsave(&devdata_mutex, flags);
+       spin_lock_irqsave(&devdata_spinlock, flags);
        old_devdata = rcu_dereference_check(devdata,
-                       lockdep_is_held(&devdata_mutex));
+                       lockdep_is_held(&devdata_spinlock));
        RCU_INIT_POINTER(devdata, NULL);
-       spin_unlock_irqrestore(&devdata_mutex, flags);
+       spin_unlock_irqrestore(&devdata_spinlock, flags);
        synchronize_rcu();
        if (old_devdata && old_devdata->dev)
                dev_set_drvdata(old_devdata->dev, NULL);