diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-08-17 19:00:21 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2026-03-24 21:14:50 -0700 |
| commit | 445dcfc7f676842994eb7f011924ff0e3a90c13b (patch) | |
| tree | 4cb56c60fe28c7096c7193ed0534e990aa4639e6 /drivers/input/touchscreen | |
| parent | d2862b87add9966bc23af73a033f27a296bdbb55 (diff) | |
| download | lwn-445dcfc7f676842994eb7f011924ff0e3a90c13b.tar.gz lwn-445dcfc7f676842994eb7f011924ff0e3a90c13b.zip | |
Input: imx6ul_tsc - 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')
| -rw-r--r-- | drivers/input/touchscreen/imx6ul_tsc.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c index 85f697de2b7e..43d6c69e3088 100644 --- a/drivers/input/touchscreen/imx6ul_tsc.c +++ b/drivers/input/touchscreen/imx6ul_tsc.c @@ -551,13 +551,11 @@ static int imx6ul_tsc_suspend(struct device *dev) struct imx6ul_tsc *tsc = platform_get_drvdata(pdev); struct input_dev *input_dev = tsc->input; - mutex_lock(&input_dev->mutex); + guard(mutex)(&input_dev->mutex); if (input_device_enabled(input_dev)) imx6ul_tsc_stop(tsc); - mutex_unlock(&input_dev->mutex); - return 0; } @@ -566,16 +564,17 @@ static int imx6ul_tsc_resume(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct imx6ul_tsc *tsc = platform_get_drvdata(pdev); struct input_dev *input_dev = tsc->input; - int retval = 0; - - mutex_lock(&input_dev->mutex); + int error; - if (input_device_enabled(input_dev)) - retval = imx6ul_tsc_start(tsc); + guard(mutex)(&input_dev->mutex); - mutex_unlock(&input_dev->mutex); + if (input_device_enabled(input_dev)) { + error = imx6ul_tsc_start(tsc); + if (error) + return error; + } - return retval; + return 0; } static DEFINE_SIMPLE_DEV_PM_OPS(imx6ul_tsc_pm_ops, |
