diff options
author | Jan Kiszka <jan.kiszka@web.de> | 2010-02-08 05:12:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-16 19:01:29 -0500 |
commit | 2c8df72259d550ed6dc0b391feb5c2fc13892fb6 (patch) | |
tree | e2f0e2a35cb72fbfe8781dd3e8769bb9e93f57b8 /drivers/isdn/capi | |
parent | fb4b4881ef951f6ed8fb8564ca1821dea10778c4 (diff) |
CAPI: Drop remaining NULL checks on tty->driver_data
tty_struct's driver_data cannot be NULL, no need to test for it.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/capi')
-rw-r--r-- | drivers/isdn/capi/capi.c | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index e164a8fb9693..acc811bfe8e0 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -1097,7 +1097,7 @@ static void capinc_tty_close(struct tty_struct *tty, struct file *filp) | |||
1097 | static int capinc_tty_write(struct tty_struct * tty, | 1097 | static int capinc_tty_write(struct tty_struct * tty, |
1098 | const unsigned char *buf, int count) | 1098 | const unsigned char *buf, int count) |
1099 | { | 1099 | { |
1100 | struct capiminor *mp = (struct capiminor *)tty->driver_data; | 1100 | struct capiminor *mp = tty->driver_data; |
1101 | struct sk_buff *skb; | 1101 | struct sk_buff *skb; |
1102 | unsigned long flags; | 1102 | unsigned long flags; |
1103 | 1103 | ||
@@ -1105,7 +1105,7 @@ static int capinc_tty_write(struct tty_struct * tty, | |||
1105 | printk(KERN_DEBUG "capinc_tty_write(count=%d)\n", count); | 1105 | printk(KERN_DEBUG "capinc_tty_write(count=%d)\n", count); |
1106 | #endif | 1106 | #endif |
1107 | 1107 | ||
1108 | if (!mp || !mp->nccip) { | 1108 | if (!mp->nccip) { |
1109 | #ifdef _DEBUG_TTYFUNCS | 1109 | #ifdef _DEBUG_TTYFUNCS |
1110 | printk(KERN_DEBUG "capinc_tty_write: mp or mp->ncci NULL\n"); | 1110 | printk(KERN_DEBUG "capinc_tty_write: mp or mp->ncci NULL\n"); |
1111 | #endif | 1111 | #endif |
@@ -1140,7 +1140,7 @@ static int capinc_tty_write(struct tty_struct * tty, | |||
1140 | 1140 | ||
1141 | static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) | 1141 | static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) |
1142 | { | 1142 | { |
1143 | struct capiminor *mp = (struct capiminor *)tty->driver_data; | 1143 | struct capiminor *mp = tty->driver_data; |
1144 | struct sk_buff *skb; | 1144 | struct sk_buff *skb; |
1145 | unsigned long flags; | 1145 | unsigned long flags; |
1146 | int ret = 1; | 1146 | int ret = 1; |
@@ -1149,7 +1149,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) | |||
1149 | printk(KERN_DEBUG "capinc_put_char(%u)\n", ch); | 1149 | printk(KERN_DEBUG "capinc_put_char(%u)\n", ch); |
1150 | #endif | 1150 | #endif |
1151 | 1151 | ||
1152 | if (!mp || !mp->nccip) { | 1152 | if (!mp->nccip) { |
1153 | #ifdef _DEBUG_TTYFUNCS | 1153 | #ifdef _DEBUG_TTYFUNCS |
1154 | printk(KERN_DEBUG "capinc_tty_put_char: mp or mp->ncci NULL\n"); | 1154 | printk(KERN_DEBUG "capinc_tty_put_char: mp or mp->ncci NULL\n"); |
1155 | #endif | 1155 | #endif |
@@ -1184,7 +1184,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch) | |||
1184 | 1184 | ||
1185 | static void capinc_tty_flush_chars(struct tty_struct *tty) | 1185 | static void capinc_tty_flush_chars(struct tty_struct *tty) |
1186 | { | 1186 | { |
1187 | struct capiminor *mp = (struct capiminor *)tty->driver_data; | 1187 | struct capiminor *mp = tty->driver_data; |
1188 | struct sk_buff *skb; | 1188 | struct sk_buff *skb; |
1189 | unsigned long flags; | 1189 | unsigned long flags; |
1190 | 1190 | ||
@@ -1192,7 +1192,7 @@ static void capinc_tty_flush_chars(struct tty_struct *tty) | |||
1192 | printk(KERN_DEBUG "capinc_tty_flush_chars\n"); | 1192 | printk(KERN_DEBUG "capinc_tty_flush_chars\n"); |
1193 | #endif | 1193 | #endif |
1194 | 1194 | ||
1195 | if (!mp || !mp->nccip) { | 1195 | if (!mp->nccip) { |
1196 | #ifdef _DEBUG_TTYFUNCS | 1196 | #ifdef _DEBUG_TTYFUNCS |
1197 | printk(KERN_DEBUG "capinc_tty_flush_chars: mp or mp->ncci NULL\n"); | 1197 | printk(KERN_DEBUG "capinc_tty_flush_chars: mp or mp->ncci NULL\n"); |
1198 | #endif | 1198 | #endif |
@@ -1213,9 +1213,10 @@ static void capinc_tty_flush_chars(struct tty_struct *tty) | |||
1213 | 1213 | ||
1214 | static int capinc_tty_write_room(struct tty_struct *tty) | 1214 | static int capinc_tty_write_room(struct tty_struct *tty) |
1215 | { | 1215 | { |
1216 | struct capiminor *mp = (struct capiminor *)tty->driver_data; | 1216 | struct capiminor *mp = tty->driver_data; |
1217 | int room; | 1217 | int room; |
1218 | if (!mp || !mp->nccip) { | 1218 | |
1219 | if (!mp->nccip) { | ||
1219 | #ifdef _DEBUG_TTYFUNCS | 1220 | #ifdef _DEBUG_TTYFUNCS |
1220 | printk(KERN_DEBUG "capinc_tty_write_room: mp or mp->ncci NULL\n"); | 1221 | printk(KERN_DEBUG "capinc_tty_write_room: mp or mp->ncci NULL\n"); |
1221 | #endif | 1222 | #endif |
@@ -1231,8 +1232,9 @@ static int capinc_tty_write_room(struct tty_struct *tty) | |||
1231 | 1232 | ||
1232 | static int capinc_tty_chars_in_buffer(struct tty_struct *tty) | 1233 | static int capinc_tty_chars_in_buffer(struct tty_struct *tty) |
1233 | { | 1234 | { |
1234 | struct capiminor *mp = (struct capiminor *)tty->driver_data; | 1235 | struct capiminor *mp = tty->driver_data; |
1235 | if (!mp || !mp->nccip) { | 1236 | |
1237 | if (!mp->nccip) { | ||
1236 | #ifdef _DEBUG_TTYFUNCS | 1238 | #ifdef _DEBUG_TTYFUNCS |
1237 | printk(KERN_DEBUG "capinc_tty_chars_in_buffer: mp or mp->ncci NULL\n"); | 1239 | printk(KERN_DEBUG "capinc_tty_chars_in_buffer: mp or mp->ncci NULL\n"); |
1238 | #endif | 1240 | #endif |
@@ -1266,55 +1268,51 @@ static void capinc_tty_set_termios(struct tty_struct *tty, struct ktermios * old | |||
1266 | #endif | 1268 | #endif |
1267 | } | 1269 | } |
1268 | 1270 | ||
1269 | static void capinc_tty_throttle(struct tty_struct * tty) | 1271 | static void capinc_tty_throttle(struct tty_struct *tty) |
1270 | { | 1272 | { |
1271 | struct capiminor *mp = (struct capiminor *)tty->driver_data; | 1273 | struct capiminor *mp = tty->driver_data; |
1272 | #ifdef _DEBUG_TTYFUNCS | 1274 | #ifdef _DEBUG_TTYFUNCS |
1273 | printk(KERN_DEBUG "capinc_tty_throttle\n"); | 1275 | printk(KERN_DEBUG "capinc_tty_throttle\n"); |
1274 | #endif | 1276 | #endif |
1275 | if (mp) | 1277 | mp->ttyinstop = 1; |
1276 | mp->ttyinstop = 1; | ||
1277 | } | 1278 | } |
1278 | 1279 | ||
1279 | static void capinc_tty_unthrottle(struct tty_struct * tty) | 1280 | static void capinc_tty_unthrottle(struct tty_struct *tty) |
1280 | { | 1281 | { |
1281 | struct capiminor *mp = (struct capiminor *)tty->driver_data; | 1282 | struct capiminor *mp = tty->driver_data; |
1282 | unsigned long flags; | 1283 | unsigned long flags; |
1284 | |||
1283 | #ifdef _DEBUG_TTYFUNCS | 1285 | #ifdef _DEBUG_TTYFUNCS |
1284 | printk(KERN_DEBUG "capinc_tty_unthrottle\n"); | 1286 | printk(KERN_DEBUG "capinc_tty_unthrottle\n"); |
1285 | #endif | 1287 | #endif |
1286 | if (mp) { | 1288 | spin_lock_irqsave(&workaround_lock, flags); |
1287 | spin_lock_irqsave(&workaround_lock, flags); | 1289 | mp->ttyinstop = 0; |
1288 | mp->ttyinstop = 0; | 1290 | handle_minor_recv(mp); |
1289 | handle_minor_recv(mp); | 1291 | spin_unlock_irqrestore(&workaround_lock, flags); |
1290 | spin_unlock_irqrestore(&workaround_lock, flags); | ||
1291 | } | ||
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | static void capinc_tty_stop(struct tty_struct *tty) | 1294 | static void capinc_tty_stop(struct tty_struct *tty) |
1295 | { | 1295 | { |
1296 | struct capiminor *mp = (struct capiminor *)tty->driver_data; | 1296 | struct capiminor *mp = tty->driver_data; |
1297 | |||
1297 | #ifdef _DEBUG_TTYFUNCS | 1298 | #ifdef _DEBUG_TTYFUNCS |
1298 | printk(KERN_DEBUG "capinc_tty_stop\n"); | 1299 | printk(KERN_DEBUG "capinc_tty_stop\n"); |
1299 | #endif | 1300 | #endif |
1300 | if (mp) { | 1301 | mp->ttyoutstop = 1; |
1301 | mp->ttyoutstop = 1; | ||
1302 | } | ||
1303 | } | 1302 | } |
1304 | 1303 | ||
1305 | static void capinc_tty_start(struct tty_struct *tty) | 1304 | static void capinc_tty_start(struct tty_struct *tty) |
1306 | { | 1305 | { |
1307 | struct capiminor *mp = (struct capiminor *)tty->driver_data; | 1306 | struct capiminor *mp = tty->driver_data; |
1308 | unsigned long flags; | 1307 | unsigned long flags; |
1308 | |||
1309 | #ifdef _DEBUG_TTYFUNCS | 1309 | #ifdef _DEBUG_TTYFUNCS |
1310 | printk(KERN_DEBUG "capinc_tty_start\n"); | 1310 | printk(KERN_DEBUG "capinc_tty_start\n"); |
1311 | #endif | 1311 | #endif |
1312 | if (mp) { | 1312 | spin_lock_irqsave(&workaround_lock, flags); |
1313 | spin_lock_irqsave(&workaround_lock, flags); | 1313 | mp->ttyoutstop = 0; |
1314 | mp->ttyoutstop = 0; | 1314 | (void)handle_minor_send(mp); |
1315 | (void)handle_minor_send(mp); | 1315 | spin_unlock_irqrestore(&workaround_lock, flags); |
1316 | spin_unlock_irqrestore(&workaround_lock, flags); | ||
1317 | } | ||
1318 | } | 1316 | } |
1319 | 1317 | ||
1320 | static void capinc_tty_hangup(struct tty_struct *tty) | 1318 | static void capinc_tty_hangup(struct tty_struct *tty) |