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)
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,