summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-13 15:04:45 -0400
committerChristoph Hellwig <hch@lst.de>2018-05-16 01:24:30 -0400
commit8a8dcabffb991a08fa1fab4e75b80a9075825606 (patch)
treedb9d836b96716c68104ab6c82d6a18912d0b3c84
parentec7d9c9ce897174243af4fcd201dbfc34df0f3a3 (diff)
tty: replace ->proc_fops with ->proc_show
Just set up the show callback in the tty_operations, and use proc_create_single_data to create the file without additional boilerplace code. Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--arch/ia64/hp/sim/simserial.c15
-rw-r--r--arch/xtensa/platforms/iss/console.c15
-rw-r--r--drivers/char/pcmcia/synclink_cs.c15
-rw-r--r--drivers/mmc/core/sdio_uart.c15
-rw-r--r--drivers/staging/fwserial/fwserial.c15
-rw-r--r--drivers/tty/amiserial.c15
-rw-r--r--drivers/tty/cyclades.c15
-rw-r--r--drivers/tty/serial/serial_core.c15
-rw-r--r--drivers/tty/synclink.c15
-rw-r--r--drivers/tty/synclink_gt.c15
-rw-r--r--drivers/tty/synclinkmp.c15
-rw-r--r--drivers/usb/serial/usb-serial.c15
-rw-r--r--fs/proc/proc_tty.c6
-rw-r--r--include/linux/tty_driver.h2
14 files changed, 16 insertions, 172 deletions
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index a419ccf33cde..663388a73d4e 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -435,19 +435,6 @@ static int rs_proc_show(struct seq_file *m, void *v)
435 return 0; 435 return 0;
436} 436}
437 437
438static int rs_proc_open(struct inode *inode, struct file *file)
439{
440 return single_open(file, rs_proc_show, NULL);
441}
442
443static const struct file_operations rs_proc_fops = {
444 .owner = THIS_MODULE,
445 .open = rs_proc_open,
446 .read = seq_read,
447 .llseek = seq_lseek,
448 .release = single_release,
449};
450
451static const struct tty_operations hp_ops = { 438static const struct tty_operations hp_ops = {
452 .open = rs_open, 439 .open = rs_open,
453 .close = rs_close, 440 .close = rs_close,
@@ -462,7 +449,7 @@ static const struct tty_operations hp_ops = {
462 .unthrottle = rs_unthrottle, 449 .unthrottle = rs_unthrottle,
463 .send_xchar = rs_send_xchar, 450 .send_xchar = rs_send_xchar,
464 .hangup = rs_hangup, 451 .hangup = rs_hangup,
465 .proc_fops = &rs_proc_fops, 452 .proc_show = rs_proc_show,
466}; 453};
467 454
468static const struct tty_port_operations hp_port_ops = { 455static const struct tty_port_operations hp_port_ops = {
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 92f567f9a21e..af81a62faba6 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -153,19 +153,6 @@ static int rs_proc_show(struct seq_file *m, void *v)
153 return 0; 153 return 0;
154} 154}
155 155
156static int rs_proc_open(struct inode *inode, struct file *file)
157{
158 return single_open(file, rs_proc_show, NULL);
159}
160
161static const struct file_operations rs_proc_fops = {
162 .owner = THIS_MODULE,
163 .open = rs_proc_open,
164 .read = seq_read,
165 .llseek = seq_lseek,
166 .release = single_release,
167};
168
169static const struct tty_operations serial_ops = { 156static const struct tty_operations serial_ops = {
170 .open = rs_open, 157 .open = rs_open,
171 .close = rs_close, 158 .close = rs_close,
@@ -176,7 +163,7 @@ static const struct tty_operations serial_ops = {
176 .chars_in_buffer = rs_chars_in_buffer, 163 .chars_in_buffer = rs_chars_in_buffer,
177 .hangup = rs_hangup, 164 .hangup = rs_hangup,
178 .wait_until_sent = rs_wait_until_sent, 165 .wait_until_sent = rs_wait_until_sent,
179 .proc_fops = &rs_proc_fops, 166 .proc_show = rs_proc_show,
180}; 167};
181 168
182int __init rs_init(void) 169int __init rs_init(void)
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index aa502e9fb7fa..66b04194aa9f 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -2616,19 +2616,6 @@ static int mgslpc_proc_show(struct seq_file *m, void *v)
2616 return 0; 2616 return 0;
2617} 2617}
2618 2618
2619static int mgslpc_proc_open(struct inode *inode, struct file *file)
2620{
2621 return single_open(file, mgslpc_proc_show, NULL);
2622}
2623
2624static const struct file_operations mgslpc_proc_fops = {
2625 .owner = THIS_MODULE,
2626 .open = mgslpc_proc_open,
2627 .read = seq_read,
2628 .llseek = seq_lseek,
2629 .release = single_release,
2630};
2631
2632static int rx_alloc_buffers(MGSLPC_INFO *info) 2619static int rx_alloc_buffers(MGSLPC_INFO *info)
2633{ 2620{
2634 /* each buffer has header and data */ 2621 /* each buffer has header and data */
@@ -2815,7 +2802,7 @@ static const struct tty_operations mgslpc_ops = {
2815 .tiocmget = tiocmget, 2802 .tiocmget = tiocmget,
2816 .tiocmset = tiocmset, 2803 .tiocmset = tiocmset,
2817 .get_icount = mgslpc_get_icount, 2804 .get_icount = mgslpc_get_icount,
2818 .proc_fops = &mgslpc_proc_fops, 2805 .proc_show = mgslpc_proc_show,
2819}; 2806};
2820 2807
2821static int __init synclink_cs_init(void) 2808static int __init synclink_cs_init(void)
diff --git a/drivers/mmc/core/sdio_uart.c b/drivers/mmc/core/sdio_uart.c
index d3c91f412b69..25e113001a3c 100644
--- a/drivers/mmc/core/sdio_uart.c
+++ b/drivers/mmc/core/sdio_uart.c
@@ -1008,19 +1008,6 @@ static int sdio_uart_proc_show(struct seq_file *m, void *v)
1008 return 0; 1008 return 0;
1009} 1009}
1010 1010
1011static int sdio_uart_proc_open(struct inode *inode, struct file *file)
1012{
1013 return single_open(file, sdio_uart_proc_show, NULL);
1014}
1015
1016static const struct file_operations sdio_uart_proc_fops = {
1017 .owner = THIS_MODULE,
1018 .open = sdio_uart_proc_open,
1019 .read = seq_read,
1020 .llseek = seq_lseek,
1021 .release = single_release,
1022};
1023
1024static const struct tty_port_operations sdio_uart_port_ops = { 1011static const struct tty_port_operations sdio_uart_port_ops = {
1025 .dtr_rts = uart_dtr_rts, 1012 .dtr_rts = uart_dtr_rts,
1026 .carrier_raised = uart_carrier_raised, 1013 .carrier_raised = uart_carrier_raised,
@@ -1045,7 +1032,7 @@ static const struct tty_operations sdio_uart_ops = {
1045 .tiocmset = sdio_uart_tiocmset, 1032 .tiocmset = sdio_uart_tiocmset,
1046 .install = sdio_uart_install, 1033 .install = sdio_uart_install,
1047 .cleanup = sdio_uart_cleanup, 1034 .cleanup = sdio_uart_cleanup,
1048 .proc_fops = &sdio_uart_proc_fops, 1035 .proc_show = sdio_uart_proc_show,
1049}; 1036};
1050 1037
1051static struct tty_driver *sdio_uart_tty_driver; 1038static struct tty_driver *sdio_uart_tty_driver;
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
index e8bfe5520bc7..fa0dd425b454 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -1506,11 +1506,6 @@ static int fwtty_debugfs_peers_show(struct seq_file *m, void *v)
1506 return 0; 1506 return 0;
1507} 1507}
1508 1508
1509static int fwtty_proc_open(struct inode *inode, struct file *fp)
1510{
1511 return single_open(fp, fwtty_proc_show, NULL);
1512}
1513
1514static int fwtty_stats_open(struct inode *inode, struct file *fp) 1509static int fwtty_stats_open(struct inode *inode, struct file *fp)
1515{ 1510{
1516 return single_open(fp, fwtty_debugfs_stats_show, inode->i_private); 1511 return single_open(fp, fwtty_debugfs_stats_show, inode->i_private);
@@ -1537,14 +1532,6 @@ static const struct file_operations fwtty_peers_fops = {
1537 .release = single_release, 1532 .release = single_release,
1538}; 1533};
1539 1534
1540static const struct file_operations fwtty_proc_fops = {
1541 .owner = THIS_MODULE,
1542 .open = fwtty_proc_open,
1543 .read = seq_read,
1544 .llseek = seq_lseek,
1545 .release = single_release,
1546};
1547
1548static const struct tty_port_operations fwtty_port_ops = { 1535static const struct tty_port_operations fwtty_port_ops = {
1549 .dtr_rts = fwtty_port_dtr_rts, 1536 .dtr_rts = fwtty_port_dtr_rts,
1550 .carrier_raised = fwtty_port_carrier_raised, 1537 .carrier_raised = fwtty_port_carrier_raised,
@@ -1570,7 +1557,7 @@ static const struct tty_operations fwtty_ops = {
1570 .tiocmget = fwtty_tiocmget, 1557 .tiocmget = fwtty_tiocmget,
1571 .tiocmset = fwtty_tiocmset, 1558 .tiocmset = fwtty_tiocmset,
1572 .get_icount = fwtty_get_icount, 1559 .get_icount = fwtty_get_icount,
1573 .proc_fops = &fwtty_proc_fops, 1560 .proc_show = fwtty_proc_show,
1574}; 1561};
1575 1562
1576static const struct tty_operations fwloop_ops = { 1563static const struct tty_operations fwloop_ops = {
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 32d7ce430b02..34dead614149 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1566,19 +1566,6 @@ static int rs_proc_show(struct seq_file *m, void *v)
1566 return 0; 1566 return 0;
1567} 1567}
1568 1568
1569static int rs_proc_open(struct inode *inode, struct file *file)
1570{
1571 return single_open(file, rs_proc_show, NULL);
1572}
1573
1574static const struct file_operations rs_proc_fops = {
1575 .owner = THIS_MODULE,
1576 .open = rs_proc_open,
1577 .read = seq_read,
1578 .llseek = seq_lseek,
1579 .release = single_release,
1580};
1581
1582/* 1569/*
1583 * --------------------------------------------------------------------- 1570 * ---------------------------------------------------------------------
1584 * rs_init() and friends 1571 * rs_init() and friends
@@ -1620,7 +1607,7 @@ static const struct tty_operations serial_ops = {
1620 .tiocmget = rs_tiocmget, 1607 .tiocmget = rs_tiocmget,
1621 .tiocmset = rs_tiocmset, 1608 .tiocmset = rs_tiocmset,
1622 .get_icount = rs_get_icount, 1609 .get_icount = rs_get_icount,
1623 .proc_fops = &rs_proc_fops, 1610 .proc_show = rs_proc_show,
1624}; 1611};
1625 1612
1626static int amiga_carrier_raised(struct tty_port *port) 1613static int amiga_carrier_raised(struct tty_port *port)
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index cf0bde3bb927..6d3c58051ce3 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -3972,19 +3972,6 @@ static int cyclades_proc_show(struct seq_file *m, void *v)
3972 return 0; 3972 return 0;
3973} 3973}
3974 3974
3975static int cyclades_proc_open(struct inode *inode, struct file *file)
3976{
3977 return single_open(file, cyclades_proc_show, NULL);
3978}
3979
3980static const struct file_operations cyclades_proc_fops = {
3981 .owner = THIS_MODULE,
3982 .open = cyclades_proc_open,
3983 .read = seq_read,
3984 .llseek = seq_lseek,
3985 .release = single_release,
3986};
3987
3988/* The serial driver boot-time initialization code! 3975/* The serial driver boot-time initialization code!
3989 Hardware I/O ports are mapped to character special devices on a 3976 Hardware I/O ports are mapped to character special devices on a
3990 first found, first allocated manner. That is, this code searches 3977 first found, first allocated manner. That is, this code searches
@@ -4024,7 +4011,7 @@ static const struct tty_operations cy_ops = {
4024 .tiocmget = cy_tiocmget, 4011 .tiocmget = cy_tiocmget,
4025 .tiocmset = cy_tiocmset, 4012 .tiocmset = cy_tiocmset,
4026 .get_icount = cy_get_icount, 4013 .get_icount = cy_get_icount,
4027 .proc_fops = &cyclades_proc_fops, 4014 .proc_show = cyclades_proc_show,
4028}; 4015};
4029 4016
4030static int __init cy_init(void) 4017static int __init cy_init(void)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 0466f9f08a91..6ff9405954a6 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1829,19 +1829,6 @@ static int uart_proc_show(struct seq_file *m, void *v)
1829 uart_line_info(m, drv, i); 1829 uart_line_info(m, drv, i);
1830 return 0; 1830 return 0;
1831} 1831}
1832
1833static int uart_proc_open(struct inode *inode, struct file *file)
1834{
1835 return single_open(file, uart_proc_show, PDE_DATA(inode));
1836}
1837
1838static const struct file_operations uart_proc_fops = {
1839 .owner = THIS_MODULE,
1840 .open = uart_proc_open,
1841 .read = seq_read,
1842 .llseek = seq_lseek,
1843 .release = single_release,
1844};
1845#endif 1832#endif
1846 1833
1847#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL) 1834#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL)
@@ -2415,7 +2402,7 @@ static const struct tty_operations uart_ops = {
2415 .break_ctl = uart_break_ctl, 2402 .break_ctl = uart_break_ctl,
2416 .wait_until_sent= uart_wait_until_sent, 2403 .wait_until_sent= uart_wait_until_sent,
2417#ifdef CONFIG_PROC_FS 2404#ifdef CONFIG_PROC_FS
2418 .proc_fops = &uart_proc_fops, 2405 .proc_show = uart_proc_show,
2419#endif 2406#endif
2420 .tiocmget = uart_tiocmget, 2407 .tiocmget = uart_tiocmget,
2421 .tiocmset = uart_tiocmset, 2408 .tiocmset = uart_tiocmset,
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c
index 3c4ad71f261d..fbdf4d01c6a9 100644
--- a/drivers/tty/synclink.c
+++ b/drivers/tty/synclink.c
@@ -3534,19 +3534,6 @@ static int mgsl_proc_show(struct seq_file *m, void *v)
3534 return 0; 3534 return 0;
3535} 3535}
3536 3536
3537static int mgsl_proc_open(struct inode *inode, struct file *file)
3538{
3539 return single_open(file, mgsl_proc_show, NULL);
3540}
3541
3542static const struct file_operations mgsl_proc_fops = {
3543 .owner = THIS_MODULE,
3544 .open = mgsl_proc_open,
3545 .read = seq_read,
3546 .llseek = seq_lseek,
3547 .release = single_release,
3548};
3549
3550/* mgsl_allocate_dma_buffers() 3537/* mgsl_allocate_dma_buffers()
3551 * 3538 *
3552 * Allocate and format DMA buffers (ISA adapter) 3539 * Allocate and format DMA buffers (ISA adapter)
@@ -4298,7 +4285,7 @@ static const struct tty_operations mgsl_ops = {
4298 .tiocmget = tiocmget, 4285 .tiocmget = tiocmget,
4299 .tiocmset = tiocmset, 4286 .tiocmset = tiocmset,
4300 .get_icount = msgl_get_icount, 4287 .get_icount = msgl_get_icount,
4301 .proc_fops = &mgsl_proc_fops, 4288 .proc_show = mgsl_proc_show,
4302}; 4289};
4303 4290
4304/* 4291/*
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
index 255c49687877..a94086597ebd 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -1316,19 +1316,6 @@ static int synclink_gt_proc_show(struct seq_file *m, void *v)
1316 return 0; 1316 return 0;
1317} 1317}
1318 1318
1319static int synclink_gt_proc_open(struct inode *inode, struct file *file)
1320{
1321 return single_open(file, synclink_gt_proc_show, NULL);
1322}
1323
1324static const struct file_operations synclink_gt_proc_fops = {
1325 .owner = THIS_MODULE,
1326 .open = synclink_gt_proc_open,
1327 .read = seq_read,
1328 .llseek = seq_lseek,
1329 .release = single_release,
1330};
1331
1332/* 1319/*
1333 * return count of bytes in transmit buffer 1320 * return count of bytes in transmit buffer
1334 */ 1321 */
@@ -3721,7 +3708,7 @@ static const struct tty_operations ops = {
3721 .tiocmget = tiocmget, 3708 .tiocmget = tiocmget,
3722 .tiocmset = tiocmset, 3709 .tiocmset = tiocmset,
3723 .get_icount = get_icount, 3710 .get_icount = get_icount,
3724 .proc_fops = &synclink_gt_proc_fops, 3711 .proc_show = synclink_gt_proc_show,
3725}; 3712};
3726 3713
3727static void slgt_cleanup(void) 3714static void slgt_cleanup(void)
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
index 75f11ce1f0a1..1e4d5b9c981a 100644
--- a/drivers/tty/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -1421,19 +1421,6 @@ static int synclinkmp_proc_show(struct seq_file *m, void *v)
1421 return 0; 1421 return 0;
1422} 1422}
1423 1423
1424static int synclinkmp_proc_open(struct inode *inode, struct file *file)
1425{
1426 return single_open(file, synclinkmp_proc_show, NULL);
1427}
1428
1429static const struct file_operations synclinkmp_proc_fops = {
1430 .owner = THIS_MODULE,
1431 .open = synclinkmp_proc_open,
1432 .read = seq_read,
1433 .llseek = seq_lseek,
1434 .release = single_release,
1435};
1436
1437/* Return the count of bytes in transmit buffer 1424/* Return the count of bytes in transmit buffer
1438 */ 1425 */
1439static int chars_in_buffer(struct tty_struct *tty) 1426static int chars_in_buffer(struct tty_struct *tty)
@@ -3899,7 +3886,7 @@ static const struct tty_operations ops = {
3899 .tiocmget = tiocmget, 3886 .tiocmget = tiocmget,
3900 .tiocmset = tiocmset, 3887 .tiocmset = tiocmset,
3901 .get_icount = get_icount, 3888 .get_icount = get_icount,
3902 .proc_fops = &synclinkmp_proc_fops, 3889 .proc_show = synclinkmp_proc_show,
3903}; 3890};
3904 3891
3905 3892
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 790e0cbe3da9..268ffa6b51d2 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -476,19 +476,6 @@ static int serial_proc_show(struct seq_file *m, void *v)
476 return 0; 476 return 0;
477} 477}
478 478
479static int serial_proc_open(struct inode *inode, struct file *file)
480{
481 return single_open(file, serial_proc_show, NULL);
482}
483
484static const struct file_operations serial_proc_fops = {
485 .owner = THIS_MODULE,
486 .open = serial_proc_open,
487 .read = seq_read,
488 .llseek = seq_lseek,
489 .release = single_release,
490};
491
492static int serial_tiocmget(struct tty_struct *tty) 479static int serial_tiocmget(struct tty_struct *tty)
493{ 480{
494 struct usb_serial_port *port = tty->driver_data; 481 struct usb_serial_port *port = tty->driver_data;
@@ -1192,7 +1179,7 @@ static const struct tty_operations serial_ops = {
1192 .get_icount = serial_get_icount, 1179 .get_icount = serial_get_icount,
1193 .cleanup = serial_cleanup, 1180 .cleanup = serial_cleanup,
1194 .install = serial_install, 1181 .install = serial_install,
1195 .proc_fops = &serial_proc_fops, 1182 .proc_show = serial_proc_show,
1196}; 1183};
1197 1184
1198 1185
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c
index b1a4a8ddd246..c69ff191e5d8 100644
--- a/fs/proc/proc_tty.c
+++ b/fs/proc/proc_tty.c
@@ -135,11 +135,11 @@ void proc_tty_register_driver(struct tty_driver *driver)
135 struct proc_dir_entry *ent; 135 struct proc_dir_entry *ent;
136 136
137 if (!driver->driver_name || driver->proc_entry || 137 if (!driver->driver_name || driver->proc_entry ||
138 !driver->ops->proc_fops) 138 !driver->ops->proc_show)
139 return; 139 return;
140 140
141 ent = proc_create_data(driver->driver_name, 0, proc_tty_driver, 141 ent = proc_create_single_data(driver->driver_name, 0, proc_tty_driver,
142 driver->ops->proc_fops, driver); 142 driver->ops->proc_show, driver);
143 driver->proc_entry = ent; 143 driver->proc_entry = ent;
144} 144}
145 145
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 31c2b5b166de..71dbc891851a 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -293,7 +293,7 @@ struct tty_operations {
293 int (*poll_get_char)(struct tty_driver *driver, int line); 293 int (*poll_get_char)(struct tty_driver *driver, int line);
294 void (*poll_put_char)(struct tty_driver *driver, int line, char ch); 294 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
295#endif 295#endif
296 const struct file_operations *proc_fops; 296 int (*proc_show)(struct seq_file *, void *);
297} __randomize_layout; 297} __randomize_layout;
298 298
299struct tty_driver { 299struct tty_driver {