diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-08-17 19:02:31 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2026-03-24 21:14:56 -0700 |
| commit | 03bf327434456c3bde003509d57169ea1ebbe9a3 (patch) | |
| tree | 64385a57c09e314c0e3d0f4cc3edbaa79f9663fe /drivers/input/touchscreen/msg2638.c | |
| parent | 11a64d6bb70bad120468f39ba1358b449dca4167 (diff) | |
Input: msg2638 - use guard notation when acquiring mutex
Guard notation simplifies code.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/msg2638.c')
| -rw-r--r-- | drivers/input/touchscreen/msg2638.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/input/touchscreen/msg2638.c b/drivers/input/touchscreen/msg2638.c index a38af3fee34a..240d2eebf1c9 100644 --- a/drivers/input/touchscreen/msg2638.c +++ b/drivers/input/touchscreen/msg2638.c @@ -446,13 +446,11 @@ static int msg2638_suspend(struct device *dev) struct i2c_client *client = to_i2c_client(dev); struct msg2638_ts_data *msg2638 = i2c_get_clientdata(client); - mutex_lock(&msg2638->input_dev->mutex); + guard(mutex)(&msg2638->input_dev->mutex); if (input_device_enabled(msg2638->input_dev)) msg2638_stop(msg2638); - mutex_unlock(&msg2638->input_dev->mutex); - return 0; } @@ -460,16 +458,17 @@ static int msg2638_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct msg2638_ts_data *msg2638 = i2c_get_clientdata(client); - int ret = 0; - - mutex_lock(&msg2638->input_dev->mutex); + int error; - if (input_device_enabled(msg2638->input_dev)) - ret = msg2638_start(msg2638); + guard(mutex)(&msg2638->input_dev->mutex); - mutex_unlock(&msg2638->input_dev->mutex); + if (input_device_enabled(msg2638->input_dev)) { + error = msg2638_start(msg2638); + if (error) + return error; + } - return ret; + return 0; } static DEFINE_SIMPLE_DEV_PM_OPS(msg2638_pm_ops, msg2638_suspend, msg2638_resume); |
