Staging: serqt_usb: switch to proc_fops
PATCH 1/1 Staging: serqt_usb: switch to proc_fops
Fix this build error:
serqt_usb.c:441: error: unknown field 'read_proc' specified in initializer
tty_operations::read_proc was removed in 0f043a81e (proc tty: remove struct tty_operations::read_proc)
Signed-off-by Alexander Beregalov <[email protected]>
---
drivers/staging/serqt_usb/serqt_usb.c | 63 ++++++++++++-------------------- 1 files changed, 24 insertions(+), 39 deletions(-)
drivers/staging/serqt_usb/serqt_usb.c +24 -39
@@ -14,6 +14,7 @@#include <linux/types.h> #include <linux/version.h> #include <linux/uaccess.h> +#include <linux/seq_file.h> /* Use our own dbg macro */ /* #define DEBUG_ON */
@@ -288,8 +289,8 @@ static void serial_throttle(struct tty_struct *tty);static void serial_unthrottle (struct tty_struct *tty);static int serial_break (struct tty_struct *tty,int break_state);static int serial_chars_in_buffer (struct tty_struct *tty); -static int serial_read_proc (char *page,char **start,off_t off,int count, -int *eof,void *data); +static int serial_proc_show (struct seq_file *m,void *v); +static int serial_proc_open (struct inode *inode,struct file *file);static int qt_open (struct usb_serial_port *port,struct file *filp);static int BoxSetPrebufferLevel (struct usb_serial *serial);
@@ -427,6 +428,14 @@ static struct usb_driver serqt_usb_driver = {static struct ktermios *serial_termios[SERIAL_TTY_MINORS ];static struct ktermios *serial_termios_locked[SERIAL_TTY_MINORS ]; +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 const struct tty_operations serial_ops = { .open = serial_open, .close = serial_close,
@@ -438,7 +447,7 @@ static const struct tty_operations serial_ops = { .unthrottle = serial_unthrottle, .break_ctl = serial_break, .chars_in_buffer = serial_chars_in_buffer, - .read_proc = serial_read_proc, + .proc_fops = &serial_proc_fops, .tiocmset = serial_tiocmset, .tiocmget = serial_tiocmget, };
@@ -2417,50 +2426,26 @@ exit:return 0 ; } -static int serial_read_proc (char *page,char **start,off_t off,int count, -int *eof,void *data) +static int serial_proc_show (struct seq_file *m,void *v) {struct usb_serial *serial; -int length =0 ;int i; -off_t begin =0 ; -mydbg ("%s\n" , __func__); - length +=sprintf (page,"usbserinfo:1.0 driver:%s\n" ,DRIVER_VERSION ); -for (i =0 ; i <SERIAL_TTY_MINORS && length <PAGE_SIZE ; ++i) { +seq_printf (m,"usbserinfo:1.0 driver:%s\n" ,DRIVER_VERSION ); +for (i =0 ; i <SERIAL_TTY_MINORS ; i++) { serial =get_serial_by_minor (i);if (serial ==NULL )continue ; - - length +=sprintf (page + length,"%d:\n" , i); - length += -sprintf (page + length," vendor:%04x product:%04x\n" , - serial->vendor, serial->product); - length += -sprintf (page + length," num_ports:%d\n" , - serial->num_ports); - length += -sprintf (page + length," port:%d\n" , i - serial->minor +1 ); - -/* -usb_make_path(serial->dev, tmp, sizeof(tmp)); -length += sprintf (page+length, " path:%s", tmp); -*/ - - length +=sprintf (page + length,"\n" ); -if ((length + begin) > (off + count)) - goto done; -if ((length + begin) < off) { - begin += length; - length =0 ; - } +seq_printf (m,"%d:\n vendor:%04x product:%04x\n num_ports:%d\n" +" port:%d\n" , i, serial->vendor, serial->product, + serial->num_ports, i - serial->minor +1 ); } - *eof =1 ; -done: -if (off >= (length + begin)) -return 0 ; - *start = page + (off - begin); -return ((count < begin + length - off) ? count : begin + length - off); +return 0 ; +} + +static int serial_proc_open (struct inode *inode,struct file *file) +{ +return single_open (file, serial_proc_show,NULL ); } static int ioctl_serial_usb(struct inode *innod, struct file *filp, unsigned int cmd,
Quoted 7 lines · Alexander Beregalov
Fix this build error:
serqt_usb.c:441: error: unknown field 'read_proc' specified in initializer
tty_operations::read_procwas removed in0f043a81e(proc tty: remove structtty_operations::read_proc)Signed-off-by Alexander Beregalov <[email protected]>
Thanks for the patch, but I just deleted this function completely, as it's not needed at all. The driver needs to be converted to use the usb-serial layer, not duplicate it, incorrectly, as it currently has done. I'm still working on it, that's why it's in the staging tree :)
thanks again,
greg k-h