Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

atm: ambassador: vcc_sf semaphore to mutex

Signed-off-by: Daniel Walker <dwalker@mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Daniel Walker and committed by
David S. Miller
eff0dee5 220fc3fc

+11 -10
+10 -9
drivers/atm/ambassador.c
··· 33 33 #include <linux/interrupt.h> 34 34 #include <linux/poison.h> 35 35 #include <linux/bitrev.h> 36 + #include <linux/mutex.h> 36 37 37 38 #include <asm/atomic.h> 38 39 #include <asm/io.h> ··· 1178 1177 1179 1178 vcc->tx_frame_bits = tx_frame_bits; 1180 1179 1181 - down (&dev->vcc_sf); 1180 + mutex_lock(&dev->vcc_sf); 1182 1181 if (dev->rxer[vci]) { 1183 1182 // RXer on the channel already, just modify rate... 1184 1183 cmd.request = cpu_to_be32 (SRB_MODIFY_VC_RATE); ··· 1204 1203 schedule(); 1205 1204 } 1206 1205 dev->txer[vci].tx_present = 1; 1207 - up (&dev->vcc_sf); 1206 + mutex_unlock(&dev->vcc_sf); 1208 1207 } 1209 1208 1210 1209 if (rxtp->traffic_class != ATM_NONE) { ··· 1212 1211 1213 1212 vcc->rx_info.pool = pool; 1214 1213 1215 - down (&dev->vcc_sf); 1214 + mutex_lock(&dev->vcc_sf); 1216 1215 /* grow RX buffer pool */ 1217 1216 if (!dev->rxq[pool].buffers_wanted) 1218 1217 dev->rxq[pool].buffers_wanted = rx_lats; ··· 1238 1237 schedule(); 1239 1238 // this link allows RX frames through 1240 1239 dev->rxer[vci] = atm_vcc; 1241 - up (&dev->vcc_sf); 1240 + mutex_unlock(&dev->vcc_sf); 1242 1241 } 1243 1242 1244 1243 // indicate readiness ··· 1263 1262 if (atm_vcc->qos.txtp.traffic_class != ATM_NONE) { 1264 1263 command cmd; 1265 1264 1266 - down (&dev->vcc_sf); 1265 + mutex_lock(&dev->vcc_sf); 1267 1266 if (dev->rxer[vci]) { 1268 1267 // RXer still on the channel, just modify rate... XXX not really needed 1269 1268 cmd.request = cpu_to_be32 (SRB_MODIFY_VC_RATE); ··· 1278 1277 dev->txer[vci].tx_present = 0; 1279 1278 while (command_do (dev, &cmd)) 1280 1279 schedule(); 1281 - up (&dev->vcc_sf); 1280 + mutex_unlock(&dev->vcc_sf); 1282 1281 } 1283 1282 1284 1283 // disable RXing ··· 1288 1287 // this is (the?) one reason why we need the amb_vcc struct 1289 1288 unsigned char pool = vcc->rx_info.pool; 1290 1289 1291 - down (&dev->vcc_sf); 1290 + mutex_lock(&dev->vcc_sf); 1292 1291 if (dev->txer[vci].tx_present) { 1293 1292 // TXer still on the channel, just go to pool zero XXX not really needed 1294 1293 cmd.request = cpu_to_be32 (SRB_MODIFY_VC_FLAGS); ··· 1315 1314 dev->rxq[pool].buffers_wanted = 0; 1316 1315 drain_rx_pool (dev, pool); 1317 1316 } 1318 - up (&dev->vcc_sf); 1317 + mutex_unlock(&dev->vcc_sf); 1319 1318 } 1320 1319 1321 1320 // free our structure ··· 2189 2188 2190 2189 // semaphore for txer/rxer modifications - we cannot use a 2191 2190 // spinlock as the critical region needs to switch processes 2192 - init_MUTEX (&dev->vcc_sf); 2191 + mutex_init(&dev->vcc_sf); 2193 2192 // queue manipulation spinlocks; we want atomic reads and 2194 2193 // writes to the queue descriptors (handles IRQ and SMP) 2195 2194 // consider replacing "int pending" -> "atomic_t available"
+1 -1
drivers/atm/ambassador.h
··· 638 638 amb_txq txq; 639 639 amb_rxq rxq[NUM_RX_POOLS]; 640 640 641 - struct semaphore vcc_sf; 641 + struct mutex vcc_sf; 642 642 amb_tx_info txer[NUM_VCS]; 643 643 struct atm_vcc * rxer[NUM_VCS]; 644 644 unsigned int tx_avail;