mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 07:01:57 +00:00
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>
This commit is contained in:
parent
957ada71b6
commit
efd61e94fa
@ -81,7 +81,6 @@ struct iowarrior {
|
||||
atomic_t write_busy; /* number of write-urbs submitted */
|
||||
atomic_t read_idx;
|
||||
atomic_t intr_idx;
|
||||
spinlock_t intr_idx_lock; /* protects intr_idx */
|
||||
atomic_t overflow_flag; /* signals an index 'rollover' */
|
||||
int present; /* this is 1 as long as the device is connected */
|
||||
int opened; /* this is 1 if the device is currently open */
|
||||
@ -166,7 +165,6 @@ static void iowarrior_callback(struct urb *urb)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
spin_lock(&dev->intr_idx_lock);
|
||||
intr_idx = atomic_read(&dev->intr_idx);
|
||||
/* aux_idx become previous intr_idx */
|
||||
aux_idx = (intr_idx == 0) ? (MAX_INTERRUPT_BUFFER - 1) : (intr_idx - 1);
|
||||
@ -181,7 +179,6 @@ static void iowarrior_callback(struct urb *urb)
|
||||
(dev->read_queue + offset, urb->transfer_buffer,
|
||||
dev->report_size)) {
|
||||
/* equal values on interface 0 will be ignored */
|
||||
spin_unlock(&dev->intr_idx_lock);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
@ -202,7 +199,6 @@ static void iowarrior_callback(struct urb *urb)
|
||||
*(dev->read_queue + offset + (dev->report_size)) = dev->serial_number++;
|
||||
|
||||
atomic_set(&dev->intr_idx, aux_idx);
|
||||
spin_unlock(&dev->intr_idx_lock);
|
||||
/* tell the blocking read about the new data */
|
||||
wake_up_interruptible(&dev->read_wait);
|
||||
|
||||
@ -762,7 +758,6 @@ static int iowarrior_probe(struct usb_interface *interface,
|
||||
|
||||
atomic_set(&dev->intr_idx, 0);
|
||||
atomic_set(&dev->read_idx, 0);
|
||||
spin_lock_init(&dev->intr_idx_lock);
|
||||
atomic_set(&dev->overflow_flag, 0);
|
||||
init_waitqueue_head(&dev->read_wait);
|
||||
atomic_set(&dev->write_busy, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user