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

tty: icount changeover for other main devices

Again basically cut and paste

Convert the main driver set to use the hooks for GICOUNT

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


authored by

Alan Cox and committed by
Greg Kroah-Hartman
0587102c 0bca1b91

+296 -294
+1 -11
arch/ia64/hp/sim/simserial.c
··· 395 395 { 396 396 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && 397 397 (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) && 398 - (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { 398 + (cmd != TIOCMIWAIT)) { 399 399 if (tty->flags & (1 << TTY_IO_ERROR)) 400 400 return -EIO; 401 401 } ··· 433 433 case TIOCMIWAIT: 434 434 printk(KERN_INFO "rs_ioctl: TIOCMIWAIT: called\n"); 435 435 return 0; 436 - /* 437 - * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 438 - * Return: write counters to the user passed counter struct 439 - * NB: both 1->0 and 0->1 transitions are counted except for 440 - * RI where only 0->1 is counted. 441 - */ 442 - case TIOCGICOUNT: 443 - printk(KERN_INFO "rs_ioctl: TIOCGICOUNT called\n"); 444 - return 0; 445 - 446 436 case TIOCSERGWILD: 447 437 case TIOCSERSWILD: 448 438 /* "setserial -W" is called in Debian boot */
+31 -25
drivers/char/amiserial.c
··· 1263 1263 return 0; 1264 1264 } 1265 1265 1266 + /* 1267 + * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1268 + * Return: write counters to the user passed counter struct 1269 + * NB: both 1->0 and 0->1 transitions are counted except for 1270 + * RI where only 0->1 is counted. 1271 + */ 1272 + static int rs_get_icount(struct tty_struct *tty, 1273 + struct serial_icounter_struct *icount) 1274 + { 1275 + struct async_struct *info = tty->driver_data; 1276 + struct async_icount cnow; 1277 + unsigned long flags; 1278 + 1279 + local_irq_save(flags); 1280 + cnow = info->state->icount; 1281 + local_irq_restore(flags); 1282 + icount->cts = cnow.cts; 1283 + icount->dsr = cnow.dsr; 1284 + icount->rng = cnow.rng; 1285 + icount->dcd = cnow.dcd; 1286 + icount->rx = cnow.rx; 1287 + icount->tx = cnow.tx; 1288 + icount->frame = cnow.frame; 1289 + icount->overrun = cnow.overrun; 1290 + icount->parity = cnow.parity; 1291 + icount->brk = cnow.brk; 1292 + icount->buf_overrun = cnow.buf_overrun; 1293 + 1294 + return 0; 1295 + } 1266 1296 1267 1297 static int rs_ioctl(struct tty_struct *tty, struct file * file, 1268 1298 unsigned int cmd, unsigned long arg) ··· 1362 1332 } 1363 1333 /* NOTREACHED */ 1364 1334 1365 - /* 1366 - * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1367 - * Return: write counters to the user passed counter struct 1368 - * NB: both 1->0 and 0->1 transitions are counted except for 1369 - * RI where only 0->1 is counted. 1370 - */ 1371 - case TIOCGICOUNT: 1372 - local_irq_save(flags); 1373 - cnow = info->state->icount; 1374 - local_irq_restore(flags); 1375 - icount.cts = cnow.cts; 1376 - icount.dsr = cnow.dsr; 1377 - icount.rng = cnow.rng; 1378 - icount.dcd = cnow.dcd; 1379 - icount.rx = cnow.rx; 1380 - icount.tx = cnow.tx; 1381 - icount.frame = cnow.frame; 1382 - icount.overrun = cnow.overrun; 1383 - icount.parity = cnow.parity; 1384 - icount.brk = cnow.brk; 1385 - icount.buf_overrun = cnow.buf_overrun; 1386 - 1387 - if (copy_to_user(argp, &icount, sizeof(icount))) 1388 - return -EFAULT; 1389 - return 0; 1390 1335 case TIOCSERGWILD: 1391 1336 case TIOCSERSWILD: 1392 1337 /* "setserial -W" is called in Debian boot */ ··· 1963 1958 .wait_until_sent = rs_wait_until_sent, 1964 1959 .tiocmget = rs_tiocmget, 1965 1960 .tiocmset = rs_tiocmset, 1961 + .get_icount = rs_get_icount, 1966 1962 .proc_fops = &rs_proc_fops, 1967 1963 }; 1968 1964
+26 -23
drivers/char/cyclades.c
··· 2790 2790 * NB: both 1->0 and 0->1 transitions are counted except for 2791 2791 * RI where only 0->1 is counted. 2792 2792 */ 2793 - case TIOCGICOUNT: { 2794 - struct serial_icounter_struct sic = { }; 2795 - 2796 - spin_lock_irqsave(&info->card->card_lock, flags); 2797 - cnow = info->icount; 2798 - spin_unlock_irqrestore(&info->card->card_lock, flags); 2799 - 2800 - sic.cts = cnow.cts; 2801 - sic.dsr = cnow.dsr; 2802 - sic.rng = cnow.rng; 2803 - sic.dcd = cnow.dcd; 2804 - sic.rx = cnow.rx; 2805 - sic.tx = cnow.tx; 2806 - sic.frame = cnow.frame; 2807 - sic.overrun = cnow.overrun; 2808 - sic.parity = cnow.parity; 2809 - sic.brk = cnow.brk; 2810 - sic.buf_overrun = cnow.buf_overrun; 2811 - 2812 - if (copy_to_user(argp, &sic, sizeof(sic))) 2813 - ret_val = -EFAULT; 2814 - break; 2815 - } 2816 2793 default: 2817 2794 ret_val = -ENOIOCTLCMD; 2818 2795 } ··· 2799 2822 #endif 2800 2823 return ret_val; 2801 2824 } /* cy_ioctl */ 2825 + 2826 + static int cy_get_icount(struct tty_struct *tty, 2827 + struct serial_icounter_struct *sic) 2828 + { 2829 + struct cyclades_port *info = tty->driver_data; 2830 + struct cyclades_icount cnow; /* Used to snapshot */ 2831 + unsigned long flags; 2832 + 2833 + spin_lock_irqsave(&info->card->card_lock, flags); 2834 + cnow = info->icount; 2835 + spin_unlock_irqrestore(&info->card->card_lock, flags); 2836 + 2837 + sic->cts = cnow.cts; 2838 + sic->dsr = cnow.dsr; 2839 + sic->rng = cnow.rng; 2840 + sic->dcd = cnow.dcd; 2841 + sic->rx = cnow.rx; 2842 + sic->tx = cnow.tx; 2843 + sic->frame = cnow.frame; 2844 + sic->overrun = cnow.overrun; 2845 + sic->parity = cnow.parity; 2846 + sic->brk = cnow.brk; 2847 + sic->buf_overrun = cnow.buf_overrun; 2848 + return 0; 2849 + } 2802 2850 2803 2851 /* 2804 2852 * This routine allows the tty driver to be notified when ··· 4086 4084 .wait_until_sent = cy_wait_until_sent, 4087 4085 .tiocmget = cy_tiocmget, 4088 4086 .tiocmset = cy_tiocmset, 4087 + .get_icount = cy_get_icount, 4089 4088 .proc_fops = &cyclades_proc_fops, 4090 4089 }; 4091 4090
+43 -29
drivers/char/ip2/ip2main.c
··· 183 183 static int ip2_tiocmget(struct tty_struct *tty, struct file *file); 184 184 static int ip2_tiocmset(struct tty_struct *tty, struct file *file, 185 185 unsigned int set, unsigned int clear); 186 + static int ip2_get_icount(struct tty_struct *tty, 187 + struct serial_icounter_struct *icount); 186 188 187 189 static void set_irq(int, int); 188 190 static void ip2_interrupt_bh(struct work_struct *work); ··· 456 454 .hangup = ip2_hangup, 457 455 .tiocmget = ip2_tiocmget, 458 456 .tiocmset = ip2_tiocmset, 457 + .get_icount = ip2_get_icount, 459 458 .proc_fops = &ip2_proc_fops, 460 459 }; 461 460 ··· 2131 2128 i2ChanStrPtr pCh = DevTable[tty->index]; 2132 2129 i2eBordStrPtr pB; 2133 2130 struct async_icount cprev, cnow; /* kernel counter temps */ 2134 - struct serial_icounter_struct __user *p_cuser; 2135 2131 int rc = 0; 2136 2132 unsigned long flags; 2137 2133 void __user *argp = (void __user *)arg; ··· 2299 2297 break; 2300 2298 2301 2299 /* 2302 - * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 2303 - * Return: write counters to the user passed counter struct 2304 - * NB: both 1->0 and 0->1 transitions are counted except for RI where 2305 - * only 0->1 is counted. The controller is quite capable of counting 2306 - * both, but this done to preserve compatibility with the standard 2307 - * serial driver. 2308 - */ 2309 - case TIOCGICOUNT: 2310 - ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc ); 2311 - 2312 - write_lock_irqsave(&pB->read_fifo_spinlock, flags); 2313 - cnow = pCh->icount; 2314 - write_unlock_irqrestore(&pB->read_fifo_spinlock, flags); 2315 - p_cuser = argp; 2316 - rc = put_user(cnow.cts, &p_cuser->cts); 2317 - rc = put_user(cnow.dsr, &p_cuser->dsr); 2318 - rc = put_user(cnow.rng, &p_cuser->rng); 2319 - rc = put_user(cnow.dcd, &p_cuser->dcd); 2320 - rc = put_user(cnow.rx, &p_cuser->rx); 2321 - rc = put_user(cnow.tx, &p_cuser->tx); 2322 - rc = put_user(cnow.frame, &p_cuser->frame); 2323 - rc = put_user(cnow.overrun, &p_cuser->overrun); 2324 - rc = put_user(cnow.parity, &p_cuser->parity); 2325 - rc = put_user(cnow.brk, &p_cuser->brk); 2326 - rc = put_user(cnow.buf_overrun, &p_cuser->buf_overrun); 2327 - break; 2328 - 2329 - /* 2330 2300 * The rest are not supported by this driver. By returning -ENOIOCTLCMD they 2331 2301 * will be passed to the line discipline for it to handle. 2332 2302 */ ··· 2320 2346 ip2trace (CHANN, ITRC_IOCTL, ITRC_RETURN, 0 ); 2321 2347 2322 2348 return rc; 2349 + } 2350 + 2351 + static int ip2_get_icount(struct tty_struct *tty, 2352 + struct serial_icounter_struct *icount) 2353 + { 2354 + i2ChanStrPtr pCh = DevTable[tty->index]; 2355 + i2eBordStrPtr pB; 2356 + struct async_icount cnow; /* kernel counter temp */ 2357 + unsigned long flags; 2358 + 2359 + if ( pCh == NULL ) 2360 + return -ENODEV; 2361 + 2362 + pB = pCh->pMyBord; 2363 + 2364 + /* 2365 + * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 2366 + * Return: write counters to the user passed counter struct 2367 + * NB: both 1->0 and 0->1 transitions are counted except for RI where 2368 + * only 0->1 is counted. The controller is quite capable of counting 2369 + * both, but this done to preserve compatibility with the standard 2370 + * serial driver. 2371 + */ 2372 + 2373 + write_lock_irqsave(&pB->read_fifo_spinlock, flags); 2374 + cnow = pCh->icount; 2375 + write_unlock_irqrestore(&pB->read_fifo_spinlock, flags); 2376 + 2377 + icount->cts = cnow.cts; 2378 + icount->dsr = cnow.dsr; 2379 + icount->rng = cnow.rng; 2380 + icount->dcd = cnow.dcd; 2381 + icount->rx = cnow.rx; 2382 + icount->tx = cnow.tx; 2383 + icount->frame = cnow.frame; 2384 + icount->overrun = cnow.overrun; 2385 + icount->parity = cnow.parity; 2386 + icount->brk = cnow.brk; 2387 + icount->buf_overrun = cnow.buf_overrun; 2388 + return 0; 2323 2389 } 2324 2390 2325 2391 /******************************************************************************/
+35 -27
drivers/char/mxser.c
··· 1700 1700 return 0; 1701 1701 } 1702 1702 1703 - if (cmd != TIOCGSERIAL && cmd != TIOCMIWAIT && cmd != TIOCGICOUNT && 1703 + if (cmd != TIOCGSERIAL && cmd != TIOCMIWAIT && 1704 1704 test_bit(TTY_IO_ERROR, &tty->flags)) 1705 1705 return -EIO; 1706 1706 ··· 1730 1730 1731 1731 return wait_event_interruptible(info->port.delta_msr_wait, 1732 1732 mxser_cflags_changed(info, arg, &cnow)); 1733 - /* 1734 - * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1735 - * Return: write counters to the user passed counter struct 1736 - * NB: both 1->0 and 0->1 transitions are counted except for 1737 - * RI where only 0->1 is counted. 1738 - */ 1739 - case TIOCGICOUNT: { 1740 - struct serial_icounter_struct icnt = { 0 }; 1741 - spin_lock_irqsave(&info->slock, flags); 1742 - cnow = info->icount; 1743 - spin_unlock_irqrestore(&info->slock, flags); 1744 - 1745 - icnt.frame = cnow.frame; 1746 - icnt.brk = cnow.brk; 1747 - icnt.overrun = cnow.overrun; 1748 - icnt.buf_overrun = cnow.buf_overrun; 1749 - icnt.parity = cnow.parity; 1750 - icnt.rx = cnow.rx; 1751 - icnt.tx = cnow.tx; 1752 - icnt.cts = cnow.cts; 1753 - icnt.dsr = cnow.dsr; 1754 - icnt.rng = cnow.rng; 1755 - icnt.dcd = cnow.dcd; 1756 - 1757 - return copy_to_user(argp, &icnt, sizeof(icnt)) ? -EFAULT : 0; 1758 - } 1759 1733 case MOXA_HighSpeedOn: 1760 1734 return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp); 1761 1735 case MOXA_SDS_RSTICOUNTER: ··· 1799 1825 default: 1800 1826 return -ENOIOCTLCMD; 1801 1827 } 1828 + return 0; 1829 + } 1830 + 1831 + /* 1832 + * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1833 + * Return: write counters to the user passed counter struct 1834 + * NB: both 1->0 and 0->1 transitions are counted except for 1835 + * RI where only 0->1 is counted. 1836 + */ 1837 + 1838 + static int mxser_get_icount(struct tty_struct *tty, 1839 + struct serial_icounter_struct *icount) 1840 + 1841 + { 1842 + struct mxser_port *info = tty->driver_data; 1843 + struct async_icount cnow; 1844 + unsigned long flags; 1845 + 1846 + spin_lock_irqsave(&info->slock, flags); 1847 + cnow = info->icount; 1848 + spin_unlock_irqrestore(&info->slock, flags); 1849 + 1850 + icount->frame = cnow.frame; 1851 + icount->brk = cnow.brk; 1852 + icount->overrun = cnow.overrun; 1853 + icount->buf_overrun = cnow.buf_overrun; 1854 + icount->parity = cnow.parity; 1855 + icount->rx = cnow.rx; 1856 + icount->tx = cnow.tx; 1857 + icount->cts = cnow.cts; 1858 + icount->dsr = cnow.dsr; 1859 + icount->rng = cnow.rng; 1860 + icount->dcd = cnow.dcd; 1802 1861 return 0; 1803 1862 } 1804 1863 ··· 2333 2326 .wait_until_sent = mxser_wait_until_sent, 2334 2327 .tiocmget = mxser_tiocmget, 2335 2328 .tiocmset = mxser_tiocmset, 2329 + .get_icount = mxser_get_icount, 2336 2330 }; 2337 2331 2338 2332 struct tty_port_operations mxser_port_ops = {
+17 -18
drivers/char/nozomi.c
··· 1804 1804 return ret; 1805 1805 } 1806 1806 1807 - static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp) 1807 + static int ntty_tiocgicount(struct tty_struct *tty, 1808 + struct serial_icounter_struct *icount) 1808 1809 { 1810 + struct port *port = tty->driver_data; 1809 1811 const struct async_icount cnow = port->tty_icount; 1810 - struct serial_icounter_struct icount; 1811 1812 1812 - icount.cts = cnow.cts; 1813 - icount.dsr = cnow.dsr; 1814 - icount.rng = cnow.rng; 1815 - icount.dcd = cnow.dcd; 1816 - icount.rx = cnow.rx; 1817 - icount.tx = cnow.tx; 1818 - icount.frame = cnow.frame; 1819 - icount.overrun = cnow.overrun; 1820 - icount.parity = cnow.parity; 1821 - icount.brk = cnow.brk; 1822 - icount.buf_overrun = cnow.buf_overrun; 1823 - 1824 - return copy_to_user(argp, &icount, sizeof(icount)) ? -EFAULT : 0; 1813 + icount->cts = cnow.cts; 1814 + icount->dsr = cnow.dsr; 1815 + icount->rng = cnow.rng; 1816 + icount->dcd = cnow.dcd; 1817 + icount->rx = cnow.rx; 1818 + icount->tx = cnow.tx; 1819 + icount->frame = cnow.frame; 1820 + icount->overrun = cnow.overrun; 1821 + icount->parity = cnow.parity; 1822 + icount->brk = cnow.brk; 1823 + icount->buf_overrun = cnow.buf_overrun; 1824 + return 0; 1825 1825 } 1826 1826 1827 1827 static int ntty_ioctl(struct tty_struct *tty, struct file *file, ··· 1840 1840 rval = wait_event_interruptible(port->tty_wait, 1841 1841 ntty_cflags_changed(port, arg, &cprev)); 1842 1842 break; 1843 - } case TIOCGICOUNT: 1844 - rval = ntty_ioctl_tiocgicount(port, argp); 1845 - break; 1843 + } 1846 1844 default: 1847 1845 DBG1("ERR: 0x%08X, %d", cmd, cmd); 1848 1846 break; ··· 1920 1922 .chars_in_buffer = ntty_chars_in_buffer, 1921 1923 .tiocmget = ntty_tiocmget, 1922 1924 .tiocmset = ntty_tiocmset, 1925 + .get_icount = ntty_tiocgicount, 1923 1926 .install = ntty_install, 1924 1927 .cleanup = ntty_cleanup, 1925 1928 };
+34 -39
drivers/char/synclink.c
··· 2925 2925 2926 2926 } /* end of mgsl_break() */ 2927 2927 2928 + /* 2929 + * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 2930 + * Return: write counters to the user passed counter struct 2931 + * NB: both 1->0 and 0->1 transitions are counted except for 2932 + * RI where only 0->1 is counted. 2933 + */ 2934 + static int msgl_get_icount(struct tty_struct *tty, 2935 + struct serial_icounter_struct *icount) 2936 + 2937 + { 2938 + struct mgsl_struct * info = tty->driver_data; 2939 + struct mgsl_icount cnow; /* kernel counter temps */ 2940 + unsigned long flags; 2941 + 2942 + spin_lock_irqsave(&info->irq_spinlock,flags); 2943 + cnow = info->icount; 2944 + spin_unlock_irqrestore(&info->irq_spinlock,flags); 2945 + 2946 + icount->cts = cnow.cts; 2947 + icount->dsr = cnow.dsr; 2948 + icount->rng = cnow.rng; 2949 + icount->dcd = cnow.dcd; 2950 + icount->rx = cnow.rx; 2951 + icount->tx = cnow.tx; 2952 + icount->frame = cnow.frame; 2953 + icount->overrun = cnow.overrun; 2954 + icount->parity = cnow.parity; 2955 + icount->brk = cnow.brk; 2956 + icount->buf_overrun = cnow.buf_overrun; 2957 + return 0; 2958 + } 2959 + 2928 2960 /* mgsl_ioctl() Service an IOCTL request 2929 2961 * 2930 2962 * Arguments: ··· 2981 2949 return -ENODEV; 2982 2950 2983 2951 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && 2984 - (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { 2952 + (cmd != TIOCMIWAIT)) { 2985 2953 if (tty->flags & (1 << TTY_IO_ERROR)) 2986 2954 return -EIO; 2987 2955 } ··· 2991 2959 2992 2960 static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg) 2993 2961 { 2994 - int error; 2995 - struct mgsl_icount cnow; /* kernel counter temps */ 2996 2962 void __user *argp = (void __user *)arg; 2997 - struct serial_icounter_struct __user *p_cuser; /* user space */ 2998 - unsigned long flags; 2999 2963 3000 2964 switch (cmd) { 3001 2965 case MGSL_IOCGPARAMS: ··· 3020 2992 case TIOCMIWAIT: 3021 2993 return modem_input_wait(info,(int)arg); 3022 2994 3023 - /* 3024 - * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 3025 - * Return: write counters to the user passed counter struct 3026 - * NB: both 1->0 and 0->1 transitions are counted except for 3027 - * RI where only 0->1 is counted. 3028 - */ 3029 - case TIOCGICOUNT: 3030 - spin_lock_irqsave(&info->irq_spinlock,flags); 3031 - cnow = info->icount; 3032 - spin_unlock_irqrestore(&info->irq_spinlock,flags); 3033 - p_cuser = argp; 3034 - PUT_USER(error,cnow.cts, &p_cuser->cts); 3035 - if (error) return error; 3036 - PUT_USER(error,cnow.dsr, &p_cuser->dsr); 3037 - if (error) return error; 3038 - PUT_USER(error,cnow.rng, &p_cuser->rng); 3039 - if (error) return error; 3040 - PUT_USER(error,cnow.dcd, &p_cuser->dcd); 3041 - if (error) return error; 3042 - PUT_USER(error,cnow.rx, &p_cuser->rx); 3043 - if (error) return error; 3044 - PUT_USER(error,cnow.tx, &p_cuser->tx); 3045 - if (error) return error; 3046 - PUT_USER(error,cnow.frame, &p_cuser->frame); 3047 - if (error) return error; 3048 - PUT_USER(error,cnow.overrun, &p_cuser->overrun); 3049 - if (error) return error; 3050 - PUT_USER(error,cnow.parity, &p_cuser->parity); 3051 - if (error) return error; 3052 - PUT_USER(error,cnow.brk, &p_cuser->brk); 3053 - if (error) return error; 3054 - PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun); 3055 - if (error) return error; 3056 - return 0; 3057 2995 default: 3058 2996 return -ENOIOCTLCMD; 3059 2997 } ··· 4322 4328 .hangup = mgsl_hangup, 4323 4329 .tiocmget = tiocmget, 4324 4330 .tiocmset = tiocmset, 4331 + .get_icount = msgl_get_icount, 4325 4332 .proc_fops = &mgsl_proc_fops, 4326 4333 }; 4327 4334
+28 -33
drivers/char/synclinkmp.c
··· 1258 1258 unsigned int cmd, unsigned long arg) 1259 1259 { 1260 1260 SLMP_INFO *info = tty->driver_data; 1261 - int error; 1262 - struct mgsl_icount cnow; /* kernel counter temps */ 1263 - struct serial_icounter_struct __user *p_cuser; /* user space */ 1264 - unsigned long flags; 1265 1261 void __user *argp = (void __user *)arg; 1266 1262 1267 1263 if (debug_level >= DEBUG_LEVEL_INFO) ··· 1268 1272 return -ENODEV; 1269 1273 1270 1274 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && 1271 - (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { 1275 + (cmd != TIOCMIWAIT)) { 1272 1276 if (tty->flags & (1 << TTY_IO_ERROR)) 1273 1277 return -EIO; 1274 1278 } ··· 1306 1310 * NB: both 1->0 and 0->1 transitions are counted except for 1307 1311 * RI where only 0->1 is counted. 1308 1312 */ 1309 - case TIOCGICOUNT: 1310 - spin_lock_irqsave(&info->lock,flags); 1311 - cnow = info->icount; 1312 - spin_unlock_irqrestore(&info->lock,flags); 1313 - p_cuser = argp; 1314 - PUT_USER(error,cnow.cts, &p_cuser->cts); 1315 - if (error) return error; 1316 - PUT_USER(error,cnow.dsr, &p_cuser->dsr); 1317 - if (error) return error; 1318 - PUT_USER(error,cnow.rng, &p_cuser->rng); 1319 - if (error) return error; 1320 - PUT_USER(error,cnow.dcd, &p_cuser->dcd); 1321 - if (error) return error; 1322 - PUT_USER(error,cnow.rx, &p_cuser->rx); 1323 - if (error) return error; 1324 - PUT_USER(error,cnow.tx, &p_cuser->tx); 1325 - if (error) return error; 1326 - PUT_USER(error,cnow.frame, &p_cuser->frame); 1327 - if (error) return error; 1328 - PUT_USER(error,cnow.overrun, &p_cuser->overrun); 1329 - if (error) return error; 1330 - PUT_USER(error,cnow.parity, &p_cuser->parity); 1331 - if (error) return error; 1332 - PUT_USER(error,cnow.brk, &p_cuser->brk); 1333 - if (error) return error; 1334 - PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun); 1335 - if (error) return error; 1336 - return 0; 1337 1313 default: 1338 1314 return -ENOIOCTLCMD; 1339 1315 } 1316 + return 0; 1317 + } 1318 + 1319 + static int get_icount(struct tty_struct *tty, 1320 + struct serial_icounter_struct *icount) 1321 + { 1322 + SLMP_INFO *info = tty->driver_data; 1323 + struct mgsl_icount cnow; /* kernel counter temps */ 1324 + unsigned long flags; 1325 + 1326 + spin_lock_irqsave(&info->lock,flags); 1327 + cnow = info->icount; 1328 + spin_unlock_irqrestore(&info->lock,flags); 1329 + 1330 + icount->cts = cnow.cts; 1331 + icount->dsr = cnow.dsr; 1332 + icount->rng = cnow.rng; 1333 + icount->dcd = cnow.dcd; 1334 + icount->rx = cnow.rx; 1335 + icount->tx = cnow.tx; 1336 + icount->frame = cnow.frame; 1337 + icount->overrun = cnow.overrun; 1338 + icount->parity = cnow.parity; 1339 + icount->brk = cnow.brk; 1340 + icount->buf_overrun = cnow.buf_overrun; 1341 + 1340 1342 return 0; 1341 1343 } 1342 1344 ··· 3903 3909 .hangup = hangup, 3904 3910 .tiocmget = tiocmget, 3905 3911 .tiocmset = tiocmset, 3912 + .get_icount = get_icount, 3906 3913 .proc_fops = &synclinkmp_proc_fops, 3907 3914 }; 3908 3915
+25 -26
drivers/serial/68360serial.c
··· 1381 1381 } 1382 1382 1383 1383 1384 + /* 1385 + * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1386 + * Return: write counters to the user passed counter struct 1387 + * NB: both 1->0 and 0->1 transitions are counted except for 1388 + * RI where only 0->1 is counted. 1389 + */ 1390 + static int rs_360_get_icount(struct tty_struct *tty, 1391 + struct serial_icounter_struct *icount) 1392 + { 1393 + ser_info_t *info = (ser_info_t *)tty->driver_data; 1394 + struct async_icount cnow; 1395 + 1396 + local_irq_disable(); 1397 + cnow = info->state->icount; 1398 + local_irq_enable(); 1399 + 1400 + icount->cts = cnow.cts; 1401 + icount->dsr = cnow.dsr; 1402 + icount->rng = cnow.rng; 1403 + icount->dcd = cnow.dcd; 1404 + 1405 + return 0; 1406 + } 1407 + 1384 1408 static int rs_360_ioctl(struct tty_struct *tty, struct file * file, 1385 1409 unsigned int cmd, unsigned long arg) 1386 1410 { ··· 1418 1394 if (serial_paranoia_check(info, tty->name, "rs_ioctl")) 1419 1395 return -ENODEV; 1420 1396 1421 - if ((cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { 1397 + if (cmd != TIOCMIWAIT) { 1422 1398 if (tty->flags & (1 << TTY_IO_ERROR)) 1423 1399 return -EIO; 1424 1400 } ··· 1501 1477 return 0; 1502 1478 #endif 1503 1479 1504 - /* 1505 - * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) 1506 - * Return: write counters to the user passed counter struct 1507 - * NB: both 1->0 and 0->1 transitions are counted except for 1508 - * RI where only 0->1 is counted. 1509 - */ 1510 - case TIOCGICOUNT: 1511 - local_irq_disable(); 1512 - cnow = info->state->icount; 1513 - local_irq_enable(); 1514 - p_cuser = (struct serial_icounter_struct *) arg; 1515 - /* error = put_user(cnow.cts, &p_cuser->cts); */ 1516 - /* if (error) return error; */ 1517 - /* error = put_user(cnow.dsr, &p_cuser->dsr); */ 1518 - /* if (error) return error; */ 1519 - /* error = put_user(cnow.rng, &p_cuser->rng); */ 1520 - /* if (error) return error; */ 1521 - /* error = put_user(cnow.dcd, &p_cuser->dcd); */ 1522 - /* if (error) return error; */ 1523 - 1524 - put_user(cnow.cts, &p_cuser->cts); 1525 - put_user(cnow.dsr, &p_cuser->dsr); 1526 - put_user(cnow.rng, &p_cuser->rng); 1527 - put_user(cnow.dcd, &p_cuser->dcd); 1528 - return 0; 1529 1480 1530 1481 default: 1531 1482 return -ENOIOCTLCMD;
-4
net/bluetooth/rfcomm/tty.c
··· 844 844 BT_DBG("TIOCMIWAIT"); 845 845 break; 846 846 847 - case TIOCGICOUNT: 848 - BT_DBG("TIOCGICOUNT"); 849 - break; 850 - 851 847 case TIOCGSERIAL: 852 848 BT_ERR("TIOCGSERIAL is not supported"); 853 849 return -ENOIOCTLCMD;