diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2007-10-18 06:06:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:26 -0400 |
commit | 1c0a387c1f9e48e480579d3b4e0f9c1a36c77751 (patch) | |
tree | a105b276483f2684efccedf00b147baa3e43f1df /drivers | |
parent | ce97a09767b59dcde3715ba4a9eebc71b0ce71b2 (diff) |
Char: cyclades, move spin_lock to one place
Lock whole processing in isr, avoid error-prone locking/unlocking in rx/tx
esp. On fail paths (there was a bug in the past yet).
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/cyclades.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 39bfe043fba8..46a15d24ce7d 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -994,7 +994,6 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip, | |||
994 | printk(KERN_DEBUG "cyy_interrupt: rcvd intr, chip %d\n", chip); | 994 | printk(KERN_DEBUG "cyy_interrupt: rcvd intr, chip %d\n", chip); |
995 | #endif | 995 | #endif |
996 | /* determine the channel & change to that context */ | 996 | /* determine the channel & change to that context */ |
997 | spin_lock(&cinfo->card_lock); | ||
998 | save_xir = (u_char) readb(base_addr + (CyRIR << index)); | 997 | save_xir = (u_char) readb(base_addr + (CyRIR << index)); |
999 | channel = (u_short) (save_xir & CyIRChannel); | 998 | channel = (u_short) (save_xir & CyIRChannel); |
1000 | info = &cinfo->ports[channel + chip * 4]; | 999 | info = &cinfo->ports[channel + chip * 4]; |
@@ -1031,7 +1030,6 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip, | |||
1031 | 1030 | ||
1032 | if (data & info->ignore_status_mask) { | 1031 | if (data & info->ignore_status_mask) { |
1033 | info->icount.rx++; | 1032 | info->icount.rx++; |
1034 | spin_unlock(&cinfo->card_lock); | ||
1035 | return; | 1033 | return; |
1036 | } | 1034 | } |
1037 | if (tty_buffer_request_room(tty, 1)) { | 1035 | if (tty_buffer_request_room(tty, 1)) { |
@@ -1116,7 +1114,6 @@ end: | |||
1116 | /* end of service */ | 1114 | /* end of service */ |
1117 | cy_writeb(base_addr + (CyRIR << index), save_xir & 0x3f); | 1115 | cy_writeb(base_addr + (CyRIR << index), save_xir & 0x3f); |
1118 | cy_writeb(base_addr + (CyCAR << index), save_car); | 1116 | cy_writeb(base_addr + (CyCAR << index), save_car); |
1119 | spin_unlock(&cinfo->card_lock); | ||
1120 | } | 1117 | } |
1121 | 1118 | ||
1122 | static void cyy_chip_tx(struct cyclades_card *cinfo, int chip, | 1119 | static void cyy_chip_tx(struct cyclades_card *cinfo, int chip, |
@@ -1135,7 +1132,6 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, int chip, | |||
1135 | #endif | 1132 | #endif |
1136 | 1133 | ||
1137 | /* determine the channel & change to that context */ | 1134 | /* determine the channel & change to that context */ |
1138 | spin_lock(&cinfo->card_lock); | ||
1139 | save_xir = (u_char) readb(base_addr + (CyTIR << index)); | 1135 | save_xir = (u_char) readb(base_addr + (CyTIR << index)); |
1140 | channel = (u_short) (save_xir & CyIRChannel); | 1136 | channel = (u_short) (save_xir & CyIRChannel); |
1141 | save_car = readb(base_addr + (CyCAR << index)); | 1137 | save_car = readb(base_addr + (CyCAR << index)); |
@@ -1240,7 +1236,6 @@ end: | |||
1240 | /* end of service */ | 1236 | /* end of service */ |
1241 | cy_writeb(base_addr + (CyTIR << index), save_xir & 0x3f); | 1237 | cy_writeb(base_addr + (CyTIR << index), save_xir & 0x3f); |
1242 | cy_writeb(base_addr + (CyCAR << index), save_car); | 1238 | cy_writeb(base_addr + (CyCAR << index), save_car); |
1243 | spin_unlock(&cinfo->card_lock); | ||
1244 | } | 1239 | } |
1245 | 1240 | ||
1246 | static void cyy_chip_modem(struct cyclades_card *cinfo, int chip, | 1241 | static void cyy_chip_modem(struct cyclades_card *cinfo, int chip, |
@@ -1251,7 +1246,6 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip, | |||
1251 | int save_xir, channel, save_car, index = cinfo->bus_index; | 1246 | int save_xir, channel, save_car, index = cinfo->bus_index; |
1252 | 1247 | ||
1253 | /* determine the channel & change to that context */ | 1248 | /* determine the channel & change to that context */ |
1254 | spin_lock(&cinfo->card_lock); | ||
1255 | save_xir = (u_char) readb(base_addr + (CyMIR << index)); | 1249 | save_xir = (u_char) readb(base_addr + (CyMIR << index)); |
1256 | channel = (u_short) (save_xir & CyIRChannel); | 1250 | channel = (u_short) (save_xir & CyIRChannel); |
1257 | info = &cinfo->ports[channel + chip * 4]; | 1251 | info = &cinfo->ports[channel + chip * 4]; |
@@ -1315,7 +1309,6 @@ end: | |||
1315 | /* end of service */ | 1309 | /* end of service */ |
1316 | cy_writeb(base_addr + (CyMIR << index), save_xir & 0x3f); | 1310 | cy_writeb(base_addr + (CyMIR << index), save_xir & 0x3f); |
1317 | cy_writeb(base_addr + (CyCAR << index), save_car); | 1311 | cy_writeb(base_addr + (CyCAR << index), save_car); |
1318 | spin_unlock(&cinfo->card_lock); | ||
1319 | } | 1312 | } |
1320 | 1313 | ||
1321 | /* The real interrupt service routine is called | 1314 | /* The real interrupt service routine is called |
@@ -1367,12 +1360,14 @@ static irqreturn_t cyy_interrupt(int irq, void *dev_id) | |||
1367 | */ | 1360 | */ |
1368 | if (1000 < too_many++) | 1361 | if (1000 < too_many++) |
1369 | break; | 1362 | break; |
1363 | spin_lock(&cinfo->card_lock); | ||
1370 | if (status & CySRReceive) /* rx intr */ | 1364 | if (status & CySRReceive) /* rx intr */ |
1371 | cyy_chip_rx(cinfo, chip, base_addr); | 1365 | cyy_chip_rx(cinfo, chip, base_addr); |
1372 | if (status & CySRTransmit) /* tx intr */ | 1366 | if (status & CySRTransmit) /* tx intr */ |
1373 | cyy_chip_tx(cinfo, chip, base_addr); | 1367 | cyy_chip_tx(cinfo, chip, base_addr); |
1374 | if (status & CySRModem) /* modem intr */ | 1368 | if (status & CySRModem) /* modem intr */ |
1375 | cyy_chip_modem(cinfo, chip, base_addr); | 1369 | cyy_chip_modem(cinfo, chip, base_addr); |
1370 | spin_unlock(&cinfo->card_lock); | ||
1376 | } | 1371 | } |
1377 | } | 1372 | } |
1378 | } while (had_work); | 1373 | } while (had_work); |