Commit 65f76a82ec7a0374fad85211535330e203740475
Committed by
Linus Torvalds
1 parent
1c0a387c1f
Exists in
master
and in
4 other branches
Char: cyclades, fix some -W warnings
Most of them are signedness, the rest unused function parameters. 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>
Showing 2 changed files with 45 additions and 55 deletions Side-by-side Diff
drivers/char/cyclades.c
... | ... | @@ -662,7 +662,7 @@ |
662 | 662 | static void cy_throttle(struct tty_struct *tty); |
663 | 663 | static void cy_send_xchar(struct tty_struct *tty, char ch); |
664 | 664 | |
665 | -#define IS_CYC_Z(card) ((card).num_chips == -1) | |
665 | +#define IS_CYC_Z(card) ((card).num_chips == (unsigned int)-1) | |
666 | 666 | |
667 | 667 | #define Z_FPGA_CHECK(card) \ |
668 | 668 | ((readl(&((struct RUNTIME_9060 __iomem *) \ |
669 | 669 | |
670 | 670 | |
... | ... | @@ -985,25 +985,23 @@ |
985 | 985 | { |
986 | 986 | struct cyclades_port *info; |
987 | 987 | struct tty_struct *tty; |
988 | - int char_count; | |
989 | - int j, len, index = cinfo->bus_index; | |
990 | - int save_xir, channel, save_car; | |
991 | - char data; | |
988 | + int len, index = cinfo->bus_index; | |
989 | + u8 save_xir, channel, save_car, data, char_count; | |
992 | 990 | |
993 | 991 | #ifdef CY_DEBUG_INTERRUPTS |
994 | 992 | printk(KERN_DEBUG "cyy_interrupt: rcvd intr, chip %d\n", chip); |
995 | 993 | #endif |
996 | 994 | /* determine the channel & change to that context */ |
997 | - save_xir = (u_char) readb(base_addr + (CyRIR << index)); | |
998 | - channel = (u_short) (save_xir & CyIRChannel); | |
995 | + save_xir = readb(base_addr + (CyRIR << index)); | |
996 | + channel = save_xir & CyIRChannel; | |
999 | 997 | info = &cinfo->ports[channel + chip * 4]; |
1000 | 998 | save_car = readb(base_addr + (CyCAR << index)); |
1001 | 999 | cy_writeb(base_addr + (CyCAR << index), save_xir); |
1002 | 1000 | |
1003 | 1001 | /* if there is nowhere to put the data, discard it */ |
1004 | 1002 | if (info->tty == NULL) { |
1005 | - j = (readb(base_addr + (CyRIVR << index)) & CyIVRMask); | |
1006 | - if (j == CyIVRRxEx) { /* exception */ | |
1003 | + if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) == | |
1004 | + CyIVRRxEx) { /* exception */ | |
1007 | 1005 | data = readb(base_addr + (CyRDSR << index)); |
1008 | 1006 | } else { /* normal character reception */ |
1009 | 1007 | char_count = readb(base_addr + (CyRDCR << index)); |
... | ... | @@ -1014,8 +1012,8 @@ |
1014 | 1012 | } |
1015 | 1013 | /* there is an open port for this data */ |
1016 | 1014 | tty = info->tty; |
1017 | - j = readb(base_addr + (CyRIVR << index)) & CyIVRMask; | |
1018 | - if (j == CyIVRRxEx) { /* exception */ | |
1015 | + if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) == | |
1016 | + CyIVRRxEx) { /* exception */ | |
1019 | 1017 | data = readb(base_addr + (CyRDSR << index)); |
1020 | 1018 | |
1021 | 1019 | /* For statistics only */ |
1022 | 1020 | |
... | ... | @@ -1116,13 +1114,12 @@ |
1116 | 1114 | cy_writeb(base_addr + (CyCAR << index), save_car); |
1117 | 1115 | } |
1118 | 1116 | |
1119 | -static void cyy_chip_tx(struct cyclades_card *cinfo, int chip, | |
1117 | +static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip, | |
1120 | 1118 | void __iomem *base_addr) |
1121 | 1119 | { |
1122 | 1120 | struct cyclades_port *info; |
1123 | - int char_count; | |
1124 | - int outch; | |
1125 | - int save_xir, channel, save_car, index = cinfo->bus_index; | |
1121 | + int char_count, index = cinfo->bus_index; | |
1122 | + u8 save_xir, channel, save_car, outch; | |
1126 | 1123 | |
1127 | 1124 | /* Since we only get here when the transmit buffer |
1128 | 1125 | is empty, we know we can always stuff a dozen |
... | ... | @@ -1132,8 +1129,8 @@ |
1132 | 1129 | #endif |
1133 | 1130 | |
1134 | 1131 | /* determine the channel & change to that context */ |
1135 | - save_xir = (u_char) readb(base_addr + (CyTIR << index)); | |
1136 | - channel = (u_short) (save_xir & CyIRChannel); | |
1132 | + save_xir = readb(base_addr + (CyTIR << index)); | |
1133 | + channel = save_xir & CyIRChannel; | |
1137 | 1134 | save_car = readb(base_addr + (CyCAR << index)); |
1138 | 1135 | cy_writeb(base_addr + (CyCAR << index), save_xir); |
1139 | 1136 | |
1140 | 1137 | |
... | ... | @@ -1242,12 +1239,12 @@ |
1242 | 1239 | void __iomem *base_addr) |
1243 | 1240 | { |
1244 | 1241 | struct cyclades_port *info; |
1245 | - int mdm_change, mdm_status; | |
1246 | - int save_xir, channel, save_car, index = cinfo->bus_index; | |
1242 | + int index = cinfo->bus_index; | |
1243 | + u8 save_xir, channel, save_car, mdm_change, mdm_status; | |
1247 | 1244 | |
1248 | 1245 | /* determine the channel & change to that context */ |
1249 | - save_xir = (u_char) readb(base_addr + (CyMIR << index)); | |
1250 | - channel = (u_short) (save_xir & CyIRChannel); | |
1246 | + save_xir = readb(base_addr + (CyMIR << index)); | |
1247 | + channel = save_xir & CyIRChannel; | |
1251 | 1248 | info = &cinfo->ports[channel + chip * 4]; |
1252 | 1249 | save_car = readb(base_addr + (CyCAR << index)); |
1253 | 1250 | cy_writeb(base_addr + (CyCAR << index), save_xir); |
1254 | 1251 | |
... | ... | @@ -1320,10 +1317,8 @@ |
1320 | 1317 | int status; |
1321 | 1318 | struct cyclades_card *cinfo = dev_id; |
1322 | 1319 | void __iomem *base_addr, *card_base_addr; |
1323 | - int chip; | |
1320 | + unsigned int chip, too_many, had_work; | |
1324 | 1321 | int index; |
1325 | - int too_many; | |
1326 | - int had_work; | |
1327 | 1322 | |
1328 | 1323 | if (unlikely(cinfo == NULL)) { |
1329 | 1324 | #ifdef CY_DEBUG_INTERRUPTS |
... | ... | @@ -1422,7 +1417,7 @@ |
1422 | 1417 | struct ZFW_CTRL __iomem *zfw_ctrl; |
1423 | 1418 | struct BOARD_CTRL __iomem *board_ctrl; |
1424 | 1419 | __u32 __iomem *pci_doorbell; |
1425 | - int index; | |
1420 | + unsigned int index; | |
1426 | 1421 | |
1427 | 1422 | firm_id = cinfo->base_addr + ID_ADDRESS; |
1428 | 1423 | if (!ISZLOADED(*cinfo)) { |
1429 | 1424 | |
... | ... | @@ -1447,13 +1442,12 @@ |
1447 | 1442 | return 0; |
1448 | 1443 | } /* cyz_issue_cmd */ |
1449 | 1444 | |
1450 | -static void | |
1451 | -cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, | |
1445 | +static void cyz_handle_rx(struct cyclades_port *info, | |
1452 | 1446 | struct BUF_CTRL __iomem *buf_ctrl) |
1453 | 1447 | { |
1454 | 1448 | struct cyclades_card *cinfo = info->card; |
1455 | 1449 | struct tty_struct *tty = info->tty; |
1456 | - int char_count; | |
1450 | + unsigned int char_count; | |
1457 | 1451 | int len; |
1458 | 1452 | #ifdef BLOCKMOVE |
1459 | 1453 | unsigned char *buf; |
... | ... | @@ -1526,7 +1520,7 @@ |
1526 | 1520 | char_count = rx_put - rx_get; |
1527 | 1521 | else |
1528 | 1522 | char_count = rx_put - rx_get + rx_bufsize; |
1529 | - if (char_count >= (int)readl(&buf_ctrl->rx_threshold) && | |
1523 | + if (char_count >= readl(&buf_ctrl->rx_threshold) && | |
1530 | 1524 | !timer_pending(&cyz_rx_full_timer[ |
1531 | 1525 | info->line])) |
1532 | 1526 | mod_timer(&cyz_rx_full_timer[info->line], |
1533 | 1527 | |
... | ... | @@ -1540,14 +1534,13 @@ |
1540 | 1534 | } |
1541 | 1535 | } |
1542 | 1536 | |
1543 | -static void | |
1544 | -cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl, | |
1537 | +static void cyz_handle_tx(struct cyclades_port *info, | |
1545 | 1538 | struct BUF_CTRL __iomem *buf_ctrl) |
1546 | 1539 | { |
1547 | 1540 | struct cyclades_card *cinfo = info->card; |
1548 | 1541 | struct tty_struct *tty = info->tty; |
1549 | - char data; | |
1550 | - int char_count; | |
1542 | + u8 data; | |
1543 | + unsigned int char_count; | |
1551 | 1544 | #ifdef BLOCKMOVE |
1552 | 1545 | int small_count; |
1553 | 1546 | #endif |
... | ... | @@ -1708,7 +1701,7 @@ |
1708 | 1701 | printk(KERN_DEBUG "cyz_interrupt: rcvd intr, card %d, " |
1709 | 1702 | "port %ld\n", info->card, channel); |
1710 | 1703 | #endif |
1711 | - cyz_handle_rx(info, ch_ctrl, buf_ctrl); | |
1704 | + cyz_handle_rx(info, buf_ctrl); | |
1712 | 1705 | break; |
1713 | 1706 | case C_CM_TXBEMPTY: |
1714 | 1707 | case C_CM_TXLOWWM: |
... | ... | @@ -1718,7 +1711,7 @@ |
1718 | 1711 | printk(KERN_DEBUG "cyz_interrupt: xmit intr, card %d, " |
1719 | 1712 | "port %ld\n", info->card, channel); |
1720 | 1713 | #endif |
1721 | - cyz_handle_tx(info, ch_ctrl, buf_ctrl); | |
1714 | + cyz_handle_tx(info, buf_ctrl); | |
1722 | 1715 | break; |
1723 | 1716 | #endif /* CONFIG_CYZ_INTR */ |
1724 | 1717 | case C_CM_FATAL: |
1725 | 1718 | |
... | ... | @@ -1787,10 +1780,9 @@ |
1787 | 1780 | struct FIRM_ID __iomem *firm_id; |
1788 | 1781 | struct ZFW_CTRL __iomem *zfw_ctrl; |
1789 | 1782 | struct BOARD_CTRL __iomem *board_ctrl; |
1790 | - struct CH_CTRL __iomem *ch_ctrl; | |
1791 | 1783 | struct BUF_CTRL __iomem *buf_ctrl; |
1792 | 1784 | unsigned long expires = jiffies + HZ; |
1793 | - int card, port; | |
1785 | + unsigned int port, card; | |
1794 | 1786 | |
1795 | 1787 | for (card = 0; card < NR_CARDS; card++) { |
1796 | 1788 | cinfo = &cy_card[card]; |
1797 | 1789 | |
... | ... | @@ -1817,12 +1809,11 @@ |
1817 | 1809 | for (port = 0; port < cinfo->nports; port++) { |
1818 | 1810 | info = &cinfo->ports[port]; |
1819 | 1811 | tty = info->tty; |
1820 | - ch_ctrl = &(zfw_ctrl->ch_ctrl[port]); | |
1821 | 1812 | buf_ctrl = &(zfw_ctrl->buf_ctrl[port]); |
1822 | 1813 | |
1823 | 1814 | if (!info->throttle) |
1824 | - cyz_handle_rx(info, ch_ctrl, buf_ctrl); | |
1825 | - cyz_handle_tx(info, ch_ctrl, buf_ctrl); | |
1815 | + cyz_handle_rx(info, buf_ctrl); | |
1816 | + cyz_handle_tx(info, buf_ctrl); | |
1826 | 1817 | } |
1827 | 1818 | /* poll every 'cyz_polling_cycle' period */ |
1828 | 1819 | expires = jiffies + cyz_polling_cycle; |
1829 | 1820 | |
... | ... | @@ -2385,11 +2376,11 @@ |
2385 | 2376 | static int cy_open(struct tty_struct *tty, struct file *filp) |
2386 | 2377 | { |
2387 | 2378 | struct cyclades_port *info; |
2388 | - unsigned int i; | |
2389 | - int retval, line; | |
2379 | + unsigned int i, line; | |
2380 | + int retval; | |
2390 | 2381 | |
2391 | 2382 | line = tty->index; |
2392 | - if ((line < 0) || (NR_PORTS <= line)) { | |
2383 | + if ((tty->index < 0) || (NR_PORTS <= line)) { | |
2393 | 2384 | return -ENODEV; |
2394 | 2385 | } |
2395 | 2386 | for (i = 0; i < NR_CARDS; i++) |
2396 | 2387 | |
... | ... | @@ -4359,9 +4350,9 @@ |
4359 | 4350 | { |
4360 | 4351 | struct cyclades_port *info; |
4361 | 4352 | u32 uninitialized_var(mailbox); |
4362 | - unsigned int nports; | |
4353 | + unsigned int nports, port; | |
4363 | 4354 | unsigned short chip_number; |
4364 | - int uninitialized_var(index), port; | |
4355 | + int uninitialized_var(index); | |
4365 | 4356 | |
4366 | 4357 | spin_lock_init(&cinfo->card_lock); |
4367 | 4358 | |
... | ... | @@ -5127,7 +5118,7 @@ |
5127 | 5118 | } |
5128 | 5119 | } |
5129 | 5120 | #endif /* CONFIG_CYZ_INTR */ |
5130 | - cy_card[card_no].num_chips = -1; | |
5121 | + cy_card[card_no].num_chips = (unsigned int)-1; | |
5131 | 5122 | } |
5132 | 5123 | |
5133 | 5124 | /* set cy_card */ |
... | ... | @@ -5387,7 +5378,7 @@ |
5387 | 5378 | static void __exit cy_cleanup_module(void) |
5388 | 5379 | { |
5389 | 5380 | struct cyclades_card *card; |
5390 | - int i, e1; | |
5381 | + unsigned int i, e1; | |
5391 | 5382 | |
5392 | 5383 | #ifndef CONFIG_CYZ_INTR |
5393 | 5384 | del_timer_sync(&cyz_timerlist); |
... | ... | @@ -5415,8 +5406,7 @@ |
5415 | 5406 | #endif /* CONFIG_CYZ_INTR */ |
5416 | 5407 | ) |
5417 | 5408 | free_irq(card->irq, card); |
5418 | - for (e1 = card->first_line; | |
5419 | - e1 < card->first_line + | |
5409 | + for (e1 = card->first_line; e1 < card->first_line + | |
5420 | 5410 | card->nports; e1++) |
5421 | 5411 | tty_unregister_device(cy_serial_driver, e1); |
5422 | 5412 | kfree(card->ports); |
include/linux/cyclades.h
... | ... | @@ -512,11 +512,11 @@ |
512 | 512 | void __iomem *base_addr; |
513 | 513 | void __iomem *ctl_addr; |
514 | 514 | int irq; |
515 | - int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */ | |
516 | - int first_line; /* minor number of first channel on card */ | |
517 | - int nports; /* Number of ports in the card */ | |
518 | - int bus_index; /* address shift - 0 for ISA, 1 for PCI */ | |
519 | - int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */ | |
515 | + unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */ | |
516 | + unsigned int first_line; /* minor number of first channel on card */ | |
517 | + unsigned int nports; /* Number of ports in the card */ | |
518 | + int bus_index; /* address shift - 0 for ISA, 1 for PCI */ | |
519 | + int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */ | |
520 | 520 | spinlock_t card_lock; |
521 | 521 | struct cyclades_port *ports; |
522 | 522 | }; |
... | ... | @@ -566,7 +566,7 @@ |
566 | 566 | int rtsdtr_inv; |
567 | 567 | int chip_rev; |
568 | 568 | int custom_divisor; |
569 | - int x_char; /* to be pushed out ASAP */ | |
569 | + u8 x_char; /* to be pushed out ASAP */ | |
570 | 570 | int close_delay; |
571 | 571 | unsigned short closing_wait; |
572 | 572 | int count; /* # of fd on device */ |