aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/misc/auerswald.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index 498fd4789921..46dfbac0f6f0 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -259,7 +259,7 @@ typedef struct
259 auerbufctl_t bufctl; /* controls the buffer chain */ 259 auerbufctl_t bufctl; /* controls the buffer chain */
260 auerscon_t scontext; /* service context */ 260 auerscon_t scontext; /* service context */
261 wait_queue_head_t readwait; /* for synchronous reading */ 261 wait_queue_head_t readwait; /* for synchronous reading */
262 struct semaphore readmutex; /* protection against multiple reads */ 262 struct mutex readmutex; /* protection against multiple reads */
263 pauerbuf_t readbuf; /* buffer held for partial reading */ 263 pauerbuf_t readbuf; /* buffer held for partial reading */
264 unsigned int readoffset; /* current offset in readbuf */ 264 unsigned int readoffset; /* current offset in readbuf */
265 unsigned int removed; /* is != 0 if device is removed */ 265 unsigned int removed; /* is != 0 if device is removed */
@@ -1391,7 +1391,7 @@ static int auerchar_open (struct inode *inode, struct file *file)
1391 1391
1392 /* Initialize device descriptor */ 1392 /* Initialize device descriptor */
1393 init_MUTEX( &ccp->mutex); 1393 init_MUTEX( &ccp->mutex);
1394 init_MUTEX( &ccp->readmutex); 1394 mutex_init(&ccp->readmutex);
1395 auerbuf_init (&ccp->bufctl); 1395 auerbuf_init (&ccp->bufctl);
1396 ccp->scontext.id = AUH_UNASSIGNED; 1396 ccp->scontext.id = AUH_UNASSIGNED;
1397 ccp->scontext.dispatch = auerchar_ctrlread_dispatch; 1397 ccp->scontext.dispatch = auerchar_ctrlread_dispatch;
@@ -1585,7 +1585,7 @@ static ssize_t auerchar_read (struct file *file, char __user *buf, size_t count,
1585 } 1585 }
1586 1586
1587 /* only one reader per device allowed */ 1587 /* only one reader per device allowed */
1588 if (down_interruptible (&ccp->readmutex)) { 1588 if (mutex_lock_interruptible(&ccp->readmutex)) {
1589 up (&ccp->mutex); 1589 up (&ccp->mutex);
1590 return -ERESTARTSYS; 1590 return -ERESTARTSYS;
1591 } 1591 }
@@ -1603,7 +1603,7 @@ doreadbuf:
1603 if (count) { 1603 if (count) {
1604 if (copy_to_user (buf, bp->bufp+ccp->readoffset, count)) { 1604 if (copy_to_user (buf, bp->bufp+ccp->readoffset, count)) {
1605 dbg ("auerswald_read: copy_to_user failed"); 1605 dbg ("auerswald_read: copy_to_user failed");
1606 up (&ccp->readmutex); 1606 mutex_unlock(&ccp->readmutex);
1607 up (&ccp->mutex); 1607 up (&ccp->mutex);
1608 return -EFAULT; 1608 return -EFAULT;
1609 } 1609 }
@@ -1618,7 +1618,7 @@ doreadbuf:
1618 } 1618 }
1619 /* return with number of bytes read */ 1619 /* return with number of bytes read */
1620 if (count) { 1620 if (count) {
1621 up (&ccp->readmutex); 1621 mutex_unlock(&ccp->readmutex);
1622 up (&ccp->mutex); 1622 up (&ccp->mutex);
1623 return count; 1623 return count;
1624 } 1624 }
@@ -1655,7 +1655,7 @@ doreadlist:
1655 dbg ("No read buffer available, returning -EAGAIN"); 1655 dbg ("No read buffer available, returning -EAGAIN");
1656 set_current_state (TASK_RUNNING); 1656 set_current_state (TASK_RUNNING);
1657 remove_wait_queue (&ccp->readwait, &wait); 1657 remove_wait_queue (&ccp->readwait, &wait);
1658 up (&ccp->readmutex); 1658 mutex_unlock(&ccp->readmutex);
1659 up (&ccp->mutex); 1659 up (&ccp->mutex);
1660 return -EAGAIN; /* nonblocking, no data available */ 1660 return -EAGAIN; /* nonblocking, no data available */
1661 } 1661 }
@@ -1666,18 +1666,18 @@ doreadlist:
1666 remove_wait_queue (&ccp->readwait, &wait); 1666 remove_wait_queue (&ccp->readwait, &wait);
1667 if (signal_pending (current)) { 1667 if (signal_pending (current)) {
1668 /* waked up by a signal */ 1668 /* waked up by a signal */
1669 up (&ccp->readmutex); 1669 mutex_unlock(&ccp->readmutex);
1670 return -ERESTARTSYS; 1670 return -ERESTARTSYS;
1671 } 1671 }
1672 1672
1673 /* Anything left to read? */ 1673 /* Anything left to read? */
1674 if ((ccp->scontext.id == AUH_UNASSIGNED) || ccp->removed) { 1674 if ((ccp->scontext.id == AUH_UNASSIGNED) || ccp->removed) {
1675 up (&ccp->readmutex); 1675 mutex_unlock(&ccp->readmutex);
1676 return -EIO; 1676 return -EIO;
1677 } 1677 }
1678 1678
1679 if (down_interruptible (&ccp->mutex)) { 1679 if (down_interruptible (&ccp->mutex)) {
1680 up (&ccp->readmutex); 1680 mutex_unlock(&ccp->readmutex);
1681 return -ERESTARTSYS; 1681 return -ERESTARTSYS;
1682 } 1682 }
1683 1683