diff options
author | Daniel Walker <dwalker@mvista.com> | 2008-04-29 06:39:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-29 06:39:29 -0400 |
commit | eff0dee54674a449e7f160aad9f3e0d38e6983eb (patch) | |
tree | d0577bc292f555fa235d3bc460d0cd96c4dd47a5 | |
parent | 220fc3fc60e9ebeb5ecfe727e4819d9504f2b0b0 (diff) |
atm: ambassador: vcc_sf semaphore to mutex
Signed-off-by: Daniel Walker <dwalker@mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/atm/ambassador.c | 19 | ||||
-rw-r--r-- | drivers/atm/ambassador.h | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c index 5aa12b011a9a..6adb72a2f876 100644 --- a/drivers/atm/ambassador.c +++ b/drivers/atm/ambassador.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/interrupt.h> | 33 | #include <linux/interrupt.h> |
34 | #include <linux/poison.h> | 34 | #include <linux/poison.h> |
35 | #include <linux/bitrev.h> | 35 | #include <linux/bitrev.h> |
36 | #include <linux/mutex.h> | ||
36 | 37 | ||
37 | #include <asm/atomic.h> | 38 | #include <asm/atomic.h> |
38 | #include <asm/io.h> | 39 | #include <asm/io.h> |
@@ -1177,7 +1178,7 @@ static int amb_open (struct atm_vcc * atm_vcc) | |||
1177 | 1178 | ||
1178 | vcc->tx_frame_bits = tx_frame_bits; | 1179 | vcc->tx_frame_bits = tx_frame_bits; |
1179 | 1180 | ||
1180 | down (&dev->vcc_sf); | 1181 | mutex_lock(&dev->vcc_sf); |
1181 | if (dev->rxer[vci]) { | 1182 | if (dev->rxer[vci]) { |
1182 | // RXer on the channel already, just modify rate... | 1183 | // RXer on the channel already, just modify rate... |
1183 | cmd.request = cpu_to_be32 (SRB_MODIFY_VC_RATE); | 1184 | cmd.request = cpu_to_be32 (SRB_MODIFY_VC_RATE); |
@@ -1203,7 +1204,7 @@ static int amb_open (struct atm_vcc * atm_vcc) | |||
1203 | schedule(); | 1204 | schedule(); |
1204 | } | 1205 | } |
1205 | dev->txer[vci].tx_present = 1; | 1206 | dev->txer[vci].tx_present = 1; |
1206 | up (&dev->vcc_sf); | 1207 | mutex_unlock(&dev->vcc_sf); |
1207 | } | 1208 | } |
1208 | 1209 | ||
1209 | if (rxtp->traffic_class != ATM_NONE) { | 1210 | if (rxtp->traffic_class != ATM_NONE) { |
@@ -1211,7 +1212,7 @@ static int amb_open (struct atm_vcc * atm_vcc) | |||
1211 | 1212 | ||
1212 | vcc->rx_info.pool = pool; | 1213 | vcc->rx_info.pool = pool; |
1213 | 1214 | ||
1214 | down (&dev->vcc_sf); | 1215 | mutex_lock(&dev->vcc_sf); |
1215 | /* grow RX buffer pool */ | 1216 | /* grow RX buffer pool */ |
1216 | if (!dev->rxq[pool].buffers_wanted) | 1217 | if (!dev->rxq[pool].buffers_wanted) |
1217 | dev->rxq[pool].buffers_wanted = rx_lats; | 1218 | dev->rxq[pool].buffers_wanted = rx_lats; |
@@ -1237,7 +1238,7 @@ static int amb_open (struct atm_vcc * atm_vcc) | |||
1237 | schedule(); | 1238 | schedule(); |
1238 | // this link allows RX frames through | 1239 | // this link allows RX frames through |
1239 | dev->rxer[vci] = atm_vcc; | 1240 | dev->rxer[vci] = atm_vcc; |
1240 | up (&dev->vcc_sf); | 1241 | mutex_unlock(&dev->vcc_sf); |
1241 | } | 1242 | } |
1242 | 1243 | ||
1243 | // indicate readiness | 1244 | // indicate readiness |
@@ -1262,7 +1263,7 @@ static void amb_close (struct atm_vcc * atm_vcc) { | |||
1262 | if (atm_vcc->qos.txtp.traffic_class != ATM_NONE) { | 1263 | if (atm_vcc->qos.txtp.traffic_class != ATM_NONE) { |
1263 | command cmd; | 1264 | command cmd; |
1264 | 1265 | ||
1265 | down (&dev->vcc_sf); | 1266 | mutex_lock(&dev->vcc_sf); |
1266 | if (dev->rxer[vci]) { | 1267 | if (dev->rxer[vci]) { |
1267 | // RXer still on the channel, just modify rate... XXX not really needed | 1268 | // RXer still on the channel, just modify rate... XXX not really needed |
1268 | cmd.request = cpu_to_be32 (SRB_MODIFY_VC_RATE); | 1269 | cmd.request = cpu_to_be32 (SRB_MODIFY_VC_RATE); |
@@ -1277,7 +1278,7 @@ static void amb_close (struct atm_vcc * atm_vcc) { | |||
1277 | dev->txer[vci].tx_present = 0; | 1278 | dev->txer[vci].tx_present = 0; |
1278 | while (command_do (dev, &cmd)) | 1279 | while (command_do (dev, &cmd)) |
1279 | schedule(); | 1280 | schedule(); |
1280 | up (&dev->vcc_sf); | 1281 | mutex_unlock(&dev->vcc_sf); |
1281 | } | 1282 | } |
1282 | 1283 | ||
1283 | // disable RXing | 1284 | // disable RXing |
@@ -1287,7 +1288,7 @@ static void amb_close (struct atm_vcc * atm_vcc) { | |||
1287 | // this is (the?) one reason why we need the amb_vcc struct | 1288 | // this is (the?) one reason why we need the amb_vcc struct |
1288 | unsigned char pool = vcc->rx_info.pool; | 1289 | unsigned char pool = vcc->rx_info.pool; |
1289 | 1290 | ||
1290 | down (&dev->vcc_sf); | 1291 | mutex_lock(&dev->vcc_sf); |
1291 | if (dev->txer[vci].tx_present) { | 1292 | if (dev->txer[vci].tx_present) { |
1292 | // TXer still on the channel, just go to pool zero XXX not really needed | 1293 | // TXer still on the channel, just go to pool zero XXX not really needed |
1293 | cmd.request = cpu_to_be32 (SRB_MODIFY_VC_FLAGS); | 1294 | cmd.request = cpu_to_be32 (SRB_MODIFY_VC_FLAGS); |
@@ -1314,7 +1315,7 @@ static void amb_close (struct atm_vcc * atm_vcc) { | |||
1314 | dev->rxq[pool].buffers_wanted = 0; | 1315 | dev->rxq[pool].buffers_wanted = 0; |
1315 | drain_rx_pool (dev, pool); | 1316 | drain_rx_pool (dev, pool); |
1316 | } | 1317 | } |
1317 | up (&dev->vcc_sf); | 1318 | mutex_unlock(&dev->vcc_sf); |
1318 | } | 1319 | } |
1319 | 1320 | ||
1320 | // free our structure | 1321 | // free our structure |
@@ -2188,7 +2189,7 @@ static void setup_dev(amb_dev *dev, struct pci_dev *pci_dev) | |||
2188 | 2189 | ||
2189 | // semaphore for txer/rxer modifications - we cannot use a | 2190 | // semaphore for txer/rxer modifications - we cannot use a |
2190 | // spinlock as the critical region needs to switch processes | 2191 | // spinlock as the critical region needs to switch processes |
2191 | init_MUTEX (&dev->vcc_sf); | 2192 | mutex_init(&dev->vcc_sf); |
2192 | // queue manipulation spinlocks; we want atomic reads and | 2193 | // queue manipulation spinlocks; we want atomic reads and |
2193 | // writes to the queue descriptors (handles IRQ and SMP) | 2194 | // writes to the queue descriptors (handles IRQ and SMP) |
2194 | // consider replacing "int pending" -> "atomic_t available" | 2195 | // consider replacing "int pending" -> "atomic_t available" |
diff --git a/drivers/atm/ambassador.h b/drivers/atm/ambassador.h index ff2a303cbe00..df55fa8387dc 100644 --- a/drivers/atm/ambassador.h +++ b/drivers/atm/ambassador.h | |||
@@ -638,7 +638,7 @@ struct amb_dev { | |||
638 | amb_txq txq; | 638 | amb_txq txq; |
639 | amb_rxq rxq[NUM_RX_POOLS]; | 639 | amb_rxq rxq[NUM_RX_POOLS]; |
640 | 640 | ||
641 | struct semaphore vcc_sf; | 641 | struct mutex vcc_sf; |
642 | amb_tx_info txer[NUM_VCS]; | 642 | amb_tx_info txer[NUM_VCS]; |
643 | struct atm_vcc * rxer[NUM_VCS]; | 643 | struct atm_vcc * rxer[NUM_VCS]; |
644 | unsigned int tx_avail; | 644 | unsigned int tx_avail; |