aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/atm/ueagle-atm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/atm/ueagle-atm.c')
-rw-r--r--drivers/usb/atm/ueagle-atm.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 956cd9e82de..4362cfd801b 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -63,6 +63,7 @@
63#include <linux/ctype.h> 63#include <linux/ctype.h>
64#include <linux/kthread.h> 64#include <linux/kthread.h>
65#include <linux/version.h> 65#include <linux/version.h>
66#include <linux/mutex.h>
66#include <asm/unaligned.h> 67#include <asm/unaligned.h>
67 68
68#include "usbatm.h" 69#include "usbatm.h"
@@ -358,7 +359,7 @@ struct intr_pkt {
358#define INTR_PKT_SIZE 28 359#define INTR_PKT_SIZE 28
359 360
360static struct usb_driver uea_driver; 361static struct usb_driver uea_driver;
361static DECLARE_MUTEX(uea_semaphore); 362static DEFINE_MUTEX(uea_mutex);
362static const char *chip_name[] = {"ADI930", "Eagle I", "Eagle II", "Eagle III"}; 363static const char *chip_name[] = {"ADI930", "Eagle I", "Eagle II", "Eagle III"};
363 364
364static int modem_index; 365static int modem_index;
@@ -1418,13 +1419,13 @@ static ssize_t read_status(struct device *dev, struct device_attribute *attr,
1418 int ret = -ENODEV; 1419 int ret = -ENODEV;
1419 struct uea_softc *sc; 1420 struct uea_softc *sc;
1420 1421
1421 down(&uea_semaphore); 1422 mutex_lock(&uea_mutex);
1422 sc = dev_to_uea(dev); 1423 sc = dev_to_uea(dev);
1423 if (!sc) 1424 if (!sc)
1424 goto out; 1425 goto out;
1425 ret = snprintf(buf, 10, "%08x\n", sc->stats.phy.state); 1426 ret = snprintf(buf, 10, "%08x\n", sc->stats.phy.state);
1426out: 1427out:
1427 up(&uea_semaphore); 1428 mutex_unlock(&uea_mutex);
1428 return ret; 1429 return ret;
1429} 1430}
1430 1431
@@ -1434,14 +1435,14 @@ static ssize_t reboot(struct device *dev, struct device_attribute *attr,
1434 int ret = -ENODEV; 1435 int ret = -ENODEV;
1435 struct uea_softc *sc; 1436 struct uea_softc *sc;
1436 1437
1437 down(&uea_semaphore); 1438 mutex_lock(&uea_mutex);
1438 sc = dev_to_uea(dev); 1439 sc = dev_to_uea(dev);
1439 if (!sc) 1440 if (!sc)
1440 goto out; 1441 goto out;
1441 sc->reset = 1; 1442 sc->reset = 1;
1442 ret = count; 1443 ret = count;
1443out: 1444out:
1444 up(&uea_semaphore); 1445 mutex_unlock(&uea_mutex);
1445 return ret; 1446 return ret;
1446} 1447}
1447 1448
@@ -1453,7 +1454,7 @@ static ssize_t read_human_status(struct device *dev, struct device_attribute *at
1453 int ret = -ENODEV; 1454 int ret = -ENODEV;
1454 struct uea_softc *sc; 1455 struct uea_softc *sc;
1455 1456
1456 down(&uea_semaphore); 1457 mutex_lock(&uea_mutex);
1457 sc = dev_to_uea(dev); 1458 sc = dev_to_uea(dev);
1458 if (!sc) 1459 if (!sc)
1459 goto out; 1460 goto out;
@@ -1473,7 +1474,7 @@ static ssize_t read_human_status(struct device *dev, struct device_attribute *at
1473 break; 1474 break;
1474 } 1475 }
1475out: 1476out:
1476 up(&uea_semaphore); 1477 mutex_unlock(&uea_mutex);
1477 return ret; 1478 return ret;
1478} 1479}
1479 1480
@@ -1485,7 +1486,7 @@ static ssize_t read_delin(struct device *dev, struct device_attribute *attr,
1485 int ret = -ENODEV; 1486 int ret = -ENODEV;
1486 struct uea_softc *sc; 1487 struct uea_softc *sc;
1487 1488
1488 down(&uea_semaphore); 1489 mutex_lock(&uea_mutex);
1489 sc = dev_to_uea(dev); 1490 sc = dev_to_uea(dev);
1490 if (!sc) 1491 if (!sc)
1491 goto out; 1492 goto out;
@@ -1497,7 +1498,7 @@ static ssize_t read_delin(struct device *dev, struct device_attribute *attr,
1497 else 1498 else
1498 ret = sprintf(buf, "GOOD\n"); 1499 ret = sprintf(buf, "GOOD\n");
1499out: 1500out:
1500 up(&uea_semaphore); 1501 mutex_unlock(&uea_mutex);
1501 return ret; 1502 return ret;
1502} 1503}
1503 1504
@@ -1511,7 +1512,7 @@ static ssize_t read_##name(struct device *dev, \
1511 int ret = -ENODEV; \ 1512 int ret = -ENODEV; \
1512 struct uea_softc *sc; \ 1513 struct uea_softc *sc; \
1513 \ 1514 \
1514 down(&uea_semaphore); \ 1515 mutex_lock(&uea_mutex); \
1515 sc = dev_to_uea(dev); \ 1516 sc = dev_to_uea(dev); \
1516 if (!sc) \ 1517 if (!sc) \
1517 goto out; \ 1518 goto out; \
@@ -1519,7 +1520,7 @@ static ssize_t read_##name(struct device *dev, \
1519 if (reset) \ 1520 if (reset) \
1520 sc->stats.phy.name = 0; \ 1521 sc->stats.phy.name = 0; \
1521out: \ 1522out: \
1522 up(&uea_semaphore); \ 1523 mutex_unlock(&uea_mutex); \
1523 return ret; \ 1524 return ret; \
1524} \ 1525} \
1525 \ 1526 \
@@ -1737,9 +1738,9 @@ static void uea_disconnect(struct usb_interface *intf)
1737 * Pre-firmware device has one interface 1738 * Pre-firmware device has one interface
1738 */ 1739 */
1739 if (usb->config->desc.bNumInterfaces != 1 && ifnum == 0) { 1740 if (usb->config->desc.bNumInterfaces != 1 && ifnum == 0) {
1740 down(&uea_semaphore); 1741 mutex_lock(&uea_mutex);
1741 usbatm_usb_disconnect(intf); 1742 usbatm_usb_disconnect(intf);
1742 up(&uea_semaphore); 1743 mutex_unlock(&uea_mutex);
1743 uea_info(usb, "ADSL device removed\n"); 1744 uea_info(usb, "ADSL device removed\n");
1744 } 1745 }
1745 1746