Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: mms114 - use guard notation when acquiring mutex

Guard notation simplifies code.

Also stop trying to check if input device is opened/in use in the
interrupt handler - the interrupt is disabled when device is closed or
suspended.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+5 -15
+5 -15
drivers/input/touchscreen/mms114.c
··· 216 216 { 217 217 struct mms114_data *data = dev_id; 218 218 struct i2c_client *client = data->client; 219 - struct input_dev *input_dev = data->input_dev; 220 219 struct mms114_touch touch[MMS114_MAX_TOUCH]; 221 220 int packet_size; 222 221 int touch_size; 223 222 int index; 224 223 int error; 225 - 226 - mutex_lock(&input_dev->mutex); 227 - if (!input_device_enabled(input_dev)) { 228 - mutex_unlock(&input_dev->mutex); 229 - goto out; 230 - } 231 - mutex_unlock(&input_dev->mutex); 232 224 233 225 packet_size = mms114_read_reg(data, MMS114_PACKET_SIZE); 234 226 if (packet_size <= 0) ··· 638 646 input_mt_report_pointer_emulation(input_dev, true); 639 647 input_sync(input_dev); 640 648 641 - mutex_lock(&input_dev->mutex); 649 + guard(mutex)(&input_dev->mutex); 650 + 642 651 if (input_device_enabled(input_dev)) 643 652 mms114_stop(data); 644 - mutex_unlock(&input_dev->mutex); 645 653 646 654 return 0; 647 655 } ··· 653 661 struct input_dev *input_dev = data->input_dev; 654 662 int error; 655 663 656 - mutex_lock(&input_dev->mutex); 664 + guard(mutex)(&input_dev->mutex); 665 + 657 666 if (input_device_enabled(input_dev)) { 658 667 error = mms114_start(data); 659 - if (error < 0) { 660 - mutex_unlock(&input_dev->mutex); 668 + if (error) 661 669 return error; 662 - } 663 670 } 664 - mutex_unlock(&input_dev->mutex); 665 671 666 672 return 0; 667 673 }