]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Input: bu21029_ts - use guard notation when acquiring mutex
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 18 Aug 2024 00:08:28 +0000 (17:08 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 25 Mar 2026 04:14:21 +0000 (21:14 -0700)
Guard notation simplifies code.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/bu21029_ts.c

index 64f474e67312f0cb7873817b4064ca41bff5088b..68d9cd55ceeb6ddc5b90c8b5f9caf75565583378 100644 (file)
@@ -416,10 +416,10 @@ static int bu21029_suspend(struct device *dev)
        struct bu21029_ts_data *bu21029 = i2c_get_clientdata(i2c);
 
        if (!device_may_wakeup(dev)) {
-               mutex_lock(&bu21029->in_dev->mutex);
+               guard(mutex)(&bu21029->in_dev->mutex);
+
                if (input_device_enabled(bu21029->in_dev))
                        bu21029_stop_chip(bu21029->in_dev);
-               mutex_unlock(&bu21029->in_dev->mutex);
        }
 
        return 0;
@@ -431,10 +431,10 @@ static int bu21029_resume(struct device *dev)
        struct bu21029_ts_data *bu21029 = i2c_get_clientdata(i2c);
 
        if (!device_may_wakeup(dev)) {
-               mutex_lock(&bu21029->in_dev->mutex);
+               guard(mutex)(&bu21029->in_dev->mutex);
+
                if (input_device_enabled(bu21029->in_dev))
                        bu21029_start_chip(bu21029->in_dev);
-               mutex_unlock(&bu21029->in_dev->mutex);
        }
 
        return 0;