Commit 8a8dcabf authored by Christoph Hellwig's avatar Christoph Hellwig

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: default avatarChristoph Hellwig <hch@lst.de>
parent ec7d9c9c
......@@ -435,19 +435,6 @@ static int rs_proc_show(struct seq_file *m, void *v)
return 0;
}
static int rs_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, rs_proc_show, NULL);
}
static const struct file_operations rs_proc_fops = {
.owner = THIS_MODULE,
.open = rs_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static const struct tty_operations hp_ops = {
.open = rs_open,
.close = rs_close,
......@@ -462,7 +449,7 @@ static const struct tty_operations hp_ops = {
.unthrottle = rs_unthrottle,
.send_xchar = rs_send_xchar,
.hangup = rs_hangup,
.proc_fops = &rs_proc_fops,
.proc_show = rs_proc_show,
};
static const struct tty_port_operations hp_port_ops = {
......
......@@ -153,19 +153,6 @@ static int rs_proc_show(struct seq_file *m, void *v)
return 0;
}
static int rs_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, rs_proc_show, NULL);
}
static const struct file_operations rs_proc_fops = {
.owner = THIS_MODULE,
.open = rs_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static const struct tty_operations serial_ops = {
.open = rs_open,
.close = rs_close,
......@@ -176,7 +163,7 @@ static const struct tty_operations serial_ops = {
.chars_in_buffer = rs_chars_in_buffer,
.hangup = rs_hangup,
.wait_until_sent = rs_wait_until_sent,
.proc_fops = &rs_proc_fops,
.proc_show = rs_proc_show,
};
int __init rs_init(void)
......
......@@ -2616,19 +2616,6 @@ static int mgslpc_proc_show(struct seq_file *m, void *v)
return 0;
}
static int mgslpc_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, mgslpc_proc_show, NULL);
}
static const struct file_operations mgslpc_proc_fops = {
.owner = THIS_MODULE,
.open = mgslpc_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int rx_alloc_buffers(MGSLPC_INFO *info)
{
/* each buffer has header and data */
......@@ -2815,7 +2802,7 @@ static const struct tty_operations mgslpc_ops = {
.tiocmget = tiocmget,
.tiocmset = tiocmset,
.get_icount = mgslpc_get_icount,
.proc_fops = &mgslpc_proc_fops,
.proc_show = mgslpc_proc_show,
};
static int __init synclink_cs_init(void)
......
......@@ -1008,19 +1008,6 @@ static int sdio_uart_proc_show(struct seq_file *m, void *v)
return 0;
}
static int sdio_uart_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, sdio_uart_proc_show, NULL);
}
static const struct file_operations sdio_uart_proc_fops = {
.owner = THIS_MODULE,
.open = sdio_uart_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static const struct tty_port_operations sdio_uart_port_ops = {
.dtr_rts = uart_dtr_rts,
.carrier_raised = uart_carrier_raised,
......@@ -1045,7 +1032,7 @@ static const struct tty_operations sdio_uart_ops = {
.tiocmset = sdio_uart_tiocmset,
.install = sdio_uart_install,
.cleanup = sdio_uart_cleanup,
.proc_fops = &sdio_uart_proc_fops,
.proc_show = sdio_uart_proc_show,
};
static struct tty_driver *sdio_uart_tty_driver;
......
......@@ -1506,11 +1506,6 @@ static int fwtty_debugfs_peers_show(struct seq_file *m, void *v)
return 0;
}
static int fwtty_proc_open(struct inode *inode, struct file *fp)
{
return single_open(fp, fwtty_proc_show, NULL);
}
static int fwtty_stats_open(struct inode *inode, struct file *fp)
{
return single_open(fp, fwtty_debugfs_stats_show, inode->i_private);
......@@ -1537,14 +1532,6 @@ static const struct file_operations fwtty_peers_fops = {
.release = single_release,
};
static const struct file_operations fwtty_proc_fops = {
.owner = THIS_MODULE,
.open = fwtty_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static const struct tty_port_operations fwtty_port_ops = {
.dtr_rts = fwtty_port_dtr_rts,
.carrier_raised = fwtty_port_carrier_raised,
......@@ -1570,7 +1557,7 @@ static const struct tty_operations fwtty_ops = {
.tiocmget = fwtty_tiocmget,
.tiocmset = fwtty_tiocmset,
.get_icount = fwtty_get_icount,
.proc_fops = &fwtty_proc_fops,
.proc_show = fwtty_proc_show,
};
static const struct tty_operations fwloop_ops = {
......
......@@ -1566,19 +1566,6 @@ static int rs_proc_show(struct seq_file *m, void *v)
return 0;
}
static int rs_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, rs_proc_show, NULL);
}
static const struct file_operations rs_proc_fops = {
.owner = THIS_MODULE,
.open = rs_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/*
* ---------------------------------------------------------------------
* rs_init() and friends
......@@ -1620,7 +1607,7 @@ static const struct tty_operations serial_ops = {
.tiocmget = rs_tiocmget,
.tiocmset = rs_tiocmset,
.get_icount = rs_get_icount,
.proc_fops = &rs_proc_fops,
.proc_show = rs_proc_show,
};
static int amiga_carrier_raised(struct tty_port *port)
......
......@@ -3972,19 +3972,6 @@ static int cyclades_proc_show(struct seq_file *m, void *v)
return 0;
}
static int cyclades_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, cyclades_proc_show, NULL);
}
static const struct file_operations cyclades_proc_fops = {
.owner = THIS_MODULE,
.open = cyclades_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* The serial driver boot-time initialization code!
Hardware I/O ports are mapped to character special devices on a
first found, first allocated manner. That is, this code searches
......@@ -4024,7 +4011,7 @@ static const struct tty_operations cy_ops = {
.tiocmget = cy_tiocmget,
.tiocmset = cy_tiocmset,
.get_icount = cy_get_icount,
.proc_fops = &cyclades_proc_fops,
.proc_show = cyclades_proc_show,
};
static int __init cy_init(void)
......
......@@ -1829,19 +1829,6 @@ static int uart_proc_show(struct seq_file *m, void *v)
uart_line_info(m, drv, i);
return 0;
}
static int uart_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, uart_proc_show, PDE_DATA(inode));
}
static const struct file_operations uart_proc_fops = {
.owner = THIS_MODULE,
.open = uart_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif
#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL)
......@@ -2415,7 +2402,7 @@ static const struct tty_operations uart_ops = {
.break_ctl = uart_break_ctl,
.wait_until_sent= uart_wait_until_sent,
#ifdef CONFIG_PROC_FS
.proc_fops = &uart_proc_fops,
.proc_show = uart_proc_show,
#endif
.tiocmget = uart_tiocmget,
.tiocmset = uart_tiocmset,
......
......@@ -3534,19 +3534,6 @@ static int mgsl_proc_show(struct seq_file *m, void *v)
return 0;
}
static int mgsl_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, mgsl_proc_show, NULL);
}
static const struct file_operations mgsl_proc_fops = {
.owner = THIS_MODULE,
.open = mgsl_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* mgsl_allocate_dma_buffers()
*
* Allocate and format DMA buffers (ISA adapter)
......@@ -4298,7 +4285,7 @@ static const struct tty_operations mgsl_ops = {
.tiocmget = tiocmget,
.tiocmset = tiocmset,
.get_icount = msgl_get_icount,
.proc_fops = &mgsl_proc_fops,
.proc_show = mgsl_proc_show,
};
/*
......
......@@ -1316,19 +1316,6 @@ static int synclink_gt_proc_show(struct seq_file *m, void *v)
return 0;
}
static int synclink_gt_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, synclink_gt_proc_show, NULL);
}
static const struct file_operations synclink_gt_proc_fops = {
.owner = THIS_MODULE,
.open = synclink_gt_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/*
* return count of bytes in transmit buffer
*/
......@@ -3721,7 +3708,7 @@ static const struct tty_operations ops = {
.tiocmget = tiocmget,
.tiocmset = tiocmset,
.get_icount = get_icount,
.proc_fops = &synclink_gt_proc_fops,
.proc_show = synclink_gt_proc_show,
};
static void slgt_cleanup(void)
......
......@@ -1421,19 +1421,6 @@ static int synclinkmp_proc_show(struct seq_file *m, void *v)
return 0;
}
static int synclinkmp_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, synclinkmp_proc_show, NULL);
}
static const struct file_operations synclinkmp_proc_fops = {
.owner = THIS_MODULE,
.open = synclinkmp_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* Return the count of bytes in transmit buffer
*/
static int chars_in_buffer(struct tty_struct *tty)
......@@ -3899,7 +3886,7 @@ static const struct tty_operations ops = {
.tiocmget = tiocmget,
.tiocmset = tiocmset,
.get_icount = get_icount,
.proc_fops = &synclinkmp_proc_fops,
.proc_show = synclinkmp_proc_show,
};
......
......@@ -476,19 +476,6 @@ static int serial_proc_show(struct seq_file *m, void *v)
return 0;
}
static int serial_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, serial_proc_show, NULL);
}
static const struct file_operations serial_proc_fops = {
.owner = THIS_MODULE,
.open = serial_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int serial_tiocmget(struct tty_struct *tty)
{
struct usb_serial_port *port = tty->driver_data;
......@@ -1192,7 +1179,7 @@ static const struct tty_operations serial_ops = {
.get_icount = serial_get_icount,
.cleanup = serial_cleanup,
.install = serial_install,
.proc_fops = &serial_proc_fops,
.proc_show = serial_proc_show,
};
......
......@@ -135,11 +135,11 @@ void proc_tty_register_driver(struct tty_driver *driver)
struct proc_dir_entry *ent;
if (!driver->driver_name || driver->proc_entry ||
!driver->ops->proc_fops)
!driver->ops->proc_show)
return;
ent = proc_create_data(driver->driver_name, 0, proc_tty_driver,
driver->ops->proc_fops, driver);
ent = proc_create_single_data(driver->driver_name, 0, proc_tty_driver,
driver->ops->proc_show, driver);
driver->proc_entry = ent;
}
......
......@@ -293,7 +293,7 @@ struct tty_operations {
int (*poll_get_char)(struct tty_driver *driver, int line);
void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
#endif
const struct file_operations *proc_fops;
int (*proc_show)(struct seq_file *, void *);
} __randomize_layout;
struct tty_driver {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment