Commit 7e7a2d07 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by David S. Miller

[ATM]: Use mutex instead of binary semaphore in idt77252 driver.

Use mutex instead of binary semaphore in idt77252 driver.
Signed-off-by: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bbb711e6
...@@ -47,7 +47,8 @@ static char const rcsid[] = ...@@ -47,7 +47,8 @@ static char const rcsid[] =
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <asm/semaphore.h> #include <linux/mutex.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/atomic.h> #include <asm/atomic.h>
...@@ -2435,7 +2436,7 @@ idt77252_open(struct atm_vcc *vcc) ...@@ -2435,7 +2436,7 @@ idt77252_open(struct atm_vcc *vcc)
set_bit(ATM_VF_ADDR, &vcc->flags); set_bit(ATM_VF_ADDR, &vcc->flags);
down(&card->mutex); mutex_lock(&card->mutex);
OPRINTK("%s: opening vpi.vci: %d.%d\n", card->name, vpi, vci); OPRINTK("%s: opening vpi.vci: %d.%d\n", card->name, vpi, vci);
...@@ -2446,7 +2447,7 @@ idt77252_open(struct atm_vcc *vcc) ...@@ -2446,7 +2447,7 @@ idt77252_open(struct atm_vcc *vcc)
break; break;
default: default:
printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal); printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal);
up(&card->mutex); mutex_unlock(&card->mutex);
return -EPROTONOSUPPORT; return -EPROTONOSUPPORT;
} }
...@@ -2455,7 +2456,7 @@ idt77252_open(struct atm_vcc *vcc) ...@@ -2455,7 +2456,7 @@ idt77252_open(struct atm_vcc *vcc)
card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL); card->vcs[index] = kzalloc(sizeof(struct vc_map), GFP_KERNEL);
if (!card->vcs[index]) { if (!card->vcs[index]) {
printk("%s: can't alloc vc in open()\n", card->name); printk("%s: can't alloc vc in open()\n", card->name);
up(&card->mutex); mutex_unlock(&card->mutex);
return -ENOMEM; return -ENOMEM;
} }
card->vcs[index]->card = card; card->vcs[index]->card = card;
...@@ -2484,14 +2485,14 @@ idt77252_open(struct atm_vcc *vcc) ...@@ -2484,14 +2485,14 @@ idt77252_open(struct atm_vcc *vcc)
if (inuse) { if (inuse) {
printk("%s: %s vci already in use.\n", card->name, printk("%s: %s vci already in use.\n", card->name,
inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx"); inuse == 1 ? "tx" : inuse == 2 ? "rx" : "tx and rx");
up(&card->mutex); mutex_unlock(&card->mutex);
return -EADDRINUSE; return -EADDRINUSE;
} }
if (vcc->qos.txtp.traffic_class != ATM_NONE) { if (vcc->qos.txtp.traffic_class != ATM_NONE) {
error = idt77252_init_tx(card, vc, vcc, &vcc->qos); error = idt77252_init_tx(card, vc, vcc, &vcc->qos);
if (error) { if (error) {
up(&card->mutex); mutex_unlock(&card->mutex);
return error; return error;
} }
} }
...@@ -2499,14 +2500,14 @@ idt77252_open(struct atm_vcc *vcc) ...@@ -2499,14 +2500,14 @@ idt77252_open(struct atm_vcc *vcc)
if (vcc->qos.rxtp.traffic_class != ATM_NONE) { if (vcc->qos.rxtp.traffic_class != ATM_NONE) {
error = idt77252_init_rx(card, vc, vcc, &vcc->qos); error = idt77252_init_rx(card, vc, vcc, &vcc->qos);
if (error) { if (error) {
up(&card->mutex); mutex_unlock(&card->mutex);
return error; return error;
} }
} }
set_bit(ATM_VF_READY, &vcc->flags); set_bit(ATM_VF_READY, &vcc->flags);
up(&card->mutex); mutex_unlock(&card->mutex);
return 0; return 0;
} }
...@@ -2520,7 +2521,7 @@ idt77252_close(struct atm_vcc *vcc) ...@@ -2520,7 +2521,7 @@ idt77252_close(struct atm_vcc *vcc)
unsigned long addr; unsigned long addr;
unsigned long timeout; unsigned long timeout;
down(&card->mutex); mutex_lock(&card->mutex);
IPRINTK("%s: idt77252_close: vc = %d (%d.%d)\n", IPRINTK("%s: idt77252_close: vc = %d (%d.%d)\n",
card->name, vc->index, vcc->vpi, vcc->vci); card->name, vc->index, vcc->vpi, vcc->vci);
...@@ -2591,7 +2592,7 @@ idt77252_close(struct atm_vcc *vcc) ...@@ -2591,7 +2592,7 @@ idt77252_close(struct atm_vcc *vcc)
free_scq(card, vc->scq); free_scq(card, vc->scq);
} }
up(&card->mutex); mutex_unlock(&card->mutex);
} }
static int static int
...@@ -2602,7 +2603,7 @@ idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags) ...@@ -2602,7 +2603,7 @@ idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags)
struct vc_map *vc = vcc->dev_data; struct vc_map *vc = vcc->dev_data;
int error = 0; int error = 0;
down(&card->mutex); mutex_lock(&card->mutex);
if (qos->txtp.traffic_class != ATM_NONE) { if (qos->txtp.traffic_class != ATM_NONE) {
if (!test_bit(VCF_TX, &vc->flags)) { 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,7 +2649,7 @@ idt77252_change_qos(struct atm_vcc *vcc, struct atm_qos *qos, int flags)
set_bit(ATM_VF_HASQOS, &vcc->flags); set_bit(ATM_VF_HASQOS, &vcc->flags);
out: out:
up(&card->mutex); mutex_unlock(&card->mutex);
return error; return error;
} }
...@@ -3709,7 +3710,7 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) ...@@ -3709,7 +3710,7 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
membase = pci_resource_start(pcidev, 1); membase = pci_resource_start(pcidev, 1);
srambase = pci_resource_start(pcidev, 2); srambase = pci_resource_start(pcidev, 2);
init_MUTEX(&card->mutex); mutex_init(&card->mutex);
spin_lock_init(&card->cmd_lock); spin_lock_init(&card->cmd_lock);
spin_lock_init(&card->tst_lock); spin_lock_init(&card->tst_lock);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/mutex.h>
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
...@@ -359,7 +359,7 @@ struct idt77252_dev ...@@ -359,7 +359,7 @@ struct idt77252_dev
unsigned long srambase; /* SAR's sram base address */ unsigned long srambase; /* SAR's sram base address */
void __iomem *fbq[4]; /* FBQ fill addresses */ void __iomem *fbq[4]; /* FBQ fill addresses */
struct semaphore mutex; struct mutex mutex;
spinlock_t cmd_lock; /* for r/w utility/sram */ spinlock_t cmd_lock; /* for r/w utility/sram */
unsigned long softstat; unsigned long softstat;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment