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

staging: dgnc: remove struct member magic numbers

Driver uses magic number members within structs, this is an antiquated
method of catching data errors. We don't do things that way any more.

Remove magic number struct members. Remove all checks to magic
numbers.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Tobin C. Harding and committed by
Greg Kroah-Hartman
0053fe0e 51061652

+119 -139
+21 -23
drivers/staging/dgnc/dgnc_cls.c
··· 282 282 { 283 283 unsigned long flags; 284 284 285 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 285 + if (!ch) 286 286 return; 287 287 288 288 spin_lock_irqsave(&ch->ch_lock, flags); ··· 314 314 ushort tail; 315 315 unsigned long flags; 316 316 317 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 317 + if (!ch) 318 318 return; 319 319 320 320 spin_lock_irqsave(&ch->ch_lock, flags); ··· 386 386 { 387 387 unsigned char out; 388 388 389 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 389 + if (!ch) 390 390 return; 391 391 392 392 out = ch->ch_mostat; ··· 409 409 uint len_written = 0; 410 410 unsigned long flags; 411 411 412 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 412 + if (!ch) 413 413 return; 414 414 415 415 spin_lock_irqsave(&ch->ch_lock, flags); ··· 479 479 unsigned char msignals = signals; 480 480 unsigned long flags; 481 481 482 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 482 + if (!ch) 483 483 return; 484 484 485 485 /* ··· 551 551 return; 552 552 553 553 ch = brd->channels[port]; 554 - if (ch->magic != DGNC_CHANNEL_MAGIC) 555 - return; 556 554 557 555 /* Here we try to figure out what caused the interrupt to happen */ 558 556 while (1) { ··· 580 582 /* Channel lock MUST be held before calling this function! */ 581 583 static void cls_flush_uart_write(struct channel_t *ch) 582 584 { 583 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 585 + if (!ch) 584 586 return; 585 587 586 588 writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT), ··· 595 597 /* Channel lock MUST be held before calling this function! */ 596 598 static void cls_flush_uart_read(struct channel_t *ch) 597 599 { 598 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 600 + if (!ch) 599 601 return; 600 602 601 603 /* ··· 625 627 struct channel_t *ch; 626 628 struct un_t *un; 627 629 628 - if (!tty || tty->magic != TTY_MAGIC) 630 + if (!tty) 629 631 return; 630 632 631 633 un = (struct un_t *)tty->driver_data; 632 - if (!un || un->magic != DGNC_UNIT_MAGIC) 634 + if (!un) 633 635 return; 634 636 635 637 ch = un->un_ch; 636 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 638 + if (!ch) 637 639 return; 638 640 639 641 bd = ch->ch_bd; 640 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 642 + if (!bd) 641 643 return; 642 644 643 645 /* If baud rate is zero, flush queues, and set mval to drop DTR. */ ··· 856 858 int state = 0; 857 859 int ports = 0; 858 860 859 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 861 + if (!bd) 860 862 return; 861 863 862 864 spin_lock_irqsave(&bd->bd_lock, flags); ··· 912 914 unsigned char poll_reg; 913 915 unsigned long flags; 914 916 915 - if (!brd || brd->magic != DGNC_BOARD_MAGIC) 917 + if (!brd) 916 918 return IRQ_NONE; 917 919 918 920 spin_lock_irqsave(&brd->bd_intr_lock, flags); ··· 959 961 struct channel_t *ch; 960 962 struct un_t *un; 961 963 962 - if (!tty || tty->magic != TTY_MAGIC) 964 + if (!tty) 963 965 return -ENXIO; 964 966 965 967 un = (struct un_t *)tty->driver_data; 966 - if (!un || un->magic != DGNC_UNIT_MAGIC) 968 + if (!un) 967 969 return -ENXIO; 968 970 969 971 ch = un->un_ch; 970 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 972 + if (!ch) 971 973 return -ENXIO; 972 974 973 975 spin_lock_irqsave(&ch->ch_lock, flags); ··· 984 986 985 987 static void cls_send_start_character(struct channel_t *ch) 986 988 { 987 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 989 + if (!ch) 988 990 return; 989 991 990 992 if (ch->ch_startc != _POSIX_VDISABLE) { ··· 995 997 996 998 static void cls_send_stop_character(struct channel_t *ch) 997 999 { 998 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1000 + if (!ch) 999 1001 return; 1000 1002 1001 1003 if (ch->ch_stopc != _POSIX_VDISABLE) { ··· 1054 1056 unsigned char left = 0; 1055 1057 unsigned char lsr = 0; 1056 1058 1057 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1059 + if (!ch) 1058 1060 return 0; 1059 1061 1060 1062 lsr = readb(&ch->ch_cls_uart->lsr); ··· 1078 1080 */ 1079 1081 static void cls_send_break(struct channel_t *ch, int msecs) 1080 1082 { 1081 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1083 + if (!ch) 1082 1084 return; 1083 1085 1084 1086 /* If we receive a time of 0, this means turn off the break. */ ··· 1117 1119 */ 1118 1120 static void cls_send_immediate_char(struct channel_t *ch, unsigned char c) 1119 1121 { 1120 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1122 + if (!ch) 1121 1123 return; 1122 1124 1123 1125 writeb(c, &ch->ch_cls_uart->txrx);
+1 -2
drivers/staging/dgnc/dgnc_driver.c
··· 110 110 return ERR_PTR(-ENOMEM); 111 111 112 112 /* store the info for the board we've found */ 113 - brd->magic = DGNC_BOARD_MAGIC; 114 113 brd->boardnum = dgnc_num_boards; 115 114 brd->vendor = dgnc_pci_tbl[id].vendor; 116 115 brd->device = dgnc_pci_tbl[id].device; ··· 443 444 { 444 445 int i = 0; 445 446 446 - if (!brd || brd->magic != DGNC_BOARD_MAGIC) 447 + if (!brd) 447 448 return; 448 449 449 450 switch (brd->device) {
-11
drivers/staging/dgnc/dgnc_driver.h
··· 35 35 #define MAXPORTS 8 36 36 #define MAXTTYNAMELEN 200 37 37 38 - /* Our 3 magic numbers for our board, channel and unit structs */ 39 - #define DGNC_BOARD_MAGIC 0x5c6df104 40 - #define DGNC_CHANNEL_MAGIC 0x6c6df104 41 - #define DGNC_UNIT_MAGIC 0x7c6df104 42 - 43 38 /* Serial port types */ 44 39 #define DGNC_SERIAL 0 45 40 #define DGNC_PRINT 1 ··· 115 120 116 121 /** 117 122 * struct dgnc_board - Per board information. 118 - * @magic: Board magic number. 119 123 * @boardnum: Board number (0 - 32). 120 124 * 121 125 * @type: Type of board. ··· 157 163 * @dgnc_board_table: Proc/<board> entry 158 164 */ 159 165 struct dgnc_board { 160 - int magic; 161 166 int boardnum; 162 167 163 168 int type; ··· 238 245 239 246 /** 240 247 * struct un_t - terminal or printer unit 241 - * @magic: Unit magic number. 242 248 * @un_open_count: Counter of opens to port. 243 249 * @un_tty: Pointer to unit tty structure. 244 250 * @un_flags: Unit flags. ··· 245 253 * @un_dev: Minor device number. 246 254 */ 247 255 struct un_t { 248 - int magic; 249 256 struct channel_t *un_ch; 250 257 ulong un_time; 251 258 uint un_type; ··· 286 295 287 296 /** 288 297 * struct channel_t - Channel information. 289 - * @magic: Channel magic number. 290 298 * @dgnc_board: Pointer to board structure. 291 299 * @ch_bd: Transparent print structure. 292 300 * @ch_tun: Terminal unit information. ··· 338 348 * @dgnc_channel_table: Proc/<board>/<channel> entry. 339 349 */ 340 350 struct channel_t { 341 - int magic; 342 351 struct dgnc_board *ch_bd; 343 352 struct digi_t ch_digi; 344 353 struct un_t ch_tun;
+1 -1
drivers/staging/dgnc/dgnc_mgmt.c
··· 175 175 176 176 ch = dgnc_board[board]->channels[channel]; 177 177 178 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 178 + if (!ch) 179 179 return -ENODEV; 180 180 181 181 memset(&ni, 0, sizeof(ni));
+23 -25
drivers/staging/dgnc/dgnc_neo.c
··· 392 392 unsigned long flags; 393 393 394 394 ch = brd->channels[port]; 395 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 395 + if (!ch) 396 396 return; 397 397 398 398 /* Here we try to figure out what caused the interrupt to happen */ ··· 505 505 int linestatus; 506 506 unsigned long flags; 507 507 508 - if (!brd || brd->magic != DGNC_BOARD_MAGIC) 508 + if (!brd) 509 509 return; 510 510 511 511 if (port >= brd->maxports) 512 512 return; 513 513 514 514 ch = brd->channels[port]; 515 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 515 + if (!ch) 516 516 return; 517 517 518 518 linestatus = readb(&ch->ch_neo_uart->lsr); ··· 579 579 struct channel_t *ch; 580 580 struct un_t *un; 581 581 582 - if (!tty || tty->magic != TTY_MAGIC) 582 + if (!tty) 583 583 return; 584 584 585 585 un = (struct un_t *)tty->driver_data; 586 - if (!un || un->magic != DGNC_UNIT_MAGIC) 586 + if (!un) 587 587 return; 588 588 589 589 ch = un->un_ch; 590 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 590 + if (!ch) 591 591 return; 592 592 593 593 bd = ch->ch_bd; 594 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 594 + if (!bd) 595 595 return; 596 596 597 597 /* If baud rate is zero, flush queues, and set mval to drop DTR. */ ··· 822 822 int state = 0; 823 823 int ports = 0; 824 824 825 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 825 + if (!bd) 826 826 return; 827 827 828 828 spin_lock_irqsave(&bd->bd_lock, flags); ··· 839 839 if ((state == BOARD_READY) && (ports > 0)) { 840 840 for (i = 0; i < ports; i++) { 841 841 ch = bd->channels[i]; 842 - 843 - /* Just being careful... */ 844 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 842 + if (!ch) 845 843 continue; 846 844 847 845 /* ··· 886 888 unsigned long flags; 887 889 unsigned long flags2; 888 890 889 - if (!brd || brd->magic != DGNC_BOARD_MAGIC) 891 + if (!brd) 890 892 return IRQ_NONE; 891 893 892 894 /* Lock out the slow poller from running on this board. */ ··· 1021 1023 ushort tail; 1022 1024 unsigned long flags; 1023 1025 1024 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1026 + if (!ch) 1025 1027 return; 1026 1028 1027 1029 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1193 1195 struct un_t *un; 1194 1196 int rc = 0; 1195 1197 1196 - if (!tty || tty->magic != TTY_MAGIC) 1198 + if (!tty) 1197 1199 return -ENXIO; 1198 1200 1199 1201 un = (struct un_t *)tty->driver_data; 1200 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1202 + if (!un) 1201 1203 return -ENXIO; 1202 1204 1203 1205 ch = un->un_ch; 1204 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1206 + if (!ch) 1205 1207 return -ENXIO; 1206 1208 1207 1209 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1225 1227 unsigned char tmp = 0; 1226 1228 int i = 0; 1227 1229 1228 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1230 + if (!ch) 1229 1231 return; 1230 1232 1231 1233 writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT), ··· 1256 1258 unsigned char tmp = 0; 1257 1259 int i = 0; 1258 1260 1259 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1261 + if (!ch) 1260 1262 return; 1261 1263 1262 1264 writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR, ··· 1286 1288 uint len_written = 0; 1287 1289 unsigned long flags; 1288 1290 1289 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1291 + if (!ch) 1290 1292 return; 1291 1293 1292 1294 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1423 1425 { 1424 1426 unsigned char msignals = signals; 1425 1427 1426 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1428 + if (!ch) 1427 1429 return; 1428 1430 1429 1431 /* ··· 1480 1482 { 1481 1483 unsigned char out; 1482 1484 1483 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1485 + if (!ch) 1484 1486 return; 1485 1487 1486 1488 out = ch->ch_mostat; ··· 1497 1499 1498 1500 static void neo_send_start_character(struct channel_t *ch) 1499 1501 { 1500 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1502 + if (!ch) 1501 1503 return; 1502 1504 1503 1505 if (ch->ch_startc != _POSIX_VDISABLE) { ··· 1510 1512 1511 1513 static void neo_send_stop_character(struct channel_t *ch) 1512 1514 { 1513 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1515 + if (!ch) 1514 1516 return; 1515 1517 1516 1518 if (ch->ch_stopc != _POSIX_VDISABLE) { ··· 1617 1619 */ 1618 1620 static void neo_send_immediate_char(struct channel_t *ch, unsigned char c) 1619 1621 { 1620 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1622 + if (!ch) 1621 1623 return; 1622 1624 1623 1625 writeb(c, &ch->ch_neo_uart->txrx); ··· 1670 1672 unsigned int i = 0; 1671 1673 unsigned int a; 1672 1674 1673 - if (!brd || brd->magic != DGNC_BOARD_MAGIC) 1675 + if (!brd) 1674 1676 return; 1675 1677 1676 1678 if (!brd->re_map_membase)
+73 -77
drivers/staging/dgnc/dgnc_tty.c
··· 264 264 for (i = 0; i < brd->nasync; i++, ch = brd->channels[i]) { 265 265 spin_lock_init(&ch->ch_lock); 266 266 267 - /* Store all our magic numbers */ 268 - ch->magic = DGNC_CHANNEL_MAGIC; 269 - ch->ch_tun.magic = DGNC_UNIT_MAGIC; 270 267 ch->ch_tun.un_ch = ch; 271 268 ch->ch_tun.un_type = DGNC_SERIAL; 272 269 ch->ch_tun.un_dev = i; 273 270 274 - ch->ch_pun.magic = DGNC_UNIT_MAGIC; 275 271 ch->ch_pun.un_ch = ch; 276 272 ch->ch_pun.un_type = DGNC_PRINT; 277 273 ch->ch_pun.un_dev = i + 128; ··· 347 351 int remain; 348 352 uint head; 349 353 350 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 354 + if (!ch) 351 355 return; 352 356 353 357 head = ch->ch_w_head & WQUEUEMASK; ··· 397 401 int s = 0; 398 402 int i = 0; 399 403 400 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 404 + if (!ch) 401 405 return; 402 406 403 407 tp = ch->ch_tun.un_tty; 404 408 405 409 bd = ch->ch_bd; 406 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 410 + if (!bd) 407 411 return; 408 412 409 413 spin_lock_irqsave(&ch->ch_lock, flags); ··· 420 424 * If the device is not open, or CREAD is off, 421 425 * flush input data and return immediately. 422 426 */ 423 - if (!tp || (tp->magic != TTY_MAGIC) || 427 + if (!tp || 424 428 !(ch->ch_tun.un_flags & UN_ISOPEN) || 425 429 !C_CREAD(tp) || 426 430 (ch->ch_tun.un_flags & UN_CLOSING)) { ··· 543 547 int virt_carrier = 0; 544 548 int phys_carrier = 0; 545 549 546 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 550 + if (!ch) 547 551 return; 548 552 549 553 if (ch->ch_mistat & UART_MSR_DCD) ··· 767 771 int qlen = 0; 768 772 unsigned long flags; 769 773 770 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 774 + if (!ch) 771 775 return; 772 776 773 777 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1159 1163 /* Hangup the port. Like a close, but don't wait for output to drain. */ 1160 1164 static void dgnc_tty_hangup(struct tty_struct *tty) 1161 1165 { 1162 - if (!tty || tty->magic != TTY_MAGIC) 1166 + if (!tty) 1163 1167 return; 1164 1168 1165 1169 /* flush the transmit queues */ ··· 1173 1177 struct un_t *un; 1174 1178 unsigned long flags; 1175 1179 1176 - if (!tty || tty->magic != TTY_MAGIC) 1180 + if (!tty) 1177 1181 return; 1178 1182 1179 1183 un = tty->driver_data; 1180 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1184 + if (!un) 1181 1185 return; 1182 1186 1183 1187 ch = un->un_ch; 1184 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1188 + if (!ch) 1185 1189 return; 1186 1190 1187 1191 bd = ch->ch_bd; 1188 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 1192 + if (!bd) 1189 1193 return; 1190 1194 1191 1195 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1318 1322 return 0; 1319 1323 1320 1324 un = tty->driver_data; 1321 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1325 + if (!un) 1322 1326 return 0; 1323 1327 1324 1328 ch = un->un_ch; 1325 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1329 + if (!ch) 1326 1330 return 0; 1327 1331 1328 1332 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1394 1398 return 0; 1395 1399 1396 1400 un = tty->driver_data; 1397 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1401 + if (!un) 1398 1402 return 0; 1399 1403 1400 1404 ch = un->un_ch; 1401 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1405 + if (!ch) 1402 1406 return 0; 1403 1407 1404 1408 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1465 1469 return 0; 1466 1470 1467 1471 un = tty->driver_data; 1468 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1472 + if (!un) 1469 1473 return 0; 1470 1474 1471 1475 ch = un->un_ch; 1472 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1476 + if (!ch) 1473 1477 return 0; 1474 1478 1475 1479 if (!count) ··· 1580 1584 unsigned char mstat = 0; 1581 1585 unsigned long flags; 1582 1586 1583 - if (!tty || tty->magic != TTY_MAGIC) 1587 + if (!tty) 1584 1588 return -EIO; 1585 1589 1586 1590 un = tty->driver_data; 1587 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1591 + if (!un) 1588 1592 return -EIO; 1589 1593 1590 1594 ch = un->un_ch; 1591 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1595 + if (!ch) 1592 1596 return -EIO; 1593 1597 1594 1598 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1624 1628 struct un_t *un; 1625 1629 unsigned long flags; 1626 1630 1627 - if (!tty || tty->magic != TTY_MAGIC) 1631 + if (!tty) 1628 1632 return -EIO; 1629 1633 1630 1634 un = tty->driver_data; 1631 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1635 + if (!un) 1632 1636 return -EIO; 1633 1637 1634 1638 ch = un->un_ch; 1635 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1639 + if (!ch) 1636 1640 return -EIO; 1637 1641 1638 1642 bd = ch->ch_bd; 1639 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 1643 + if (!bd) 1640 1644 return -EIO; 1641 1645 1642 1646 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1668 1672 struct un_t *un; 1669 1673 unsigned long flags; 1670 1674 1671 - if (!tty || tty->magic != TTY_MAGIC) 1675 + if (!tty) 1672 1676 return -EIO; 1673 1677 1674 1678 un = tty->driver_data; 1675 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1679 + if (!un) 1676 1680 return -EIO; 1677 1681 1678 1682 ch = un->un_ch; 1679 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1683 + if (!ch) 1680 1684 return -EIO; 1681 1685 1682 1686 bd = ch->ch_bd; 1683 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 1687 + if (!bd) 1684 1688 return -EIO; 1685 1689 1686 1690 if (msec < 0) ··· 1702 1706 struct channel_t *ch; 1703 1707 struct un_t *un; 1704 1708 1705 - if (!tty || tty->magic != TTY_MAGIC) 1709 + if (!tty) 1706 1710 return; 1707 1711 1708 1712 un = tty->driver_data; 1709 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1713 + if (!un) 1710 1714 return; 1711 1715 1712 1716 ch = un->un_ch; 1713 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1717 + if (!ch) 1714 1718 return; 1715 1719 1716 1720 bd = ch->ch_bd; 1717 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 1721 + if (!bd) 1718 1722 return; 1719 1723 1720 1724 bd->bd_ops->drain(tty, 0); ··· 1728 1732 struct un_t *un; 1729 1733 unsigned long flags; 1730 1734 1731 - if (!tty || tty->magic != TTY_MAGIC) 1735 + if (!tty) 1732 1736 return; 1733 1737 1734 1738 un = tty->driver_data; 1735 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1739 + if (!un) 1736 1740 return; 1737 1741 1738 1742 ch = un->un_ch; 1739 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1743 + if (!ch) 1740 1744 return; 1741 1745 1742 1746 bd = ch->ch_bd; 1743 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 1747 + if (!bd) 1744 1748 return; 1745 1749 1746 1750 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1755 1759 unsigned long flags; 1756 1760 int rc; 1757 1761 1758 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1762 + if (!ch) 1759 1763 return -ENXIO; 1760 1764 1761 1765 spin_lock_irqsave(&ch->ch_lock, flags); ··· 1860 1864 if (!retinfo) 1861 1865 return -EFAULT; 1862 1866 1863 - if (!tty || tty->magic != TTY_MAGIC) 1867 + if (!tty) 1864 1868 return -EFAULT; 1865 1869 1866 1870 un = tty->driver_data; 1867 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1871 + if (!un) 1868 1872 return -EFAULT; 1869 1873 1870 1874 ch = un->un_ch; 1871 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1875 + if (!ch) 1872 1876 return -EFAULT; 1873 1877 1874 1878 memset(&tmp, 0, sizeof(tmp)); ··· 1893 1897 struct digi_t new_digi; 1894 1898 unsigned long flags; 1895 1899 1896 - if (!tty || tty->magic != TTY_MAGIC) 1900 + if (!tty) 1897 1901 return -EFAULT; 1898 1902 1899 1903 un = tty->driver_data; 1900 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1904 + if (!un) 1901 1905 return -EFAULT; 1902 1906 1903 1907 ch = un->un_ch; 1904 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1908 + if (!ch) 1905 1909 return -EFAULT; 1906 1910 1907 1911 bd = ch->ch_bd; 1908 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 1912 + if (!bd) 1909 1913 return -EFAULT; 1910 1914 1911 1915 if (copy_from_user(&new_digi, new_info, sizeof(new_digi))) ··· 1969 1973 struct un_t *un; 1970 1974 unsigned long flags; 1971 1975 1972 - if (!tty || tty->magic != TTY_MAGIC) 1976 + if (!tty) 1973 1977 return; 1974 1978 1975 1979 un = tty->driver_data; 1976 - if (!un || un->magic != DGNC_UNIT_MAGIC) 1980 + if (!un) 1977 1981 return; 1978 1982 1979 1983 ch = un->un_ch; 1980 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 1984 + if (!ch) 1981 1985 return; 1982 1986 1983 1987 bd = ch->ch_bd; 1984 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 1988 + if (!bd) 1985 1989 return; 1986 1990 1987 1991 spin_lock_irqsave(&ch->ch_lock, flags); ··· 2005 2009 struct un_t *un; 2006 2010 unsigned long flags; 2007 2011 2008 - if (!tty || tty->magic != TTY_MAGIC) 2012 + if (!tty) 2009 2013 return; 2010 2014 2011 2015 un = tty->driver_data; 2012 - if (!un || un->magic != DGNC_UNIT_MAGIC) 2016 + if (!un) 2013 2017 return; 2014 2018 2015 2019 ch = un->un_ch; 2016 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 2020 + if (!ch) 2017 2021 return; 2018 2022 2019 2023 spin_lock_irqsave(&ch->ch_lock, flags); ··· 2029 2033 struct un_t *un; 2030 2034 unsigned long flags; 2031 2035 2032 - if (!tty || tty->magic != TTY_MAGIC) 2036 + if (!tty) 2033 2037 return; 2034 2038 2035 2039 un = tty->driver_data; 2036 - if (!un || un->magic != DGNC_UNIT_MAGIC) 2040 + if (!un) 2037 2041 return; 2038 2042 2039 2043 ch = un->un_ch; 2040 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 2044 + if (!ch) 2041 2045 return; 2042 2046 2043 2047 spin_lock_irqsave(&ch->ch_lock, flags); ··· 2054 2058 struct un_t *un; 2055 2059 unsigned long flags; 2056 2060 2057 - if (!tty || tty->magic != TTY_MAGIC) 2061 + if (!tty) 2058 2062 return; 2059 2063 2060 2064 un = tty->driver_data; 2061 - if (!un || un->magic != DGNC_UNIT_MAGIC) 2065 + if (!un) 2062 2066 return; 2063 2067 2064 2068 ch = un->un_ch; 2065 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 2069 + if (!ch) 2066 2070 return; 2067 2071 2068 2072 bd = ch->ch_bd; 2069 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 2073 + if (!bd) 2070 2074 return; 2071 2075 2072 2076 spin_lock_irqsave(&ch->ch_lock, flags); ··· 2083 2087 struct un_t *un; 2084 2088 unsigned long flags; 2085 2089 2086 - if (!tty || tty->magic != TTY_MAGIC) 2090 + if (!tty) 2087 2091 return; 2088 2092 2089 2093 un = tty->driver_data; 2090 - if (!un || un->magic != DGNC_UNIT_MAGIC) 2094 + if (!un) 2091 2095 return; 2092 2096 2093 2097 ch = un->un_ch; 2094 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 2098 + if (!ch) 2095 2099 return; 2096 2100 2097 2101 bd = ch->ch_bd; 2098 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 2102 + if (!bd) 2099 2103 return; 2100 2104 2101 2105 spin_lock_irqsave(&ch->ch_lock, flags); ··· 2123 2127 struct un_t *un; 2124 2128 unsigned long flags; 2125 2129 2126 - if (!tty || tty->magic != TTY_MAGIC) 2130 + if (!tty) 2127 2131 return; 2128 2132 2129 2133 un = tty->driver_data; 2130 - if (!un || un->magic != DGNC_UNIT_MAGIC) 2134 + if (!un) 2131 2135 return; 2132 2136 2133 2137 ch = un->un_ch; 2134 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 2138 + if (!ch) 2135 2139 return; 2136 2140 2137 2141 bd = ch->ch_bd; 2138 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 2142 + if (!bd) 2139 2143 return; 2140 2144 2141 2145 spin_lock_irqsave(&ch->ch_lock, flags); ··· 2152 2156 struct un_t *un; 2153 2157 unsigned long flags; 2154 2158 2155 - if (!tty || tty->magic != TTY_MAGIC) 2159 + if (!tty) 2156 2160 return; 2157 2161 2158 2162 un = tty->driver_data; 2159 - if (!un || un->magic != DGNC_UNIT_MAGIC) 2163 + if (!un) 2160 2164 return; 2161 2165 2162 2166 ch = un->un_ch; 2163 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 2167 + if (!ch) 2164 2168 return; 2165 2169 2166 2170 spin_lock_irqsave(&ch->ch_lock, flags); ··· 2206 2210 unsigned long flags; 2207 2211 void __user *uarg = (void __user *)arg; 2208 2212 2209 - if (!tty || tty->magic != TTY_MAGIC) 2213 + if (!tty) 2210 2214 return -ENODEV; 2211 2215 2212 2216 un = tty->driver_data; 2213 - if (!un || un->magic != DGNC_UNIT_MAGIC) 2217 + if (!un) 2214 2218 return -ENODEV; 2215 2219 2216 2220 ch = un->un_ch; 2217 - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) 2221 + if (!ch) 2218 2222 return -ENODEV; 2219 2223 2220 2224 bd = ch->ch_bd; 2221 - if (!bd || bd->magic != DGNC_BOARD_MAGIC) 2225 + if (!bd) 2222 2226 return -ENODEV; 2223 2227 2224 2228 ch_bd_ops = bd->bd_ops;