aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/atm
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-05-23 17:45:45 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-05-24 19:36:45 -0400
commit7e7a2d07b0faf13b2f7ad982c77ca30c9e9ee0e4 (patch)
treed240ffa7be59202626ef8d23ff14cd1718faabb4 /drivers/atm
parentbbb711e63332d7b43b535381c78b26a66cd60f48 (diff)
[ATM]: Use mutex instead of binary semaphore in idt77252 driver.
Use mutex instead of binary semaphore in idt77252 driver. Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm')
-rw-r--r--drivers/atm/idt77252.c27
-rw-r--r--drivers/atm/idt77252.h4
2 files changed, 16 insertions, 15 deletions
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 057efbc55d38..3800bc0cb2ef 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -47,7 +47,8 @@ static char const rcsid[] =
47#include <linux/bitops.h> 47#include <linux/bitops.h>
48#include <linux/wait.h> 48#include <linux/wait.h>
49#include <linux/jiffies.h> 49#include <linux/jiffies.h>
50#include <asm/semaphore.h> 50#include <linux/mutex.h>
51
51#include <asm/io.h> 52#include <asm/io.h>
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
53#include <asm/atomic.h> 54#include <asm/atomic.h>
@@ -2435,7 +2436,7 @@ idt77252_open(struct atm_vcc *vcc)
2435 2436
2436 set_bit(ATM_VF_ADDR, &vcc->flags); 2437 set_bit(ATM_VF_ADDR, &vcc->flags);
2437 2438
2438 down(&card->mutex); 2439 mutex_lock(&card->mutex);
2439 2440
2440 OPRINTK("%s: opening vpi.vci: %d.%d\n", card->name, vpi, vci); 2441 OPRINTK("%s: opening vpi.vci: %d.%d\n", card->name, vpi, vci);
2441 2442
@@ -2446,7 +2447,7 @@ idt77252_open(struct atm_vcc *vcc)
2446 break; 2447 break;
2447 default: 2448 default:
2448 printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal); 2449 printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal);
2449 up(&card->mutex); 2450 mutex_unlock(&card->mutex);
2450 return -EPROTONOSUPPORT; 2451 return -EPROTONOSUPPORT;
2451 } 2452 }
2452 2453
@@ -2455,7 +2456,7 @@ idt77252_open(struct atm_vcc *vcc)
2455 card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL); 2456 card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
2456 if (!card->vcs[index]) { 2457 if (!card->vcs[index]) {
2457 printk("%s: can't alloc vc in open()\n", card->name); 2458 printk("%s: can't alloc vc in open()\n", card->name);
2458 up(&card->mutex); 2459 mutex_unlock(&card->mutex);
2459 return -ENOMEM; 2460 return -ENOMEM;
2460 } 2461 }
2461 card->vcs[index]->card = card; 2462 card->vcs[index]->card = card;
@@ -2484,14 +2485,14 @@ idt77252_open(struct atm_vcc *vcc)
2484 if (inuse) { 2485 if (inuse) {
2485 printk("%s: %s vci already in use.\n", card->name, 2486 printk("%s: %s vci already in use.\n", card->name,
2486 inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx"); 2487 inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx");
2487 up(&card->mutex); 2488 mutex_unlock(&card->mutex);
2488 return -EADDRINUSE; 2489 return -EADDRINUSE;
2489 } 2490 }
2490 2491
2491 if (vcc->qos.txtp.traffic_class != ATM_NONE) { 2492 if (vcc->qos.txtp.traffic_class != ATM_NONE) {
2492 error = idt77252_init_tx(card, vc, vcc, &vcc->qos); 2493 error = idt77252_init_tx(card, vc, vcc, &vcc->qos);
2493 if (error) { 2494 if (error) {
2494 up(&card->mutex); 2495 mutex_unlock(&card->mutex);
2495 return error; 2496 return error;
2496 } 2497 }
2497 } 2498 }
@@ -2499,14 +2500,14 @@ idt77252_open(struct atm_vcc *vcc)
2499 if (vcc->qos.rxtp.traffic_class != ATM_NONE) { 2500 if (vcc->qos.rxtp.traffic_class != ATM_NONE) {
2500 error = idt77252_init_rx(card, vc, vcc, &vcc->qos); 2501 error = idt77252_init_rx(card, vc, vcc, &vcc->qos);
2501 if (error) { 2502 if (error) {
2502 up(&card->mutex); 2503 mutex_unlock(&card->mutex);
2503 return error; 2504 return error;
2504 } 2505 }
2505 } 2506 }
2506 2507
2507 set_bit(ATM_VF_READY, &vcc->flags); 2508 set_bit(ATM_VF_READY, &vcc->flags);
2508 2509
2509 up(&card->mutex); 2510 mutex_unlock(&card->mutex);
2510 return 0; 2511 return 0;
2511} 2512}
2512 2513
@@ -2520,7 +2521,7 @@ idt77252_close(struct atm_vcc *vcc)
2520 unsigned long addr; 2521 unsigned long addr;
2521 unsigned long timeout; 2522 unsigned long timeout;
2522 2523
2523 down(&card->mutex); 2524 mutex_lock(&card->mutex);
2524 2525
2525 IPRINTK("%s: idt77252_close: vc = %d (%d.%d)\n", 2526 IPRINTK("%s: idt77252_close: vc = %d (%d.%d)\n",
2526 card->name, vc->index, vcc->vpi, vcc->vci); 2527 card->name, vc->index, vcc->vpi, vcc->vci);
@@ -2591,7 +2592,7 @@ done:
2591 free_scq(card, vc->scq); 2592 free_scq(card, vc->scq);
2592 } 2593 }
2593 2594
2594 up(&card->mutex); 2595 mutex_unlock(&card->mutex);
2595} 2596}
2596 2597
2597static int 2598static int
@@ -2602,7 +2603,7 @@ idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags)
2602 struct vc_map *vc = vcc->dev_data; 2603 struct vc_map *vc = vcc->dev_data;
2603 int error = 0; 2604 int error = 0;
2604 2605
2605 down(&card->mutex); 2606 mutex_lock(&card->mutex);
2606 2607
2607 if (qos->txtp.traffic_class != ATM_NONE) { 2608 if (qos->txtp.traffic_class != ATM_NONE) {
2608 if (!test_bit(VCF_TX, &vc->flags)) { 2609 if (!test_bit(VCF_TX, &vc->flags)) {
@@ -2648,7 +2649,7 @@ idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags)
2648 set_bit(ATM_VF_HASQOS, &vcc->flags); 2649 set_bit(ATM_VF_HASQOS, &vcc->flags);
2649 2650
2650out: 2651out:
2651 up(&card->mutex); 2652 mutex_unlock(&card->mutex);
2652 return error; 2653 return error;
2653} 2654}
2654 2655
@@ -3709,7 +3710,7 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
3709 membase = pci_resource_start(pcidev, 1); 3710 membase = pci_resource_start(pcidev, 1);
3710 srambase = pci_resource_start(pcidev, 2); 3711 srambase = pci_resource_start(pcidev, 2);
3711 3712
3712 init_MUTEX(&card->mutex); 3713 mutex_init(&card->mutex);
3713 spin_lock_init(&card->cmd_lock); 3714 spin_lock_init(&card->cmd_lock);
3714 spin_lock_init(&card->tst_lock); 3715 spin_lock_init(&card->tst_lock);
3715 3716
diff --git a/drivers/atm/idt77252.h b/drivers/atm/idt77252.h
index 544b39738291..6f2b4a5875fb 100644
--- a/drivers/atm/idt77252.h
+++ b/drivers/atm/idt77252.h
@@ -37,7 +37,7 @@
37#include <linux/ptrace.h> 37#include <linux/ptrace.h>
38#include <linux/skbuff.h> 38#include <linux/skbuff.h>
39#include <linux/workqueue.h> 39#include <linux/workqueue.h>
40 40#include <linux/mutex.h>
41 41
42/*****************************************************************************/ 42/*****************************************************************************/
43/* */ 43/* */
@@ -359,7 +359,7 @@ struct idt77252_dev
359 unsigned long srambase; /* SAR's sram base address */ 359 unsigned long srambase; /* SAR's sram base address */
360 void __iomem *fbq[4]; /* FBQ fill addresses */ 360 void __iomem *fbq[4]; /* FBQ fill addresses */
361 361
362 struct semaphore mutex; 362 struct mutex mutex;
363 spinlock_t cmd_lock; /* for r/w utility/sram */ 363 spinlock_t cmd_lock; /* for r/w utility/sram */
364 364
365 unsigned long softstat; 365 unsigned long softstat;