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

usb: iowarrior: remove intr_idx_lock

The intr_idx_lock lock is acquired only in the completion callback of
the ->int_in_urb (iowarrior_callback()). There is only one URB that is
scheduled / completed so there can't be more than one user of the lock.
The comment says that it protects ->intr_idx and the callback is the
only place in driver that writes to it.

Remove the intr_idx_lock lock because it is superfluous.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sebastian Andrzej Siewior and committed by
Greg Kroah-Hartman
efd61e94 957ada71

-5
-5
drivers/usb/misc/iowarrior.c
··· 81 81 atomic_t write_busy; /* number of write-urbs submitted */ 82 82 atomic_t read_idx; 83 83 atomic_t intr_idx; 84 - spinlock_t intr_idx_lock; /* protects intr_idx */ 85 84 atomic_t overflow_flag; /* signals an index 'rollover' */ 86 85 int present; /* this is 1 as long as the device is connected */ 87 86 int opened; /* this is 1 if the device is currently open */ ··· 165 166 goto exit; 166 167 } 167 168 168 - spin_lock(&dev->intr_idx_lock); 169 169 intr_idx = atomic_read(&dev->intr_idx); 170 170 /* aux_idx become previous intr_idx */ 171 171 aux_idx = (intr_idx == 0) ? (MAX_INTERRUPT_BUFFER - 1) : (intr_idx - 1); ··· 179 181 (dev->read_queue + offset, urb->transfer_buffer, 180 182 dev->report_size)) { 181 183 /* equal values on interface 0 will be ignored */ 182 - spin_unlock(&dev->intr_idx_lock); 183 184 goto exit; 184 185 } 185 186 } ··· 199 202 *(dev->read_queue + offset + (dev->report_size)) = dev->serial_number++; 200 203 201 204 atomic_set(&dev->intr_idx, aux_idx); 202 - spin_unlock(&dev->intr_idx_lock); 203 205 /* tell the blocking read about the new data */ 204 206 wake_up_interruptible(&dev->read_wait); 205 207 ··· 758 762 759 763 atomic_set(&dev->intr_idx, 0); 760 764 atomic_set(&dev->read_idx, 0); 761 - spin_lock_init(&dev->intr_idx_lock); 762 765 atomic_set(&dev->overflow_flag, 0); 763 766 init_waitqueue_head(&dev->read_wait); 764 767 atomic_set(&dev->write_busy, 0);