aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/auerswald.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/auerswald.c')
-rw-r--r--drivers/usb/misc/auerswald.c135
1 files changed, 69 insertions, 66 deletions
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index df7e1ecc810a..093938697426 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -31,6 +31,7 @@
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/wait.h> 32#include <linux/wait.h>
33#include <linux/usb.h> 33#include <linux/usb.h>
34#include <linux/mutex.h>
34 35
35/*-------------------------------------------------------------------*/ 36/*-------------------------------------------------------------------*/
36/* Debug support */ 37/* Debug support */
@@ -232,7 +233,7 @@ typedef struct auerscon
232/* USB device context */ 233/* USB device context */
233typedef struct 234typedef struct
234{ 235{
235 struct semaphore mutex; /* protection in user context */ 236 struct mutex mutex; /* protection in user context */
236 char name[20]; /* name of the /dev/usb entry */ 237 char name[20]; /* name of the /dev/usb entry */
237 unsigned int dtindex; /* index in the device table */ 238 unsigned int dtindex; /* index in the device table */
238 struct usb_device * usbdev; /* USB device handle */ 239 struct usb_device * usbdev; /* USB device handle */
@@ -253,12 +254,12 @@ typedef struct
253/* character device context */ 254/* character device context */
254typedef struct 255typedef struct
255{ 256{
256 struct semaphore mutex; /* protection in user context */ 257 struct mutex mutex; /* protection in user context */
257 pauerswald_t auerdev; /* context pointer of assigned device */ 258 pauerswald_t auerdev; /* context pointer of assigned device */
258 auerbufctl_t bufctl; /* controls the buffer chain */ 259 auerbufctl_t bufctl; /* controls the buffer chain */
259 auerscon_t scontext; /* service context */ 260 auerscon_t scontext; /* service context */
260 wait_queue_head_t readwait; /* for synchronous reading */ 261 wait_queue_head_t readwait; /* for synchronous reading */
261 struct semaphore readmutex; /* protection against multiple reads */ 262 struct mutex readmutex; /* protection against multiple reads */
262 pauerbuf_t readbuf; /* buffer held for partial reading */ 263 pauerbuf_t readbuf; /* buffer held for partial reading */
263 unsigned int readoffset; /* current offset in readbuf */ 264 unsigned int readoffset; /* current offset in readbuf */
264 unsigned int removed; /* is != 0 if device is removed */ 265 unsigned int removed; /* is != 0 if device is removed */
@@ -283,7 +284,7 @@ static void auerchain_complete (struct urb * urb)
283 int result; 284 int result;
284 285
285 /* get pointer to element and to chain */ 286 /* get pointer to element and to chain */
286 pauerchainelement_t acep = (pauerchainelement_t) urb->context; 287 pauerchainelement_t acep = urb->context;
287 pauerchain_t acp = acep->chain; 288 pauerchain_t acp = acep->chain;
288 289
289 /* restore original entries in urb */ 290 /* restore original entries in urb */
@@ -593,7 +594,7 @@ ac_fail:/* free the elements */
593/* completion handler for synchronous chained URBs */ 594/* completion handler for synchronous chained URBs */
594static void auerchain_blocking_completion (struct urb *urb) 595static void auerchain_blocking_completion (struct urb *urb)
595{ 596{
596 pauerchain_chs_t pchs = (pauerchain_chs_t)urb->context; 597 pauerchain_chs_t pchs = urb->context;
597 pchs->done = 1; 598 pchs->done = 1;
598 wmb(); 599 wmb();
599 wake_up (&pchs->wqh); 600 wake_up (&pchs->wqh);
@@ -846,7 +847,7 @@ static int auerswald_status_retry (int status)
846/* Completion of asynchronous write block */ 847/* Completion of asynchronous write block */
847static void auerchar_ctrlwrite_complete (struct urb * urb) 848static void auerchar_ctrlwrite_complete (struct urb * urb)
848{ 849{
849 pauerbuf_t bp = (pauerbuf_t) urb->context; 850 pauerbuf_t bp = urb->context;
850 pauerswald_t cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl))); 851 pauerswald_t cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl)));
851 dbg ("auerchar_ctrlwrite_complete called"); 852 dbg ("auerchar_ctrlwrite_complete called");
852 853
@@ -859,7 +860,7 @@ static void auerchar_ctrlwrite_complete (struct urb * urb)
859/* Completion handler for dummy retry packet */ 860/* Completion handler for dummy retry packet */
860static void auerswald_ctrlread_wretcomplete (struct urb * urb) 861static void auerswald_ctrlread_wretcomplete (struct urb * urb)
861{ 862{
862 pauerbuf_t bp = (pauerbuf_t) urb->context; 863 pauerbuf_t bp = urb->context;
863 pauerswald_t cp; 864 pauerswald_t cp;
864 int ret; 865 int ret;
865 int status = urb->status; 866 int status = urb->status;
@@ -903,7 +904,7 @@ static void auerswald_ctrlread_complete (struct urb * urb)
903 unsigned int serviceid; 904 unsigned int serviceid;
904 pauerswald_t cp; 905 pauerswald_t cp;
905 pauerscon_t scp; 906 pauerscon_t scp;
906 pauerbuf_t bp = (pauerbuf_t) urb->context; 907 pauerbuf_t bp = urb->context;
907 int status = urb->status; 908 int status = urb->status;
908 int ret; 909 int ret;
909 910
@@ -980,9 +981,9 @@ static void auerswald_int_complete (struct urb * urb)
980 int ret; 981 int ret;
981 int status = urb->status; 982 int status = urb->status;
982 pauerbuf_t bp = NULL; 983 pauerbuf_t bp = NULL;
983 pauerswald_t cp = (pauerswald_t) urb->context; 984 pauerswald_t cp = urb->context;
984 985
985 dbg ("%s called", __FUNCTION__); 986 dbg ("%s called", __func__);
986 987
987 switch (status) { 988 switch (status) {
988 case 0: 989 case 0:
@@ -992,10 +993,10 @@ static void auerswald_int_complete (struct urb * urb)
992 case -ENOENT: 993 case -ENOENT:
993 case -ESHUTDOWN: 994 case -ESHUTDOWN:
994 /* this urb is terminated, clean up */ 995 /* this urb is terminated, clean up */
995 dbg("%s - urb shutting down with status: %d", __FUNCTION__, status); 996 dbg("%s - urb shutting down with status: %d", __func__, status);
996 return; 997 return;
997 default: 998 default:
998 dbg("%s - nonzero urb status received: %d", __FUNCTION__, status); 999 dbg("%s - nonzero urb status received: %d", __func__, status);
999 goto exit; 1000 goto exit;
1000 } 1001 }
1001 1002
@@ -1080,7 +1081,7 @@ exit:
1080 ret = usb_submit_urb (urb, GFP_ATOMIC); 1081 ret = usb_submit_urb (urb, GFP_ATOMIC);
1081 if (ret) 1082 if (ret)
1082 err ("%s - usb_submit_urb failed with result %d", 1083 err ("%s - usb_submit_urb failed with result %d",
1083 __FUNCTION__, ret); 1084 __func__, ret);
1084} 1085}
1085 1086
1086/* int memory deallocation 1087/* int memory deallocation
@@ -1376,7 +1377,7 @@ static int auerchar_open (struct inode *inode, struct file *file)
1376 if (cp == NULL) { 1377 if (cp == NULL) {
1377 return -ENODEV; 1378 return -ENODEV;
1378 } 1379 }
1379 if (down_interruptible (&cp->mutex)) { 1380 if (mutex_lock_interruptible(&cp->mutex)) {
1380 return -ERESTARTSYS; 1381 return -ERESTARTSYS;
1381 } 1382 }
1382 1383
@@ -1389,8 +1390,8 @@ static int auerchar_open (struct inode *inode, struct file *file)
1389 } 1390 }
1390 1391
1391 /* Initialize device descriptor */ 1392 /* Initialize device descriptor */
1392 init_MUTEX( &ccp->mutex); 1393 mutex_init(&ccp->mutex);
1393 init_MUTEX( &ccp->readmutex); 1394 mutex_init(&ccp->readmutex);
1394 auerbuf_init (&ccp->bufctl); 1395 auerbuf_init (&ccp->bufctl);
1395 ccp->scontext.id = AUH_UNASSIGNED; 1396 ccp->scontext.id = AUH_UNASSIGNED;
1396 ccp->scontext.dispatch = auerchar_ctrlread_dispatch; 1397 ccp->scontext.dispatch = auerchar_ctrlread_dispatch;
@@ -1405,7 +1406,7 @@ static int auerchar_open (struct inode *inode, struct file *file)
1405 cp->open_count++; 1406 cp->open_count++;
1406 ccp->auerdev = cp; 1407 ccp->auerdev = cp;
1407 dbg("open %s as /dev/%s", cp->dev_desc, cp->name); 1408 dbg("open %s as /dev/%s", cp->dev_desc, cp->name);
1408 up (&cp->mutex); 1409 mutex_unlock(&cp->mutex);
1409 1410
1410 /* file IO stuff */ 1411 /* file IO stuff */
1411 file->f_pos = 0; 1412 file->f_pos = 0;
@@ -1413,7 +1414,7 @@ static int auerchar_open (struct inode *inode, struct file *file)
1413 return nonseekable_open(inode, file); 1414 return nonseekable_open(inode, file);
1414 1415
1415 /* Error exit */ 1416 /* Error exit */
1416ofail: up (&cp->mutex); 1417ofail: mutex_unlock(&cp->mutex);
1417 auerchar_delete (ccp); 1418 auerchar_delete (ccp);
1418 return ret; 1419 return ret;
1419} 1420}
@@ -1432,23 +1433,23 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int
1432 dbg ("ioctl"); 1433 dbg ("ioctl");
1433 1434
1434 /* get the mutexes */ 1435 /* get the mutexes */
1435 if (down_interruptible (&ccp->mutex)) { 1436 if (mutex_lock_interruptible(&ccp->mutex)) {
1436 return -ERESTARTSYS; 1437 return -ERESTARTSYS;
1437 } 1438 }
1438 cp = ccp->auerdev; 1439 cp = ccp->auerdev;
1439 if (!cp) { 1440 if (!cp) {
1440 up (&ccp->mutex); 1441 mutex_unlock(&ccp->mutex);
1441 return -ENODEV; 1442 return -ENODEV;
1442 } 1443 }
1443 if (down_interruptible (&cp->mutex)) { 1444 if (mutex_lock_interruptible(&cp->mutex)) {
1444 up(&ccp->mutex); 1445 mutex_unlock(&ccp->mutex);
1445 return -ERESTARTSYS; 1446 return -ERESTARTSYS;
1446 } 1447 }
1447 1448
1448 /* Check for removal */ 1449 /* Check for removal */
1449 if (!cp->usbdev) { 1450 if (!cp->usbdev) {
1450 up(&cp->mutex); 1451 mutex_unlock(&cp->mutex);
1451 up(&ccp->mutex); 1452 mutex_unlock(&ccp->mutex);
1452 return -ENODEV; 1453 return -ENODEV;
1453 } 1454 }
1454 1455
@@ -1550,8 +1551,8 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int
1550 break; 1551 break;
1551 } 1552 }
1552 /* release the mutexes */ 1553 /* release the mutexes */
1553 up(&cp->mutex); 1554 mutex_unlock(&cp->mutex);
1554 up(&ccp->mutex); 1555 mutex_unlock(&ccp->mutex);
1555 return ret; 1556 return ret;
1556} 1557}
1557 1558
@@ -1574,18 +1575,18 @@ static ssize_t auerchar_read (struct file *file, char __user *buf, size_t count,
1574 return 0; 1575 return 0;
1575 1576
1576 /* get the mutex */ 1577 /* get the mutex */
1577 if (down_interruptible (&ccp->mutex)) 1578 if (mutex_lock_interruptible(&ccp->mutex))
1578 return -ERESTARTSYS; 1579 return -ERESTARTSYS;
1579 1580
1580 /* Can we expect to read something? */ 1581 /* Can we expect to read something? */
1581 if (ccp->scontext.id == AUH_UNASSIGNED) { 1582 if (ccp->scontext.id == AUH_UNASSIGNED) {
1582 up (&ccp->mutex); 1583 mutex_unlock(&ccp->mutex);
1583 return -EIO; 1584 return -EIO;
1584 } 1585 }
1585 1586
1586 /* only one reader per device allowed */ 1587 /* only one reader per device allowed */
1587 if (down_interruptible (&ccp->readmutex)) { 1588 if (mutex_lock_interruptible(&ccp->readmutex)) {
1588 up (&ccp->mutex); 1589 mutex_unlock(&ccp->mutex);
1589 return -ERESTARTSYS; 1590 return -ERESTARTSYS;
1590 } 1591 }
1591 1592
@@ -1602,8 +1603,8 @@ doreadbuf:
1602 if (count) { 1603 if (count) {
1603 if (copy_to_user (buf, bp->bufp+ccp->readoffset, count)) { 1604 if (copy_to_user (buf, bp->bufp+ccp->readoffset, count)) {
1604 dbg ("auerswald_read: copy_to_user failed"); 1605 dbg ("auerswald_read: copy_to_user failed");
1605 up (&ccp->readmutex); 1606 mutex_unlock(&ccp->readmutex);
1606 up (&ccp->mutex); 1607 mutex_unlock(&ccp->mutex);
1607 return -EFAULT; 1608 return -EFAULT;
1608 } 1609 }
1609 } 1610 }
@@ -1617,8 +1618,8 @@ doreadbuf:
1617 } 1618 }
1618 /* return with number of bytes read */ 1619 /* return with number of bytes read */
1619 if (count) { 1620 if (count) {
1620 up (&ccp->readmutex); 1621 mutex_unlock(&ccp->readmutex);
1621 up (&ccp->mutex); 1622 mutex_unlock(&ccp->mutex);
1622 return count; 1623 return count;
1623 } 1624 }
1624 } 1625 }
@@ -1654,29 +1655,29 @@ doreadlist:
1654 dbg ("No read buffer available, returning -EAGAIN"); 1655 dbg ("No read buffer available, returning -EAGAIN");
1655 set_current_state (TASK_RUNNING); 1656 set_current_state (TASK_RUNNING);
1656 remove_wait_queue (&ccp->readwait, &wait); 1657 remove_wait_queue (&ccp->readwait, &wait);
1657 up (&ccp->readmutex); 1658 mutex_unlock(&ccp->readmutex);
1658 up (&ccp->mutex); 1659 mutex_unlock(&ccp->mutex);
1659 return -EAGAIN; /* nonblocking, no data available */ 1660 return -EAGAIN; /* nonblocking, no data available */
1660 } 1661 }
1661 1662
1662 /* yes, we should wait! */ 1663 /* yes, we should wait! */
1663 up (&ccp->mutex); /* allow other operations while we wait */ 1664 mutex_unlock(&ccp->mutex); /* allow other operations while we wait */
1664 schedule(); 1665 schedule();
1665 remove_wait_queue (&ccp->readwait, &wait); 1666 remove_wait_queue (&ccp->readwait, &wait);
1666 if (signal_pending (current)) { 1667 if (signal_pending (current)) {
1667 /* waked up by a signal */ 1668 /* waked up by a signal */
1668 up (&ccp->readmutex); 1669 mutex_unlock(&ccp->readmutex);
1669 return -ERESTARTSYS; 1670 return -ERESTARTSYS;
1670 } 1671 }
1671 1672
1672 /* Anything left to read? */ 1673 /* Anything left to read? */
1673 if ((ccp->scontext.id == AUH_UNASSIGNED) || ccp->removed) { 1674 if ((ccp->scontext.id == AUH_UNASSIGNED) || ccp->removed) {
1674 up (&ccp->readmutex); 1675 mutex_unlock(&ccp->readmutex);
1675 return -EIO; 1676 return -EIO;
1676 } 1677 }
1677 1678
1678 if (down_interruptible (&ccp->mutex)) { 1679 if (mutex_lock_interruptible(&ccp->mutex)) {
1679 up (&ccp->readmutex); 1680 mutex_unlock(&ccp->readmutex);
1680 return -ERESTARTSYS; 1681 return -ERESTARTSYS;
1681 } 1682 }
1682 1683
@@ -1707,27 +1708,27 @@ static ssize_t auerchar_write (struct file *file, const char __user *buf, size_t
1707 1708
1708write_again: 1709write_again:
1709 /* get the mutex */ 1710 /* get the mutex */
1710 if (down_interruptible (&ccp->mutex)) 1711 if (mutex_lock_interruptible(&ccp->mutex))
1711 return -ERESTARTSYS; 1712 return -ERESTARTSYS;
1712 1713
1713 /* Can we expect to write something? */ 1714 /* Can we expect to write something? */
1714 if (ccp->scontext.id == AUH_UNASSIGNED) { 1715 if (ccp->scontext.id == AUH_UNASSIGNED) {
1715 up (&ccp->mutex); 1716 mutex_unlock(&ccp->mutex);
1716 return -EIO; 1717 return -EIO;
1717 } 1718 }
1718 1719
1719 cp = ccp->auerdev; 1720 cp = ccp->auerdev;
1720 if (!cp) { 1721 if (!cp) {
1721 up (&ccp->mutex); 1722 mutex_unlock(&ccp->mutex);
1722 return -ERESTARTSYS; 1723 return -ERESTARTSYS;
1723 } 1724 }
1724 if (down_interruptible (&cp->mutex)) { 1725 if (mutex_lock_interruptible(&cp->mutex)) {
1725 up (&ccp->mutex); 1726 mutex_unlock(&ccp->mutex);
1726 return -ERESTARTSYS; 1727 return -ERESTARTSYS;
1727 } 1728 }
1728 if (!cp->usbdev) { 1729 if (!cp->usbdev) {
1729 up (&cp->mutex); 1730 mutex_unlock(&cp->mutex);
1730 up (&ccp->mutex); 1731 mutex_unlock(&ccp->mutex);
1731 return -EIO; 1732 return -EIO;
1732 } 1733 }
1733 /* Prepare for sleep */ 1734 /* Prepare for sleep */
@@ -1750,8 +1751,8 @@ write_again:
1750 1751
1751 /* are there any buffers left? */ 1752 /* are there any buffers left? */
1752 if (!bp) { 1753 if (!bp) {
1753 up (&cp->mutex); 1754 mutex_unlock(&cp->mutex);
1754 up (&ccp->mutex); 1755 mutex_unlock(&ccp->mutex);
1755 1756
1756 /* NONBLOCK: don't wait */ 1757 /* NONBLOCK: don't wait */
1757 if (file->f_flags & O_NONBLOCK) { 1758 if (file->f_flags & O_NONBLOCK) {
@@ -1783,8 +1784,8 @@ write_again:
1783 auerbuf_releasebuf (bp); 1784 auerbuf_releasebuf (bp);
1784 /* Wake up all processes waiting for a buffer */ 1785 /* Wake up all processes waiting for a buffer */
1785 wake_up (&cp->bufferwait); 1786 wake_up (&cp->bufferwait);
1786 up (&cp->mutex); 1787 mutex_unlock(&cp->mutex);
1787 up (&ccp->mutex); 1788 mutex_unlock(&ccp->mutex);
1788 return -EFAULT; 1789 return -EFAULT;
1789 } 1790 }
1790 1791
@@ -1803,18 +1804,18 @@ write_again:
1803 auerchar_ctrlwrite_complete, bp); 1804 auerchar_ctrlwrite_complete, bp);
1804 /* up we go */ 1805 /* up we go */
1805 ret = auerchain_submit_urb (&cp->controlchain, bp->urbp); 1806 ret = auerchain_submit_urb (&cp->controlchain, bp->urbp);
1806 up (&cp->mutex); 1807 mutex_unlock(&cp->mutex);
1807 if (ret) { 1808 if (ret) {
1808 dbg ("auerchar_write: nonzero result of auerchain_submit_urb %d", ret); 1809 dbg ("auerchar_write: nonzero result of auerchain_submit_urb %d", ret);
1809 auerbuf_releasebuf (bp); 1810 auerbuf_releasebuf (bp);
1810 /* Wake up all processes waiting for a buffer */ 1811 /* Wake up all processes waiting for a buffer */
1811 wake_up (&cp->bufferwait); 1812 wake_up (&cp->bufferwait);
1812 up (&ccp->mutex); 1813 mutex_unlock(&ccp->mutex);
1813 return -EIO; 1814 return -EIO;
1814 } 1815 }
1815 else { 1816 else {
1816 dbg ("auerchar_write: Write OK"); 1817 dbg ("auerchar_write: Write OK");
1817 up (&ccp->mutex); 1818 mutex_unlock(&ccp->mutex);
1818 return len; 1819 return len;
1819 } 1820 }
1820} 1821}
@@ -1827,24 +1828,24 @@ static int auerchar_release (struct inode *inode, struct file *file)
1827 pauerswald_t cp; 1828 pauerswald_t cp;
1828 dbg("release"); 1829 dbg("release");
1829 1830
1830 down(&ccp->mutex); 1831 mutex_lock(&ccp->mutex);
1831 cp = ccp->auerdev; 1832 cp = ccp->auerdev;
1832 if (cp) { 1833 if (cp) {
1833 down(&cp->mutex); 1834 mutex_lock(&cp->mutex);
1834 /* remove an open service */ 1835 /* remove an open service */
1835 auerswald_removeservice (cp, &ccp->scontext); 1836 auerswald_removeservice (cp, &ccp->scontext);
1836 /* detach from device */ 1837 /* detach from device */
1837 if ((--cp->open_count <= 0) && (cp->usbdev == NULL)) { 1838 if ((--cp->open_count <= 0) && (cp->usbdev == NULL)) {
1838 /* usb device waits for removal */ 1839 /* usb device waits for removal */
1839 up (&cp->mutex); 1840 mutex_unlock(&cp->mutex);
1840 auerswald_delete (cp); 1841 auerswald_delete (cp);
1841 } else { 1842 } else {
1842 up (&cp->mutex); 1843 mutex_unlock(&cp->mutex);
1843 } 1844 }
1844 cp = NULL; 1845 cp = NULL;
1845 ccp->auerdev = NULL; 1846 ccp->auerdev = NULL;
1846 } 1847 }
1847 up (&ccp->mutex); 1848 mutex_unlock(&ccp->mutex);
1848 auerchar_delete (ccp); 1849 auerchar_delete (ccp);
1849 1850
1850 return 0; 1851 return 0;
@@ -1917,7 +1918,7 @@ static int auerswald_probe (struct usb_interface *intf,
1917 } 1918 }
1918 1919
1919 /* Initialize device descriptor */ 1920 /* Initialize device descriptor */
1920 init_MUTEX (&cp->mutex); 1921 mutex_init(&cp->mutex);
1921 cp->usbdev = usbdev; 1922 cp->usbdev = usbdev;
1922 auerchain_init (&cp->controlchain); 1923 auerchain_init (&cp->controlchain);
1923 auerbuf_init (&cp->bufctl); 1924 auerbuf_init (&cp->bufctl);
@@ -2042,7 +2043,7 @@ static void auerswald_disconnect (struct usb_interface *intf)
2042 /* give back our USB minor number */ 2043 /* give back our USB minor number */
2043 usb_deregister_dev(intf, &auerswald_class); 2044 usb_deregister_dev(intf, &auerswald_class);
2044 2045
2045 down (&cp->mutex); 2046 mutex_lock(&cp->mutex);
2046 info ("device /dev/%s now disconnecting", cp->name); 2047 info ("device /dev/%s now disconnecting", cp->name);
2047 2048
2048 /* Stop the interrupt endpoint */ 2049 /* Stop the interrupt endpoint */
@@ -2057,16 +2058,18 @@ static void auerswald_disconnect (struct usb_interface *intf)
2057 2058
2058 if (cp->open_count == 0) { 2059 if (cp->open_count == 0) {
2059 /* nobody is using this device. So we can clean up now */ 2060 /* nobody is using this device. So we can clean up now */
2060 up (&cp->mutex);/* up() is possible here because no other task 2061 mutex_unlock(&cp->mutex);
2061 can open the device (see above). I don't want 2062 /* mutex_unlock() is possible here because no other task
2062 to kfree() a locked mutex. */ 2063 can open the device (see above). I don't want
2064 to kfree() a locked mutex. */
2065
2063 auerswald_delete (cp); 2066 auerswald_delete (cp);
2064 } else { 2067 } else {
2065 /* device is used. Remove the pointer to the 2068 /* device is used. Remove the pointer to the
2066 usb device (it's not valid any more). The last 2069 usb device (it's not valid any more). The last
2067 release() will do the clean up */ 2070 release() will do the clean up */
2068 cp->usbdev = NULL; 2071 cp->usbdev = NULL;
2069 up (&cp->mutex); 2072 mutex_unlock(&cp->mutex);
2070 /* Terminate waiting writers */ 2073 /* Terminate waiting writers */
2071 wake_up (&cp->bufferwait); 2074 wake_up (&cp->bufferwait);
2072 /* Inform all waiting readers */ 2075 /* Inform all waiting readers */