mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
usb: yurex: make waiting on yurex_write interruptible
[ Upstream commit e0aa9614ab0fd35b404e4b16ebe879f9fc152591 ]
The IO yurex_write() needs to wait for in order to have a device
ready for writing again can take a long time time.
Consequently the sleep is done in an interruptible state.
Therefore others waiting for yurex_write() itself to finish should
use mutex_lock_interruptible.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Fixes: 6bc235a2e2 ("USB: add driver for Meywa-Denki & Kayac YUREX")
Rule: add
Link: https://lore.kernel.org/stable/20240924084415.300557-1-oneukum%40suse.com
Link: https://lore.kernel.org/r/20240924084415.300557-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
83aa97ef37
commit
cfb7f88ed3
@@ -912,7 +912,6 @@ error:
|
|||||||
static void iowarrior_disconnect(struct usb_interface *interface)
|
static void iowarrior_disconnect(struct usb_interface *interface)
|
||||||
{
|
{
|
||||||
struct iowarrior *dev = usb_get_intfdata(interface);
|
struct iowarrior *dev = usb_get_intfdata(interface);
|
||||||
int minor = dev->minor;
|
|
||||||
|
|
||||||
usb_deregister_dev(interface, &iowarrior_class);
|
usb_deregister_dev(interface, &iowarrior_class);
|
||||||
|
|
||||||
@@ -936,9 +935,6 @@ static void iowarrior_disconnect(struct usb_interface *interface)
|
|||||||
mutex_unlock(&dev->mutex);
|
mutex_unlock(&dev->mutex);
|
||||||
iowarrior_delete(dev);
|
iowarrior_delete(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_info(&interface->dev, "I/O-Warror #%d now disconnected\n",
|
|
||||||
minor - IOWARRIOR_MINOR_BASE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* usb specific object needed to register this driver with the usb subsystem */
|
/* usb specific object needed to register this driver with the usb subsystem */
|
||||||
|
|||||||
@@ -441,7 +441,10 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
|
|||||||
if (count == 0)
|
if (count == 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
mutex_lock(&dev->io_mutex);
|
retval = mutex_lock_interruptible(&dev->io_mutex);
|
||||||
|
if (retval < 0)
|
||||||
|
return -EINTR;
|
||||||
|
|
||||||
if (dev->disconnected) { /* already disconnected */
|
if (dev->disconnected) { /* already disconnected */
|
||||||
mutex_unlock(&dev->io_mutex);
|
mutex_unlock(&dev->io_mutex);
|
||||||
retval = -ENODEV;
|
retval = -ENODEV;
|
||||||
|
|||||||
Reference in New Issue
Block a user