diff options
Diffstat (limited to 'drivers/staging/dgrp')
-rw-r--r-- | drivers/staging/dgrp/Kconfig | 2 | ||||
-rw-r--r-- | drivers/staging/dgrp/dgrp_net_ops.c | 13 | ||||
-rw-r--r-- | drivers/staging/dgrp/dgrp_specproc.c | 85 | ||||
-rw-r--r-- | drivers/staging/dgrp/dgrp_tty.c | 1 |
4 files changed, 52 insertions, 49 deletions
diff --git a/drivers/staging/dgrp/Kconfig b/drivers/staging/dgrp/Kconfig index 39f4bb65ec83..e4c41552923a 100644 --- a/drivers/staging/dgrp/Kconfig +++ b/drivers/staging/dgrp/Kconfig @@ -1,7 +1,7 @@ config DGRP tristate "Digi Realport driver" default n - depends on SYSFS + depends on SYSFS && TTY ---help--- Support for Digi Realport devices. These devices allow you to access remote serial ports as if they are local tty devices. This diff --git a/drivers/staging/dgrp/dgrp_net_ops.c b/drivers/staging/dgrp/dgrp_net_ops.c index 2d1bbfd5b67c..e6018823b9de 100644 --- a/drivers/staging/dgrp/dgrp_net_ops.c +++ b/drivers/staging/dgrp/dgrp_net_ops.c @@ -37,6 +37,7 @@ #include <linux/proc_fs.h> #include <linux/types.h> #include <linux/string.h> +#include <linux/device.h> #include <linux/tty.h> #include <linux/tty_flip.h> #include <linux/spinlock.h> @@ -211,7 +212,7 @@ static void dgrp_input(struct ch_struct *ch) data_len = (ch->ch_rin - ch->ch_rout) & RBUF_MASK; /* len is the amount of data we are going to transfer here */ - len = tty_buffer_request_room(tty, data_len); + len = tty_buffer_request_room(&ch->port, data_len); /* Check DPA flow control */ if ((nd->nd_dpa_debug) && @@ -232,9 +233,9 @@ static void dgrp_input(struct ch_struct *ch) (nd->nd_dpa_port == PORT_NUM(MINOR(tty_devnum(tty))))) dgrp_dpa_data(nd, 1, myflipbuf, len); - tty_insert_flip_string_flags(tty, myflipbuf, + tty_insert_flip_string_flags(&ch->port, myflipbuf, myflipflagbuf, len); - tty_flip_buffer_push(tty); + tty_flip_buffer_push(&ch->port); ch->ch_rxcount += len; } @@ -2956,9 +2957,9 @@ check_query: I_BRKINT(ch->ch_tun.un_tty) && !(I_IGNBRK(ch->ch_tun.un_tty))) { - tty_buffer_request_room(ch->ch_tun.un_tty, 1); - tty_insert_flip_char(ch->ch_tun.un_tty, 0, TTY_BREAK); - tty_flip_buffer_push(ch->ch_tun.un_tty); + tty_buffer_request_room(&ch->port, 1); + tty_insert_flip_char(&ch->port, 0, TTY_BREAK); + tty_flip_buffer_push(&ch->port); } diff --git a/drivers/staging/dgrp/dgrp_specproc.c b/drivers/staging/dgrp/dgrp_specproc.c index c214078a89e9..73f287f96604 100644 --- a/drivers/staging/dgrp/dgrp_specproc.c +++ b/drivers/staging/dgrp/dgrp_specproc.c @@ -81,33 +81,34 @@ static struct dgrp_proc_entry dgrp_mon_table[]; static struct dgrp_proc_entry dgrp_ports_table[]; static struct dgrp_proc_entry dgrp_dpa_table[]; -static ssize_t config_proc_write(struct file *file, const char __user *buffer, - size_t count, loff_t *pos); +static ssize_t dgrp_config_proc_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *pos); -static int nodeinfo_proc_open(struct inode *inode, struct file *file); -static int info_proc_open(struct inode *inode, struct file *file); -static int config_proc_open(struct inode *inode, struct file *file); +static int dgrp_nodeinfo_proc_open(struct inode *inode, struct file *file); +static int dgrp_info_proc_open(struct inode *inode, struct file *file); +static int dgrp_config_proc_open(struct inode *inode, struct file *file); static struct file_operations config_proc_file_ops = { .owner = THIS_MODULE, - .open = config_proc_open, + .open = dgrp_config_proc_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, - .write = config_proc_write + .write = dgrp_config_proc_write, }; static struct file_operations info_proc_file_ops = { .owner = THIS_MODULE, - .open = info_proc_open, + .open = dgrp_info_proc_open, .read = seq_read, .llseek = seq_lseek, - .release = seq_release, + .release = single_release, }; static struct file_operations nodeinfo_proc_file_ops = { .owner = THIS_MODULE, - .open = nodeinfo_proc_open, + .open = dgrp_nodeinfo_proc_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, @@ -181,13 +182,13 @@ static struct dgrp_proc_entry dgrp_dpa_table[] = { void dgrp_unregister_proc(void) { - unregister_proc_table(dgrp_table, dgrp_proc_dir_entry); net_entry_pointer = NULL; mon_entry_pointer = NULL; dpa_entry_pointer = NULL; ports_entry_pointer = NULL; if (dgrp_proc_dir_entry) { + unregister_proc_table(dgrp_table, dgrp_proc_dir_entry); remove_proc_entry(dgrp_proc_dir_entry->name, dgrp_proc_dir_entry->parent); dgrp_proc_dir_entry = NULL; @@ -231,6 +232,8 @@ static void register_proc_table(struct dgrp_proc_entry *table, if (table == NULL) return; + if (root == NULL) + return; for (; table->id; table++) { /* Can't do anything without a proc name. */ @@ -354,7 +357,7 @@ static int dgrp_gen_proc_open(struct inode *inode, struct file *file) struct dgrp_proc_entry *entry; int ret = 0; - de = (struct proc_dir_entry *) PDE(file->f_dentry->d_inode); + de = (struct proc_dir_entry *) PDE(file_inode(file)); if (!de || !de->data) { ret = -ENXIO; goto done; @@ -384,7 +387,7 @@ static int dgrp_gen_proc_close(struct inode *inode, struct file *file) struct proc_dir_entry *de; struct dgrp_proc_entry *entry; - de = (struct proc_dir_entry *) PDE(file->f_dentry->d_inode); + de = (struct proc_dir_entry *) PDE(file_inode(file)); if (!de || !de->data) goto done; @@ -403,21 +406,21 @@ done: return 0; } -static void *config_proc_start(struct seq_file *m, loff_t *pos) +static void *dgrp_config_proc_start(struct seq_file *m, loff_t *pos) { return seq_list_start_head(&nd_struct_list, *pos); } -static void *config_proc_next(struct seq_file *p, void *v, loff_t *pos) +static void *dgrp_config_proc_next(struct seq_file *p, void *v, loff_t *pos) { return seq_list_next(v, &nd_struct_list, pos); } -static void config_proc_stop(struct seq_file *m, void *v) +static void dgrp_config_proc_stop(struct seq_file *m, void *v) { } -static int config_proc_show(struct seq_file *m, void *v) +static int dgrp_config_proc_show(struct seq_file *m, void *v) { struct nd_struct *nd; char tmp_id[4]; @@ -443,13 +446,13 @@ static int config_proc_show(struct seq_file *m, void *v) } static const struct seq_operations proc_config_ops = { - .start = config_proc_start, - .next = config_proc_next, - .stop = config_proc_stop, - .show = config_proc_show + .start = dgrp_config_proc_start, + .next = dgrp_config_proc_next, + .stop = dgrp_config_proc_stop, + .show = dgrp_config_proc_show, }; -static int config_proc_open(struct inode *inode, struct file *file) +static int dgrp_config_proc_open(struct inode *inode, struct file *file) { return seq_open(file, &proc_config_ops); } @@ -460,8 +463,9 @@ static int config_proc_open(struct inode *inode, struct file *file) * write) is treated as an independent request. See the "parse" * description for more details. */ -static ssize_t config_proc_write(struct file *file, const char __user *buffer, - size_t count, loff_t *pos) +static ssize_t dgrp_config_proc_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *pos) { ssize_t retval; char *inbuf, *sp; @@ -625,7 +629,7 @@ static int parse_write_config(char *buf) return retval; } -static int info_proc_show(struct seq_file *m, void *v) +static int dgrp_info_proc_show(struct seq_file *m, void *v) { seq_printf(m, "version: %s\n", DIGI_VERSION); seq_puts(m, "register_with_sysfs: 1\n"); @@ -635,27 +639,27 @@ static int info_proc_show(struct seq_file *m, void *v) return 0; } -static int info_proc_open(struct inode *inode, struct file *file) +static int dgrp_info_proc_open(struct inode *inode, struct file *file) { - return single_open(file, info_proc_show, NULL); + return single_open(file, dgrp_info_proc_show, NULL); } -static void *nodeinfo_start(struct seq_file *m, loff_t *pos) +static void *dgrp_nodeinfo_start(struct seq_file *m, loff_t *pos) { return seq_list_start_head(&nd_struct_list, *pos); } -static void *nodeinfo_next(struct seq_file *p, void *v, loff_t *pos) +static void *dgrp_nodeinfo_next(struct seq_file *p, void *v, loff_t *pos) { return seq_list_next(v, &nd_struct_list, pos); } -static void nodeinfo_stop(struct seq_file *m, void *v) +static void dgrp_nodeinfo_stop(struct seq_file *m, void *v) { } -static int nodeinfo_show(struct seq_file *m, void *v) +static int dgrp_nodeinfo_show(struct seq_file *m, void *v) { struct nd_struct *nd; char hwver[8]; @@ -697,13 +701,13 @@ static int nodeinfo_show(struct seq_file *m, void *v) static const struct seq_operations nodeinfo_ops = { - .start = nodeinfo_start, - .next = nodeinfo_next, - .stop = nodeinfo_stop, - .show = nodeinfo_show + .start = dgrp_nodeinfo_start, + .next = dgrp_nodeinfo_next, + .stop = dgrp_nodeinfo_stop, + .show = dgrp_nodeinfo_show, }; -static int nodeinfo_proc_open(struct inode *inode, struct file *file) +static int dgrp_nodeinfo_proc_open(struct inode *inode, struct file *file) { return seq_open(file, &nodeinfo_ops); } @@ -773,14 +777,11 @@ static int dgrp_remove_nd(struct nd_struct *nd) dgrp_remove_node_class_sysfs_files(nd); } - if (nd->nd_mon_de) - unregister_dgrp_device(nd->nd_mon_de); + unregister_dgrp_device(nd->nd_mon_de); - if (nd->nd_ports_de) - unregister_dgrp_device(nd->nd_ports_de); + unregister_dgrp_device(nd->nd_ports_de); - if (nd->nd_dpa_de) - unregister_dgrp_device(nd->nd_dpa_de); + unregister_dgrp_device(nd->nd_dpa_de); dgrp_tty_uninit(nd); diff --git a/drivers/staging/dgrp/dgrp_tty.c b/drivers/staging/dgrp/dgrp_tty.c index 51d3ed3dca27..654f6010b473 100644 --- a/drivers/staging/dgrp/dgrp_tty.c +++ b/drivers/staging/dgrp/dgrp_tty.c @@ -39,6 +39,7 @@ #include <linux/slab.h> #include <linux/tty.h> #include <linux/tty_flip.h> +#include <linux/device.h> #include <linux/sched.h> #include <linux/uaccess.h> |