* [PATCH] Fix broken compilation of Cris serial driver
@ 2009-04-08 10:07 Claudio Scordino
2009-04-08 10:12 ` Mikael Starvik
2009-04-08 10:57 ` Jesper Nilsson
0 siblings, 2 replies; 7+ messages in thread
From: Claudio Scordino @ 2009-04-08 10:07 UTC (permalink / raw)
To: Jesper Nilsson, starvik
Cc: Alan Cox, Hinko Kocevar, Janez Cufer, Andrew Morton, Linux Kernel,
dev-etrax, adobriyan
[-- Attachment #1: Type: text/plain, Size: 338 bytes --]
Hi,
compilation of cris serial driver on 2.6.30-rc1 is broken since
commit number 0f043a81ebe84be3576667f04fdda481609e3816 removed the
read_proc field from the tty_driver structure.
The patch in attachment may fix the problem. Please check it very
carefully: I don't have hardware to make any test.
Regards,
Claudio
[-- Attachment #2: 0001-Fix-remove-read_proc-field-from-cris-serial-driver.patch --]
[-- Type: text/x-diff, Size: 1305 bytes --]
From: Claudio Scordino <claudio@evidence.eu.com>
Commit number 0f043a81ebe84be3576667f04fdda481609e3816 removed the read_proc
field from the tty_driver structure.
This broke cris serial driver compilation.
Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
---
drivers/serial/crisv10.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index 7ba7d70..a331e40 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -27,6 +27,7 @@ static char *serial_version = "$Revision: 1.25 $";
#include <linux/kernel.h>
#include <linux/mutex.h>
#include <linux/bitops.h>
+#include <linux/proc_fs.h>
#include <asm/io.h>
#include <asm/irq.h>
@@ -4425,7 +4426,6 @@ static const struct tty_operations rs_ops = {
.break_ctl = rs_break,
.send_xchar = rs_send_xchar,
.wait_until_sent = rs_wait_until_sent,
- .read_proc = rs_read_proc,
.tiocmget = rs_tiocmget,
.tiocmset = rs_tiocmset
};
@@ -4490,6 +4490,7 @@ rs_init(void)
if (tty_register_driver(driver))
panic("Couldn't register serial driver\n");
/* do some initializing for the separate ports */
+ driver->proc_entry->read_proc = rs_read_proc;
for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) {
if (info->enabled) {
--
1.5.4.3
^ permalink raw reply related [flat|nested] 7+ messages in thread* RE: [PATCH] Fix broken compilation of Cris serial driver 2009-04-08 10:07 [PATCH] Fix broken compilation of Cris serial driver Claudio Scordino @ 2009-04-08 10:12 ` Mikael Starvik 2009-04-08 10:45 ` Claudio Scordino 2009-04-08 10:57 ` Jesper Nilsson 1 sibling, 1 reply; 7+ messages in thread From: Mikael Starvik @ 2009-04-08 10:12 UTC (permalink / raw) To: Claudio Scordino, Jesper Nilsson Cc: Alan Cox, Hinko Kocevar, Janez Cufer, Andrew Morton, Linux Kernel, dev-etrax, adobriyan@gmail.com Looks ok, go ahead and commit! Thanks /Mikael -----Original Message----- From: Claudio Scordino [mailto:claudio@evidence.eu.com] Sent: den 8 april 2009 12:07 To: Jesper Nilsson; Mikael Starvik Cc: Alan Cox; Hinko Kocevar; Janez Cufer; Andrew Morton; Linux Kernel; dev-etrax; adobriyan@gmail.com Subject: [PATCH] Fix broken compilation of Cris serial driver Hi, compilation of cris serial driver on 2.6.30-rc1 is broken since commit number 0f043a81ebe84be3576667f04fdda481609e3816 removed the read_proc field from the tty_driver structure. The patch in attachment may fix the problem. Please check it very carefully: I don't have hardware to make any test. Regards, Claudio ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix broken compilation of Cris serial driver 2009-04-08 10:12 ` Mikael Starvik @ 2009-04-08 10:45 ` Claudio Scordino 0 siblings, 0 replies; 7+ messages in thread From: Claudio Scordino @ 2009-04-08 10:45 UTC (permalink / raw) To: Mikael Starvik Cc: Jesper Nilsson, Alan Cox, Hinko Kocevar, Janez Cufer, Andrew Morton, Linux Kernel, dev-etrax, adobriyan@gmail.com Mikael Starvik ha scritto: > Looks ok, go ahead and commit! Please, give me more information about to do that: I was expecting that you would merge it in your own tree. The merge window has been closed but I suppose it does not apply to this patch since at the moment the driver does not even compile. So we should fix it before 2.6.30. Should I send the patch to some specific maintainer ? Will someone see the patch posted to LKML and will merge it ? Will Alan take over this patch as he did for my previous one ? Many thanks, Claudio ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix broken compilation of Cris serial driver 2009-04-08 10:07 [PATCH] Fix broken compilation of Cris serial driver Claudio Scordino 2009-04-08 10:12 ` Mikael Starvik @ 2009-04-08 10:57 ` Jesper Nilsson 2009-04-08 12:51 ` Alexey Dobriyan 1 sibling, 1 reply; 7+ messages in thread From: Jesper Nilsson @ 2009-04-08 10:57 UTC (permalink / raw) To: Claudio Scordino Cc: Mikael Starvik, Alan Cox, Hinko Kocevar, Janez Cufer, Andrew Morton, Linux Kernel, dev-etrax, adobriyan@gmail.com On Wed, Apr 08, 2009 at 12:07:16PM +0200, Claudio Scordino wrote: > Hi, > > compilation of cris serial driver on 2.6.30-rc1 is broken since > commit number 0f043a81ebe84be3576667f04fdda481609e3816 removed the > read_proc field from the tty_driver structure. > > The patch in attachment may fix the problem. Please check it very > carefully: I don't have hardware to make any test. > > Regards, > > Claudio Content-Description: 0001-Fix-remove-read_proc-field-from-cris-serial-driver.patch > From: Claudio Scordino <claudio@evidence.eu.com> > > Commit number 0f043a81ebe84be3576667f04fdda481609e3816 removed the read_proc > field from the tty_driver structure. > > This broke cris serial driver compilation. > > Signed-off-by: Claudio Scordino <claudio@evidence.eu.com> > --- > drivers/serial/crisv10.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c > index 7ba7d70..a331e40 100644 > --- a/drivers/serial/crisv10.c > +++ b/drivers/serial/crisv10.c > @@ -27,6 +27,7 @@ static char *serial_version = "$Revision: 1.25 $"; > #include <linux/kernel.h> > #include <linux/mutex.h> > #include <linux/bitops.h> > +#include <linux/proc_fs.h> > > #include <asm/io.h> > #include <asm/irq.h> > @@ -4425,7 +4426,6 @@ static const struct tty_operations rs_ops = { > .break_ctl = rs_break, > .send_xchar = rs_send_xchar, > .wait_until_sent = rs_wait_until_sent, > - .read_proc = rs_read_proc, > .tiocmget = rs_tiocmget, > .tiocmset = rs_tiocmset > }; > @@ -4490,6 +4490,7 @@ rs_init(void) > if (tty_register_driver(driver)) > panic("Couldn't register serial driver\n"); > /* do some initializing for the separate ports */ > + driver->proc_entry->read_proc = rs_read_proc; Is this the recommended way to convert proc handling? I find no other serial driver that does it this way... I was looking at using the proc_fops instead, but that is a much larger change. I will try to test your patch and if it works I'll push it through the CRIS tree. Thanks, /^JN - Jesper Nilsson -- Jesper Nilsson -- jesper.nilsson@axis.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix broken compilation of Cris serial driver 2009-04-08 10:57 ` Jesper Nilsson @ 2009-04-08 12:51 ` Alexey Dobriyan 2009-04-08 14:00 ` Jesper Nilsson 0 siblings, 1 reply; 7+ messages in thread From: Alexey Dobriyan @ 2009-04-08 12:51 UTC (permalink / raw) To: Jesper Nilsson Cc: Claudio Scordino, Mikael Starvik, Alan Cox, Hinko Kocevar, Janez Cufer, Andrew Morton, Linux Kernel, dev-etrax On Wed, Apr 08, 2009 at 12:57:01PM +0200, Jesper Nilsson wrote: > On Wed, Apr 08, 2009 at 12:07:16PM +0200, Claudio Scordino wrote: > > compilation of cris serial driver on 2.6.30-rc1 is broken since > > commit number 0f043a81ebe84be3576667f04fdda481609e3816 removed the > > read_proc field from the tty_driver structure. > > > > The patch in attachment may fix the problem. Please check it very > > carefully: I don't have hardware to make any test. > > - .read_proc = rs_read_proc, > > .tiocmget = rs_tiocmget, > > .tiocmset = rs_tiocmset > > }; > > @@ -4490,6 +4490,7 @@ rs_init(void) > > if (tty_register_driver(driver)) > > panic("Couldn't register serial driver\n"); > > /* do some initializing for the separate ports */ > > + driver->proc_entry->read_proc = rs_read_proc; > > Is this the recommended way to convert proc handling? No. > I find no other serial driver that does it this way... ->read_proc effectively went away. > I was looking at using the proc_fops instead, but that is a > much larger change. > > I will try to test your patch and if it works I'll push it > through the CRIS tree. It shouldn't work, ->read_proc won't even be called. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix broken compilation of Cris serial driver 2009-04-08 12:51 ` Alexey Dobriyan @ 2009-04-08 14:00 ` Jesper Nilsson 2009-04-08 15:52 ` Jesper Nilsson 0 siblings, 1 reply; 7+ messages in thread From: Jesper Nilsson @ 2009-04-08 14:00 UTC (permalink / raw) To: Alexey Dobriyan Cc: Claudio Scordino, Mikael Starvik, Alan Cox, Hinko Kocevar, Janez Cufer, Andrew Morton, Linux Kernel, dev-etrax On Wed, Apr 08, 2009 at 02:51:22PM +0200, Alexey Dobriyan wrote: > On Wed, Apr 08, 2009 at 12:57:01PM +0200, Jesper Nilsson wrote: > > On Wed, Apr 08, 2009 at 12:07:16PM +0200, Claudio Scordino wrote: > > > compilation of cris serial driver on 2.6.30-rc1 is broken since > > > commit number 0f043a81ebe84be3576667f04fdda481609e3816 removed the > > > read_proc field from the tty_driver structure. > > > > > > The patch in attachment may fix the problem. Please check it very > > > carefully: I don't have hardware to make any test. > > > > - .read_proc = rs_read_proc, > > > .tiocmget = rs_tiocmget, > > > .tiocmset = rs_tiocmset > > > }; > > > @@ -4490,6 +4490,7 @@ rs_init(void) > > > if (tty_register_driver(driver)) > > > panic("Couldn't register serial driver\n"); > > > /* do some initializing for the separate ports */ > > > + driver->proc_entry->read_proc = rs_read_proc; > > > > Is this the recommended way to convert proc handling? > > No. Ok, that's what I thought. > > I find no other serial driver that does it this way... > > ->read_proc effectively went away. ...so what do we use as a replacement, is it .proc_fops or anything else? /^JN - Jesper Nilsson -- Jesper Nilsson -- jesper.nilsson@axis.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix broken compilation of Cris serial driver 2009-04-08 14:00 ` Jesper Nilsson @ 2009-04-08 15:52 ` Jesper Nilsson 0 siblings, 0 replies; 7+ messages in thread From: Jesper Nilsson @ 2009-04-08 15:52 UTC (permalink / raw) To: Alexey Dobriyan Cc: Claudio Scordino, Mikael Starvik, Alan Cox, Hinko Kocevar, Janez Cufer, Andrew Morton, Linux Kernel, dev-etrax On Wed, Apr 08, 2009 at 04:00:04PM +0200, Jesper Nilsson wrote: > On Wed, Apr 08, 2009 at 02:51:22PM +0200, Alexey Dobriyan wrote: > > ->read_proc effectively went away. > > ...so what do we use as a replacement, is it .proc_fops > or anything else? The following patch works for me, any comments on the solution? CRISv10: Change serial driver proc-usage. Commit 0f043a81ebe84be3576667f04fdda481609e3816 removes the read_proc entry from struct tty_operations. Rework the proc handling in the CRISv10 serial driver to use proc_fops instead. Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com> -- crisv10.c | 173 +++++++++++++++++++++++++++----------------------------------- 1 file changed, 78 insertions(+), 95 deletions(-) diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index e642c22..4719935 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c @@ -23,16 +23,18 @@ static char *serial_version = "$Revision: 1.25 $"; #include <linux/mm.h> #include <linux/slab.h> #include <linux/init.h> -#include <asm/uaccess.h> #include <linux/kernel.h> #include <linux/mutex.h> #include <linux/bitops.h> +#include <linux/seq_file.h> +#include <linux/delay.h> +#include <linux/module.h> +#include <linux/uaccess.h> +#include <linux/io.h> -#include <asm/io.h> #include <asm/irq.h> #include <asm/dma.h> #include <asm/system.h> -#include <linux/delay.h> #include <arch/svinto.h> @@ -456,7 +458,6 @@ static struct e100_serial rs_table[] = { #define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial)) -static struct ktermios *serial_termios[NR_PORTS]; #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER static struct fast_timer fast_timers[NR_PORTS]; #endif @@ -4220,151 +4221,132 @@ rs_open(struct tty_struct *tty, struct file * filp) return 0; } +#ifdef CONFIG_PROC_FS /* * /proc fs routines.... */ -static int line_info(char *buf, struct e100_serial *info) +static void seq_line_info(struct seq_file *m, struct e100_serial *info) { - char stat_buf[30]; - int ret; unsigned long tmp; - ret = sprintf(buf, "%d: uart:E100 port:%lX irq:%d", - info->line, (unsigned long)info->ioport, info->irq); + seq_printf(m, "%d: uart:E100 port:%lX irq:%d", + info->line, (unsigned long)info->ioport, info->irq); if (!info->ioport || (info->type == PORT_UNKNOWN)) { - ret += sprintf(buf+ret, "\n"); - return ret; + seq_printf(m, "\n"); + return; } - stat_buf[0] = 0; - stat_buf[1] = 0; - if (!E100_RTS_GET(info)) - strcat(stat_buf, "|RTS"); - if (!E100_CTS_GET(info)) - strcat(stat_buf, "|CTS"); - if (!E100_DTR_GET(info)) - strcat(stat_buf, "|DTR"); - if (!E100_DSR_GET(info)) - strcat(stat_buf, "|DSR"); - if (!E100_CD_GET(info)) - strcat(stat_buf, "|CD"); - if (!E100_RI_GET(info)) - strcat(stat_buf, "|RI"); - - ret += sprintf(buf+ret, " baud:%d", info->baud); - - ret += sprintf(buf+ret, " tx:%lu rx:%lu", + seq_printf(m, " baud:%d", info->baud); + seq_printf(m, " tx:%lu rx:%lu", (unsigned long)info->icount.tx, (unsigned long)info->icount.rx); tmp = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); - if (tmp) { - ret += sprintf(buf+ret, " tx_pend:%lu/%lu", - (unsigned long)tmp, - (unsigned long)SERIAL_XMIT_SIZE); - } + if (tmp) + seq_printf(m, " tx_pend:%lu/%lu", + (unsigned long)tmp, + (unsigned long)SERIAL_XMIT_SIZE); - ret += sprintf(buf+ret, " rx_pend:%lu/%lu", - (unsigned long)info->recv_cnt, - (unsigned long)info->max_recv_cnt); + seq_printf(m, " rx_pend:%lu/%lu", + (unsigned long)info->recv_cnt, + (unsigned long)info->max_recv_cnt); #if 1 if (info->port.tty) { - if (info->port.tty->stopped) - ret += sprintf(buf+ret, " stopped:%i", - (int)info->port.tty->stopped); + seq_printf(m, " stopped:%i", + (int)info->port.tty->stopped); if (info->port.tty->hw_stopped) - ret += sprintf(buf+ret, " hw_stopped:%i", - (int)info->port.tty->hw_stopped); + seq_printf(m, " hw_stopped:%i", + (int)info->port.tty->hw_stopped); } { unsigned char rstat = info->ioport[REG_STATUS]; - if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) - ret += sprintf(buf+ret, " xoff_detect:1"); + if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect)) + seq_printf(m, " xoff_detect:1"); } #endif - - - if (info->icount.frame) - ret += sprintf(buf+ret, " fe:%lu", - (unsigned long)info->icount.frame); + seq_printf(m, " fe:%lu", (unsigned long)info->icount.frame); if (info->icount.parity) - ret += sprintf(buf+ret, " pe:%lu", - (unsigned long)info->icount.parity); + seq_printf(m, " pe:%lu", (unsigned long)info->icount.parity); if (info->icount.brk) - ret += sprintf(buf+ret, " brk:%lu", - (unsigned long)info->icount.brk); + seq_printf(m, " brk:%lu", (unsigned long)info->icount.brk); if (info->icount.overrun) - ret += sprintf(buf+ret, " oe:%lu", - (unsigned long)info->icount.overrun); + seq_printf(m, " oe:%lu", (unsigned long)info->icount.overrun); /* * Last thing is the RS-232 status lines */ - ret += sprintf(buf+ret, " %s\n", stat_buf+1); - return ret; + if (!E100_RTS_GET(info)) + seq_puts(m, "|RTS"); + if (!E100_CTS_GET(info)) + seq_puts(m, "|CTS"); + if (!E100_DTR_GET(info)) + seq_puts(m, "|DTR"); + if (!E100_DSR_GET(info)) + seq_puts(m, "|DSR"); + if (!E100_CD_GET(info)) + seq_puts(m, "|CD"); + if (!E100_RI_GET(info)) + seq_puts(m, "|RI"); + seq_puts(m, "\n"); } -int rs_read_proc(char *page, char **start, off_t off, int count, - int *eof, void *data) + +static int crisv10_proc_show(struct seq_file *m, void *v) { - int i, len = 0, l; - off_t begin = 0; + int i; - len += sprintf(page, "serinfo:1.0 driver:%s\n", - serial_version); - for (i = 0; i < NR_PORTS && len < 4000; i++) { + seq_printf(m, "serinfo:1.0 driver:%s\n", serial_version); + + for (i = 0; i < NR_PORTS; i++) { if (!rs_table[i].enabled) continue; - l = line_info(page + len, &rs_table[i]); - len += l; - if (len+begin > off+count) - goto done; - if (len+begin < off) { - begin += len; - len = 0; - } + seq_line_info(m, &rs_table[i]); } #ifdef DEBUG_LOG_INCLUDED for (i = 0; i < debug_log_pos; i++) { - len += sprintf(page + len, "%-4i %lu.%lu ", i, debug_log[i].time, timer_data_to_ns(debug_log[i].timer_data)); - len += sprintf(page + len, debug_log[i].string, debug_log[i].value); - if (len+begin > off+count) - goto done; - if (len+begin < off) { - begin += len; - len = 0; - } + seq_printf(m, "%-4i %lu.%lu ", + i, debug_log[i].time, + timer_data_to_ns(debug_log[i].timer_data)); + seq_printf(m, debug_log[i].string, debug_log[i].value); } - len += sprintf(page + len, "debug_log %i/%i %li bytes\n", - i, DEBUG_LOG_SIZE, begin+len); + seq_printf(m, "debug_log %i/%i\n", i, DEBUG_LOG_SIZE); debug_log_pos = 0; #endif + return 0; +} - *eof = 1; -done: - if (off >= len+begin) - return 0; - *start = page + (off-begin); - return ((count < begin+len-off) ? count : begin+len-off); +static int crisv10_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, crisv10_proc_show, NULL); } +static const struct file_operations crisv10_proc_fops = { + .owner = THIS_MODULE, + .open = crisv10_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +#endif + + /* Finally, routines used to initialize the serial driver. */ -static void -show_serial_version(void) +static void show_serial_version(void) { printk(KERN_INFO - "ETRAX 100LX serial-driver %s, (c) 2000-2004 Axis Communications AB\r\n", + "ETRAX 100LX serial-driver %s, " + "(c) 2000-2004 Axis Communications AB\r\n", &serial_version[11]); /* "$Revision: x.yy" */ } @@ -4388,13 +4370,14 @@ static const struct tty_operations rs_ops = { .break_ctl = rs_break, .send_xchar = rs_send_xchar, .wait_until_sent = rs_wait_until_sent, - .read_proc = rs_read_proc, .tiocmget = rs_tiocmget, - .tiocmset = rs_tiocmset + .tiocmset = rs_tiocmset, +#ifdef CONFIG_PROC_FS + .proc_fops = &crisv10_proc_fops, +#endif }; -static int __init -rs_init(void) +static int __init rs_init(void) { int i; struct e100_serial *info; /^JN - Jesper Nilsson -- Jesper Nilsson -- jesper.nilsson@axis.com ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-04-08 15:53 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-04-08 10:07 [PATCH] Fix broken compilation of Cris serial driver Claudio Scordino 2009-04-08 10:12 ` Mikael Starvik 2009-04-08 10:45 ` Claudio Scordino 2009-04-08 10:57 ` Jesper Nilsson 2009-04-08 12:51 ` Alexey Dobriyan 2009-04-08 14:00 ` Jesper Nilsson 2009-04-08 15:52 ` Jesper Nilsson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox