summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2024-08-18 05:07:03 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2026-03-25 17:53:58 +0300
commit738de07ddf0926b01fd8d3ba24f0c65fa5b418f5 (patch)
tree69e399cdd61494cf7042eab5ca69eacaa74d0b56
parent9f33f4fd39964d13379af396f3bfe3d3617a33f5 (diff)
downloadlinux-738de07ddf0926b01fd8d3ba24f0c65fa5b418f5.tar.xz
Input: pixcir_i2c_ts - use guard notation when acquiring mutex
Guard notation simplifies code. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/touchscreen/pixcir_i2c_ts.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index dad5786e82a4..c6b3615c8775 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -410,26 +410,25 @@ static int pixcir_i2c_ts_suspend(struct device *dev)
struct i2c_client *client = to_i2c_client(dev);
struct pixcir_i2c_ts_data *ts = i2c_get_clientdata(client);
struct input_dev *input = ts->input;
- int ret = 0;
+ int error;
- mutex_lock(&input->mutex);
+ guard(mutex)(&input->mutex);
if (device_may_wakeup(&client->dev)) {
if (!input_device_enabled(input)) {
- ret = pixcir_start(ts);
- if (ret) {
+ error = pixcir_start(ts);
+ if (error) {
dev_err(dev, "Failed to start\n");
- goto unlock;
+ return error;
}
}
} else if (input_device_enabled(input)) {
- ret = pixcir_stop(ts);
+ error = pixcir_stop(ts);
+ if (error)
+ return error;
}
-unlock:
- mutex_unlock(&input->mutex);
-
- return ret;
+ return 0;
}
static int pixcir_i2c_ts_resume(struct device *dev)
@@ -437,26 +436,25 @@ static int pixcir_i2c_ts_resume(struct device *dev)
struct i2c_client *client = to_i2c_client(dev);
struct pixcir_i2c_ts_data *ts = i2c_get_clientdata(client);
struct input_dev *input = ts->input;
- int ret = 0;
+ int error;
- mutex_lock(&input->mutex);
+ guard(mutex)(&input->mutex);
if (device_may_wakeup(&client->dev)) {
if (!input_device_enabled(input)) {
- ret = pixcir_stop(ts);
- if (ret) {
+ error = pixcir_stop(ts);
+ if (error) {
dev_err(dev, "Failed to stop\n");
- goto unlock;
+ return error;
}
}
} else if (input_device_enabled(input)) {
- ret = pixcir_start(ts);
+ error = pixcir_start(ts);
+ if (error)
+ return error;
}
-unlock:
- mutex_unlock(&input->mutex);
-
- return ret;
+ return 0;
}
static DEFINE_SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops,