Skip to content

Commit bfbf3c0

Browse files
mkaehlckedavem330
authored andcommitted
[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>
1 parent 74da9d8 commit bfbf3c0

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

‎drivers/atm/fore200e.c‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/*
2-
$Id: fore200e.c,v 1.5 2000/04/14 10:10:34 davem Exp $
3-
42
A FORE Systems 200E-series driver for ATM on Linux.
53
Christophe Lizzi (lizzi@cnam.fr), October 1999-March 2003.
64
@@ -1502,9 +1500,9 @@ fore200e_open(struct atm_vcc *vcc)
15021500
/* pseudo-CBR bandwidth requested? */
15031501
if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) {
15041502

1505-
down(&fore200e->rate_sf);
1503+
mutex_lock(&fore200e->rate_mtx);
15061504
if (fore200e->available_cell_rate < vcc->qos.txtp.max_pcr) {
1507-
up(&fore200e->rate_sf);
1505+
mutex_unlock(&fore200e->rate_mtx);
15081506

15091507
kfree(fore200e_vcc);
15101508
vc_map->vcc = NULL;
@@ -1513,7 +1511,7 @@ fore200e_open(struct atm_vcc *vcc)
15131511

15141512
/* reserve bandwidth */
15151513
fore200e->available_cell_rate -= vcc->qos.txtp.max_pcr;
1516-
up(&fore200e->rate_sf);
1514+
mutex_unlock(&fore200e->rate_mtx);
15171515
}
15181516

15191517
vcc->itf = vcc->dev->number;
@@ -1599,9 +1597,9 @@ fore200e_close(struct atm_vcc* vcc)
15991597
/* release reserved bandwidth, if any */
16001598
if ((vcc->qos.txtp.traffic_class == ATM_CBR) && (vcc->qos.txtp.max_pcr > 0)) {
16011599

1602-
down(&fore200e->rate_sf);
1600+
mutex_lock(&fore200e->rate_mtx);
16031601
fore200e->available_cell_rate += vcc->qos.txtp.max_pcr;
1604-
up(&fore200e->rate_sf);
1602+
mutex_unlock(&fore200e->rate_mtx);
16051603

16061604
clear_bit(ATM_VF_HASQOS, &vcc->flags);
16071605
}
@@ -2064,16 +2062,16 @@ fore200e_change_qos(struct atm_vcc* vcc,struct atm_qos* qos, int flags)
20642062

20652063
if ((qos->txtp.traffic_class == ATM_CBR) && (qos->txtp.max_pcr > 0)) {
20662064

2067-
down(&fore200e->rate_sf);
2065+
mutex_lock(&fore200e->rate_mtx);
20682066
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);
20702068
return -EAGAIN;
20712069
}
20722070

20732071
fore200e->available_cell_rate += vcc->qos.txtp.max_pcr;
20742072
fore200e->available_cell_rate -= qos->txtp.max_pcr;
20752073

2076-
up(&fore200e->rate_sf);
2074+
mutex_unlock(&fore200e->rate_mtx);
20772075

20782076
memcpy(&vcc->qos, qos, sizeof(struct atm_qos));
20792077

@@ -2459,7 +2457,7 @@ fore200e_initialize(struct fore200e* fore200e)
24592457

24602458
DPRINTK(2, "device %s being initialized\n", fore200e->name);
24612459

2462-
init_MUTEX(&fore200e->rate_sf);
2460+
mutex_init(&fore200e->rate_mtx);
24632461
spin_lock_init(&fore200e->q_lock);
24642462

24652463
cpq = fore200e->cp_queues = fore200e->virt_base + FORE200E_CP_QUEUES_OFFSET;

‎drivers/atm/fore200e.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ typedef struct fore200e {
869869

870870
struct stats* stats; /* last snapshot of the stats */
871871

872-
struct semaphore rate_sf; /* protects rate reservation ops */
872+
struct mutex rate_mtx; /* protects rate reservation ops */
873873
spinlock_t q_lock; /* protects queue ops */
874874
#ifdef FORE200E_USE_TASKLET
875875
struct tasklet_struct tx_tasklet; /* performs tx interrupt work */

0 commit comments

Comments
 (0)