diff options
author | Matthias Kaehlcke <matthias.kaehlcke@gmail.com> | 2007-04-26 04:41:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-04-26 04:41:49 -0400 |
commit | bfbf3c0968498f5232c02965cf41695edae1bc4d (patch) | |
tree | 670a7b942e05325b2461f31695bc62028c9e8adc /drivers/atm | |
parent | 74da9d88bf5ffd31aed61a0b19519684ad744ded (diff) |
[ATM]: Use mutex instead of binary semaphore in FORE Systems 200E-series driver
(akpm: remove CVS control string too)
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/fore200e.c | 20 | ||||
-rw-r--r-- | drivers/atm/fore200e.h | 2 |
2 files changed, 10 insertions, 12 deletions
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index a7c0ed3107e..405ee5e0922 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | $Id: fore200e.c,v 1.5 2000/04/14 10:10:34 davem Exp $ | ||
3 | |||
4 | A FORE Systems 200E-series driver for ATM on Linux. | 2 | A FORE Systems 200E-series driver for ATM on Linux. |
5 | Christophe Lizzi (lizzi@cnam.fr), October 1999-March 2003. | 3 | Christophe Lizzi (lizzi@cnam.fr), October 1999-March 2003. |
6 | 4 | ||
@@ -1502,9 +1500,9 @@ fore200e_open(struct atm_vcc *vcc) | |||
1502 | /* pseudo-CBR bandwidth requested? */ | 1500 | /* pseudo-CBR bandwidth requested? */ |
1503 | if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) { | 1501 | if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) { |
1504 | 1502 | ||
1505 | down(&fore200e->rate_sf); | 1503 | mutex_lock(&fore200e->rate_mtx); |
1506 | if (fore200e->available_cell_rate < vcc->qos.txtp.max_pcr) { | 1504 | if (fore200e->available_cell_rate < vcc->qos.txtp.max_pcr) { |
1507 | up(&fore200e->rate_sf); | 1505 | mutex_unlock(&fore200e->rate_mtx); |
1508 | 1506 | ||
1509 | kfree(fore200e_vcc); | 1507 | kfree(fore200e_vcc); |
1510 | vc_map->vcc = NULL; | 1508 | vc_map->vcc = NULL; |
@@ -1513,7 +1511,7 @@ fore200e_open(struct atm_vcc *vcc) | |||
1513 | 1511 | ||
1514 | /* reserve bandwidth */ | 1512 | /* reserve bandwidth */ |
1515 | fore200e->available_cell_rate -= vcc->qos.txtp.max_pcr; | 1513 | fore200e->available_cell_rate -= vcc->qos.txtp.max_pcr; |
1516 | up(&fore200e->rate_sf); | 1514 | mutex_unlock(&fore200e->rate_mtx); |
1517 | } | 1515 | } |
1518 | 1516 | ||
1519 | vcc->itf = vcc->dev->number; | 1517 | vcc->itf = vcc->dev->number; |
@@ -1599,9 +1597,9 @@ fore200e_close(struct atm_vcc* vcc) | |||
1599 | /* release reserved bandwidth, if any */ | 1597 | /* release reserved bandwidth, if any */ |
1600 | if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) { | 1598 | if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) { |
1601 | 1599 | ||
1602 | down(&fore200e->rate_sf); | 1600 | mutex_lock(&fore200e->rate_mtx); |
1603 | fore200e->available_cell_rate += vcc->qos.txtp.max_pcr; | 1601 | fore200e->available_cell_rate += vcc->qos.txtp.max_pcr; |
1604 | up(&fore200e->rate_sf); | 1602 | mutex_unlock(&fore200e->rate_mtx); |
1605 | 1603 | ||
1606 | clear_bit(ATM_VF_HASQOS, &vcc->flags); | 1604 | clear_bit(ATM_VF_HASQOS, &vcc->flags); |
1607 | } | 1605 | } |
@@ -2064,16 +2062,16 @@ fore200e_change_qos(struct atm_vcc* vcc,struct atm_qos* qos, int flags) | |||
2064 | 2062 | ||
2065 | if ((qos->txtp.traffic_class == ATM_CBR) && (qos->txtp.max_pcr > 0)) { | 2063 | if ((qos->txtp.traffic_class == ATM_CBR) && (qos->txtp.max_pcr > 0)) { |
2066 | 2064 | ||
2067 | down(&fore200e->rate_sf); | 2065 | mutex_lock(&fore200e->rate_mtx); |
2068 | if (fore200e->available_cell_rate + vcc->qos.txtp.max_pcr < qos->txtp.max_pcr) { | 2066 | if (fore200e->available_cell_rate + vcc->qos.txtp.max_pcr < qos->txtp.max_pcr) { |
2069 | up(&fore200e->rate_sf); | 2067 | mutex_unlock(&fore200e->rate_mtx); |
2070 | return -EAGAIN; | 2068 | return -EAGAIN; |
2071 | } | 2069 | } |
2072 | 2070 | ||
2073 | fore200e->available_cell_rate += vcc->qos.txtp.max_pcr; | 2071 | fore200e->available_cell_rate += vcc->qos.txtp.max_pcr; |
2074 | fore200e->available_cell_rate -= qos->txtp.max_pcr; | 2072 | fore200e->available_cell_rate -= qos->txtp.max_pcr; |
2075 | 2073 | ||
2076 | up(&fore200e->rate_sf); | 2074 | mutex_unlock(&fore200e->rate_mtx); |
2077 | 2075 | ||
2078 | memcpy(&vcc->qos, qos, sizeof(struct atm_qos)); | 2076 | memcpy(&vcc->qos, qos, sizeof(struct atm_qos)); |
2079 | 2077 | ||
@@ -2459,7 +2457,7 @@ fore200e_initialize(struct fore200e* fore200e) | |||
2459 | 2457 | ||
2460 | DPRINTK(2, "device %s being initialized\n", fore200e->name); | 2458 | DPRINTK(2, "device %s being initialized\n", fore200e->name); |
2461 | 2459 | ||
2462 | init_MUTEX(&fore200e->rate_sf); | 2460 | mutex_init(&fore200e->rate_mtx); |
2463 | spin_lock_init(&fore200e->q_lock); | 2461 | spin_lock_init(&fore200e->q_lock); |
2464 | 2462 | ||
2465 | cpq = fore200e->cp_queues = fore200e->virt_base + FORE200E_CP_QUEUES_OFFSET; | 2463 | cpq = fore200e->cp_queues = fore200e->virt_base + FORE200E_CP_QUEUES_OFFSET; |
diff --git a/drivers/atm/fore200e.h b/drivers/atm/fore200e.h index f9abfdac33e..b85a54613de 100644 --- a/drivers/atm/fore200e.h +++ b/drivers/atm/fore200e.h | |||
@@ -869,7 +869,7 @@ typedef struct fore200e { | |||
869 | 869 | ||
870 | struct stats* stats; /* last snapshot of the stats */ | 870 | struct stats* stats; /* last snapshot of the stats */ |
871 | 871 | ||
872 | struct semaphore rate_sf; /* protects rate reservation ops */ | 872 | struct mutex rate_mtx; /* protects rate reservation ops */ |
873 | spinlock_t q_lock; /* protects queue ops */ | 873 | spinlock_t q_lock; /* protects queue ops */ |
874 | #ifdef FORE200E_USE_TASKLET | 874 | #ifdef FORE200E_USE_TASKLET |
875 | struct tasklet_struct tx_tasklet; /* performs tx interrupt work */ | 875 | struct tasklet_struct tx_tasklet; /* performs tx interrupt work */ |