NET: pc300, move to staging as it is broken
Subsystems (4)
PATCH 1/3 NET: pc300, move to staging as it is broken
It was marked as BROKEN back in 2008. It is because the tty handling in the driver is really broken.
There was some activity in January 2012 to fix the driver, but the patch was commented to be bogus:
https://lkml.org/lkml/2012/1/29/160
and we have not heard back from the author since then:
https://lkml.org/lkml/2012/3/28/412
So since nobody stepped in and rewrote the driver, it is time to move it out of line now. And drop it some time later if nobody comes up with patches to fix the driver in staging.
---
drivers/net/wan/Kconfig | 31 ------------------
drivers/net/wan/Makefile | 5 ---
drivers/staging/Kconfig | 2 ++
drivers/staging/Makefile | 1 +
drivers/staging/net/Kconfig | 38 ++++++++++++++++++++++
drivers/staging/net/Makefile | 5 +++
drivers/staging/net/TODO | 5 +++
drivers/{net/wan => staging/net}/pc300-falc-lh.h | 0
drivers/{net/wan => staging/net}/pc300.h | 0
drivers/{net/wan => staging/net}/pc300_drv.c | 0
drivers/{net/wan => staging/net}/pc300_tty.c | 0
11 files changed, 51 insertions(+), 36 deletions(-)
create mode 100644 drivers/staging/net/Kconfig
create mode 100644 drivers/staging/net/Makefile
create mode 100644 drivers/staging/net/TODO
rename drivers/{net/wan => staging/net}/pc300-falc-lh.h (100%)
rename drivers/{net/wan => staging/net}/pc300.h (100%)
rename drivers/{net/wan => staging/net}/pc300_drv.c (100%)
rename drivers/{net/wan => staging/net}/pc300_tty.c (100%)drivers/net/wan/Kconfig +0 -31
@@ -203,37 +203,6 @@ config WANXL_BUILD_FIRMWARE You should never need this option, say N. -config PC300 - tristate "Cyclades-PC300 support (RS-232/V.35, X.21, T1/E1 boards)" - depends on HDLC && PCI && BROKEN - ---help--- - This driver is broken because of struct tty_driver change. - - Driver for the Cyclades-PC300 synchronous communication boards. - - These boards provide synchronous serial interfaces to your - Linux box (interfaces currently available are RS-232/V.35, X.21 and - T1/E1). If you wish to support Multilink PPP, please select the - option later and read the file README.mlppp provided by PC300 - package. - - To compile this as a module, choose M here: the module - will be called pc300. - - If unsure, say N. - -config PC300_MLPPP - bool "Cyclades-PC300 MLPPP support" - depends on PC300 && PPP_MULTILINK && PPP_SYNC_TTY && HDLC_PPP - help - Multilink PPP over the PC300 synchronous communication boards. - -comment "Cyclades-PC300 MLPPP support is disabled." - depends on HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP) - -comment "Refer to the file README.mlppp, provided by PC300 package." - depends on HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP) - config PC300TOO tristate "Cyclades PC300 RSV/X21 alternative support" depends on HDLC && PCI
drivers/net/wan/Makefile +0 -5
@@ -17,10 +17,6 @@ obj-$(CONFIG_HDLC_FR) += hdlc_fr.o obj-$(CONFIG_HDLC_PPP) += hdlc_ppp.o obj-$(CONFIG_HDLC_X25) += hdlc_x25.o -pc300-y := pc300_drv.o -pc300-$(CONFIG_PC300_MLPPP) += pc300_tty.o -pc300-objs := $(pc300-y) - obj-$(CONFIG_HOSTESS_SV11) += z85230.o hostess_sv11.o obj-$(CONFIG_SEALEVEL_4021) += z85230.o sealevel.o obj-$(CONFIG_COSA) += cosa.o
@@ -35,7 +31,6 @@ obj-$(CONFIG_SDLA) += sdla.o obj-$(CONFIG_CYCLADES_SYNC) += cycx_drv.o cyclomx.o obj-$(CONFIG_LAPBETHER) += lapbether.o obj-$(CONFIG_SBNI) += sbni.o -obj-$(CONFIG_PC300) += pc300.o obj-$(CONFIG_N2) += n2.o obj-$(CONFIG_C101) += c101.o obj-$(CONFIG_WANXL) += wanxl.o
drivers/staging/Kconfig +2 -0
@@ -120,6 +120,8 @@ source "drivers/staging/nvec/Kconfig" source "drivers/staging/media/Kconfig" +source "drivers/staging/net/Kconfig" + source "drivers/staging/omapdrm/Kconfig" source "drivers/staging/android/Kconfig"
drivers/staging/Makefile +1 -0
@@ -4,6 +4,7 @@ obj-$(CONFIG_STAGING) += staging.o obj-y += media/ +obj-y += net/ obj-$(CONFIG_ET131X) += et131x/ obj-$(CONFIG_SLICOSS) += slicoss/ obj-$(CONFIG_USBIP_CORE) += usbip/
drivers/staging/net/Kconfig new file +38 -0
@@ -0,0 +1,38 @@ +if NETDEVICES + +if WAN + +config PC300 + tristate "Cyclades-PC300 support (RS-232/V.35, X.21, T1/E1 boards)" + depends on HDLC && PCI && BROKEN + ---help--- + This driver is broken because of struct tty_driver change. + + Driver for the Cyclades-PC300 synchronous communication boards. + + These boards provide synchronous serial interfaces to your + Linux box (interfaces currently available are RS-232/V.35, X.21 and + T1/E1). If you wish to support Multilink PPP, please select the + option later and read the file README.mlppp provided by PC300 + package. + + To compile this as a module, choose M here: the module + will be called pc300. + + If unsure, say N. + +config PC300_MLPPP + bool "Cyclades-PC300 MLPPP support" + depends on PC300 && PPP_MULTILINK && PPP_SYNC_TTY && HDLC_PPP + help + Multilink PPP over the PC300 synchronous communication boards. + +comment "Cyclades-PC300 MLPPP support is disabled." + depends on HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP) + +comment "Refer to the file README.mlppp, provided by PC300 package." + depends on HDLC && PC300 && (PPP=n || !PPP_MULTILINK || PPP_SYNC_TTY=n || !HDLC_PPP) + +endif # WAN + +endif # NETDEVICES
drivers/staging/net/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +pc300-y := pc300_drv.o +pc300-$(CONFIG_PC300_MLPPP) += pc300_tty.o +pc300-objs := $(pc300-y) + +obj-$(CONFIG_PC300) += pc300.o
drivers/staging/net/TODO new file +5 -0
@@ -0,0 +1,5 @@ +PC300 +The driver is very broken and cannot work with the current TTY layer. It is +inevitable to convert it to the new TTY API. + +If no one steps in to adopt the driver, it will be removed in the 3.7 release.
drivers/staging/net/pc300-falc-lh.h renamed from drivers/net/wan/pc300-falc-lh.h +0 -0
drivers/staging/net/pc300.h renamed from drivers/net/wan/pc300.h +0 -0
drivers/staging/net/pc300_drv.c renamed from drivers/net/wan/pc300_drv.c +0 -0
drivers/staging/net/pc300_tty.c renamed from drivers/net/wan/pc300_tty.c +0 -0
Signature · 1 line
1.7.9.2
PATCH 2/3 TTY: con3215, add tty_port
And use flags from that. But first we have to get rid of duplicated flag names. From now on, for the standard ones that are stored in tty_port->flags, we use ASYNC_* ones.
--- drivers/s390/char/con3215.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/s390/char/con3215.c +16 -14
@@ -20,6 +20,7 @@#include <linux/interrupt.h> #include <linux/err.h> #include <linux/reboot.h> +#include <linux/serial.h> /* ASYNC_* flags */ #include <linux/slab.h> #include <asm/ccwdev.h> #include <asm/cio.h>
@@ -44,14 +45,11 @@#define RAW3215_TIMEOUT HZ/10/* time for delayed output */ #define RAW3215_FIXED 1/* 3215 console device is not be freed */ -#define RAW3215_ACTIVE 2/* set if the device is in use */ #define RAW3215_WORKING 4/* set if a request is being worked on */ #define RAW3215_THROTTLED 8/* set if reading is disabled */ #define RAW3215_STOPPED 16/* set if writing is disabled */ -#define RAW3215_CLOSING 32/* set while in close process */ #define RAW3215_TIMER_RUNS 64/* set if the output delay timer is on */ #define RAW3215_FLUSHING 128/* set to flush buffer (no delay) */ -#define RAW3215_FROZEN 256/* set if 3215 is frozen for suspend */ #define TAB_STOP_SIZE 8/* tab stop size */
@@ -76,6 +74,7 @@ struct raw3215_req { } __attribute__ ((aligned(8)));struct raw3215_info { +struct tty_port port;struct ccw_device *cdev;/* device for tty driver */ spinlock_t *lock;/* pointer to irq lock */ int flags;/* state flags */
@@ -293,7 +292,7 @@ static void raw3215_timeout(unsigned long __data)if (raw->flags &RAW3215_TIMER_RUNS ) {del_timer (&raw->timer); raw->flags &= ~RAW3215_TIMER_RUNS ; -if (!(raw->flags &RAW3215_FROZEN )) { +if (!(raw->port.flags &ASYNC_SUSPENDED )) {raw3215_mk_write_req (raw);raw3215_start_io (raw); }
@@ -309,7 +308,8 @@ static void raw3215_timeout(unsigned long __data)*/ static inline void raw3215_try_io (struct raw3215_info *raw) { -if (!(raw->flags &RAW3215_ACTIVE ) || (raw->flags &RAW3215_FROZEN )) +if (!(raw->port.flags &ASYNC_INITIALIZED ) || + (raw->port.flags &ASYNC_SUSPENDED ))return ;if (raw->queued_read !=NULL )raw3215_start_io (raw);
@@ -484,7 +484,7 @@ static void raw3215_make_room(struct raw3215_info *raw, unsigned int length)/* While console is frozen for suspend we have no other * choice but to drop message from the buffer to make * room for even more messages. */ -if (raw->flags &RAW3215_FROZEN ) { +if (raw->port.flags &ASYNC_SUSPENDED ) {raw3215_drop_line (raw);continue ; }
@@ -606,10 +606,10 @@ static int raw3215_startup(struct raw3215_info *raw) {unsigned long flags; -if (raw->flags &RAW3215_ACTIVE ) +if (raw->port.flags &ASYNC_INITIALIZED )return 0 ; raw->line_pos =0 ; - raw->flags |=RAW3215_ACTIVE ; + raw->port.flags |=ASYNC_INITIALIZED ;spin_lock_irqsave (get_ccwdev_lock (raw->cdev), flags);raw3215_try_io (raw);spin_unlock_irqrestore (get_ccwdev_lock (raw->cdev), flags);
@@ -625,14 +625,15 @@ static void raw3215_shutdown(struct raw3215_info *raw)DECLARE_WAITQUEUE (wait, current);unsigned long flags; -if (!(raw->flags &RAW3215_ACTIVE ) || (raw->flags &RAW3215_FIXED )) +if (!(raw->port.flags &ASYNC_INITIALIZED ) || + (raw->flags &RAW3215_FIXED ))return ;/* Wait for outstanding requests, then free irq */ spin_lock_irqsave (get_ccwdev_lock (raw->cdev), flags);if ((raw->flags &RAW3215_WORKING ) || raw->queued_write !=NULL || raw->queued_read !=NULL ) { - raw->flags |=RAW3215_CLOSING ; + raw->port.flags |=ASYNC_CLOSING ;add_wait_queue (&raw->empty_wait, &wait);set_current_state (TASK_INTERRUPTIBLE );spin_unlock_irqrestore (get_ccwdev_lock (raw->cdev), flags);
@@ -640,7 +641,7 @@ static void raw3215_shutdown(struct raw3215_info *raw)spin_lock_irqsave (get_ccwdev_lock (raw->cdev), flags);remove_wait_queue (&raw->empty_wait, &wait);set_current_state (TASK_RUNNING ); - raw->flags &= ~(RAW3215_ACTIVE |RAW3215_CLOSING ); + raw->port.flags &= ~(ASYNC_INITIALIZED |ASYNC_CLOSING ); }spin_unlock_irqrestore (get_ccwdev_lock (raw->cdev), flags); }
@@ -663,6 +664,7 @@ static struct raw3215_info *raw3215_alloc_info(void)setup_timer (&info->timer, raw3215_timeout, (unsigned long )info);init_waitqueue_head (&info->empty_wait);tasklet_init (&info->tlet, raw3215_wakeup, (unsigned long )info); +tty_port_init (&info->port);return info; }
@@ -752,7 +754,7 @@ static int raw3215_pm_stop(struct ccw_device *cdev) raw =dev_get_drvdata (&cdev->dev);spin_lock_irqsave (get_ccwdev_lock (raw->cdev), flags);raw3215_make_room (raw,RAW3215_BUFFER_SIZE ); - raw->flags |=RAW3215_FROZEN ; + raw->port.flags |=ASYNC_SUSPENDED ;spin_unlock_irqrestore (get_ccwdev_lock (raw->cdev), flags);return 0 ; }
@@ -765,7 +767,7 @@ static int raw3215_pm_start(struct ccw_device *cdev)/* Allow I/O again and flush output buffer. */ raw =dev_get_drvdata (&cdev->dev);spin_lock_irqsave (get_ccwdev_lock (raw->cdev), flags); - raw->flags &= ~RAW3215_FROZEN ; + raw->port.flags &= ~ASYNC_SUSPENDED ; raw->flags |=RAW3215_FLUSHING ;raw3215_try_io (raw); raw->flags &= ~RAW3215_FLUSHING ;
@@ -838,7 +840,7 @@ static void con3215_flush(void)unsigned long flags; raw = raw3215[0 ];/* console 3215 is the first one */ -if (raw->flags &RAW3215_FROZEN ) +if (raw->port.flags &ASYNC_SUSPENDED )/* The console is still frozen for suspend. */ if (ccw_device_force_console ())/* Forcing didn't work, no panic message .. */
Signature · 1 line
1.7.9.2
PATCH 3/3 TTY: con3215, use tty from tty_port
In reply to Jiri SlabyObtain tty_struct only once in ISR and pass it down to raw3215_next_io. Other than that, we just use the tty with raised reference. And set it properly in open and close.
--- drivers/s390/char/con3215.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/s390/char/con3215.c +16 -16
@@ -83,7 +83,6 @@ struct raw3215_info {int head;/* first free byte in output buffer */ int count;/* number of bytes in output buffer */ int written;/* number of bytes in write requests */ -struct tty_struct *tty;/* pointer to tty structure if present */ struct raw3215_req *queued_read;/* pointer to queued read requests */ struct raw3215_req *queued_write;/* pointer to queued write requests */ struct tasklet_struct tlet;/* tasklet to invoke tty_wakeup */
@@ -343,11 +342,11 @@ static void raw3215_wakeup(unsigned long data)/* * Try to start the next IO and wake up processes waiting on the tty. */ -static void raw3215_next_io (struct raw3215_info *raw) +static void raw3215_next_io (struct raw3215_info *raw,struct tty_struct *tty) {raw3215_mk_write_req (raw);raw3215_try_io (raw); -if (raw->tty &&RAW3215_BUFFER_SIZE - raw->count >=RAW3215_MIN_SPACE ) +if (tty &&RAW3215_BUFFER_SIZE - raw->count >=RAW3215_MIN_SPACE )tasklet_schedule (&raw->tlet); }
@@ -365,10 +364,11 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm, raw =dev_get_drvdata (&cdev->dev); req = (struct raw3215_req *) intparm; + tty =tty_port_tty_get (&raw->port); cstat = irb->scsw.cmd.cstat; dstat = irb->scsw.cmd.dstat;if (cstat !=0 ) -raw3215_next_io (raw); +raw3215_next_io (raw, tty);if (dstat &0x01 ) {/* we got a unit exception */ dstat &= ~0x01 ;/* we can ignore it */ }
@@ -378,13 +378,13 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,break ;/* Attention interrupt, someone hit the enter key */ raw3215_mk_read_req (raw); -raw3215_next_io (raw); +raw3215_next_io (raw, tty);break ;case 0x08 :case 0x0C :/* Channel end interrupt. */ if ((raw = req->info) ==NULL ) -return ;/* That shouldn't happen ... */ + goto put_tty;/* That shouldn't happen ... */ if (req->type ==RAW3215_READ ) {/* store residual count, then wait for device end */ req->residual = irb->scsw.cmd.count;
@@ -394,11 +394,10 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,case 0x04 :/* Device end interrupt. */ if ((raw = req->info) ==NULL ) -return ;/* That shouldn't happen ... */ -if (req->type ==RAW3215_READ && raw->tty !=NULL ) { + goto put_tty;/* That shouldn't happen ... */ +if (req->type ==RAW3215_READ && tty !=NULL ) {unsigned int cchar; - tty = raw->tty; count =160 - req->residual;EBCASC (raw->inbuf, count); cchar =ctrlchar_handle (raw->inbuf, count, tty);
@@ -408,7 +407,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm,case CTRLCHAR_CTRL :tty_insert_flip_char (tty, cchar,TTY_NORMAL ); -tty_flip_buffer_push (raw->tty); +tty_flip_buffer_push (tty);break ;case CTRLCHAR_NONE :
@@ -421,7 +420,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm, }else count -=2 ;tty_insert_flip_string (tty, raw->inbuf, count); -tty_flip_buffer_push (raw->tty); +tty_flip_buffer_push (tty);break ; } }else if (req->type ==RAW3215_WRITE ) {
@@ -436,7 +435,7 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm, raw->queued_read == NULL) {wake_up_interruptible (&raw->empty_wait); } -raw3215_next_io (raw); +raw3215_next_io (raw, tty);break ;default :/* Strange interrupt, I'll do my best to clean up */
@@ -448,9 +447,10 @@ static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm, raw->flags &= ~RAW3215_WORKING ;raw3215_free_req (req); } -raw3215_next_io (raw); +raw3215_next_io (raw, tty); } -return ; +put_tty: +tty_kref_put (tty); }/*
@@ -946,7 +946,7 @@ static int tty3215_open(struct tty_struct *tty, struct file * filp)return -ENODEV ; tty->driver_data = raw; - raw->tty = tty; +tty_port_tty_set (&raw->port, tty); tty->low_latency =0 ;/* don't use bottom half for pushing chars */ /*
@@ -977,7 +977,7 @@ static void tty3215_close(struct tty_struct *tty, struct file * filp)raw3215_shutdown (raw);tasklet_kill (&raw->tlet); tty->closing =0 ; - raw->tty =NULL ; +tty_port_tty_set (&raw->port,NULL ); }/*
Signature · 1 line
1.7.9.2
PATCH 1/1 s390: fix build failure in con3215.c tty wakeup tasklet
Commit 86b26007a37d81e7aca242bb5b649473f8f81297 (tty-next)
"TTY: con3215, use tty from tty_port"
removed the tty struct from the raw struct, causing:
CC drivers/s390/char/con3215.odrivers/s390/char/con3215.c: In function 'raw3215_wakeup':drivers/s390/char/con3215.c:339:16: error: 'struct raw3215_info' has no member named 'tty' make[2]: *** [drivers/s390/char/con3215.o] Error 1
We can't simply add a tty to the args of raw3215_wakeup since it is registered as a tasklet. The flow is:
raw3215_irq --> tty_port_tty_get --> raw3215_next_io --> tasklet_schedule --> tty_kref_put
so it seems we'll need to do a get/put in the raw3215_wakeup tasklet as well.
drivers/s390/char/con3215.c +7 -1
@@ -336,7 +336,13 @@ static inline void raw3215_try_io(struct raw3215_info *raw)static void raw3215_wakeup (unsigned long data) {struct raw3215_info *raw = (struct raw3215_info *) data; -tty_wakeup (raw->tty); +struct tty_struct *tty =tty_port_tty_get (&raw->port); + +if (tty ==NULL ) +return ; + +tty_wakeup (tty); +tty_kref_put (tty); }/*
Signature · 1 line
1.7.9.1
Re: [PATCH] s390: fix build failure in con3215.c tty wakeup tasklet
Quoted 10 lines · Paul Gortmaker
Commit
86b26007a37d81e7aca242bb5b649473f8f81297(tty-next)"TTY: con3215, use tty from
tty_port"removed the tty struct from the raw struct, causing:
CC
drivers/s390/char/con3215.odrivers/s390/char/con3215.c: In function 'raw3215_wakeup':drivers/s390/char/con3215.c:339:16: error: 'structraw3215_info' has no member named 'tty' make[2]: *** [drivers/s390/char/con3215.o] Error 1
...
Quoted 6 lines
drivers/s390/char/con3215.c +0
-0@@ -336,7 +336,13 @@ static inline void raw3215_try_io(struct raw3215_info *raw)static void raw3215_wakeup (unsigned long data)
drivers/s390/char/con3215.c static inline void raw3215_try_io(struct raw3215_info *raw) · line 345
Quoted 10 lines
drivers/s390/char/con3215.c +7
-1{struct raw3215_info *raw = (struct raw3215_info *) data; -tty_wakeup (raw->tty); +struct tty_struct *tty =tty_port_tty_get (&raw->port); + +if (tty ==NULL ) +return ; + +tty_wakeup (tty); +tty_kref_put (tty);
Yep, I posted a similar patch earlier:
http://marc.info/?l=linux-next&m=133466152209052&w=2
The NULL check is not necessary, because "it cannot happen" ;)
Thanks,
Heiko
From: Jiri Slaby <[email protected]>
Date: Wed, 11 Apr 2012 11:14:57 +0200
Quoted 9 lines
It was marked as BROKEN back in 2008. It is because the tty handling in the driver is really broken.
There was some activity in January 2012 to fix the driver, but the patch was commented to be bogus:
https://lkml.org/lkml/2012/1/29/160
and we have not heard back from the author since then:
https://lkml.org/lkml/2012/3/28/412
Quoted 5 lines
So since nobody stepped in and rewrote the driver, it is time to move it out of line now. And drop it some time later if nobody comes up with patches to fix the driver in staging.
Signed-off-by Jiri Slaby <[email protected]>
No objections, I'll let the staging guy handle this :-)
Greg KH
maintainerQuoted 16 lines · David Miller
From: Jiri Slaby <[email protected]>
Date: Wed, 11 Apr 2012 11:14:57 +0200Quoted 13 lines
It was marked as BROKEN back in 2008. It is because the tty handling in the driver is really broken.
There was some activity in January 2012 to fix the driver, but the patch was commented to be bogus:
https://lkml.org/lkml/2012/1/29/160
and we have not heard back from the author since then:
https://lkml.org/lkml/2012/3/28/412So since nobody stepped in and rewrote the driver, it is time to move it out of line now. And drop it some time later if nobody comes up with patches to fix the driver in staging.
Quoted 5 lines
Quoted 1 line
Signed-off-by Jiri Slaby <[email protected]>No objections, I'll let the staging guy handle this :-)
Acked-by David S. Miller <[email protected]>
Thanks, I will :)