Commit 419ac9a6 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] callout removal: serial167

callout removal: serial167
parent ef5e4b0b
...@@ -97,12 +97,10 @@ ...@@ -97,12 +97,10 @@
#define STD_COM_FLAGS (0) #define STD_COM_FLAGS (0)
#define SERIAL_TYPE_NORMAL 1 #define SERIAL_TYPE_NORMAL 1
#define SERIAL_TYPE_CALLOUT 2
DECLARE_TASK_QUEUE(tq_cyclades); DECLARE_TASK_QUEUE(tq_cyclades);
struct tty_driver cy_serial_driver, cy_callout_driver; struct tty_driver cy_serial_driver;
extern int serial_console; extern int serial_console;
static struct cyclades_port *serial_console_info = NULL; static struct cyclades_port *serial_console_info = NULL;
static unsigned int serial_console_cflag = 0; static unsigned int serial_console_cflag = 0;
...@@ -517,8 +515,7 @@ cd2401_modem_interrupt(int irq, void *dev_id, struct pt_regs *fp) ...@@ -517,8 +515,7 @@ cd2401_modem_interrupt(int irq, void *dev_id, struct pt_regs *fp)
if(mdm_status & CyDCD){ if(mdm_status & CyDCD){
/* CP('!'); */ /* CP('!'); */
cy_sched_event(info, Cy_EVENT_OPEN_WAKEUP); cy_sched_event(info, Cy_EVENT_OPEN_WAKEUP);
}else if(!((info->flags & ASYNC_CALLOUT_ACTIVE) } else {
&&(info->flags & ASYNC_CALLOUT_NOHUP))){
/* CP('@'); */ /* CP('@'); */
cy_sched_event(info, Cy_EVENT_HANGUP); cy_sched_event(info, Cy_EVENT_HANGUP);
} }
...@@ -769,8 +766,7 @@ do_softint(void *private_) ...@@ -769,8 +766,7 @@ do_softint(void *private_)
if (test_and_clear_bit(Cy_EVENT_HANGUP, &info->event)) { if (test_and_clear_bit(Cy_EVENT_HANGUP, &info->event)) {
tty_hangup(info->tty); tty_hangup(info->tty);
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
info->flags &= ~(ASYNC_NORMAL_ACTIVE| info->flags &= ~ASYNC_NORMAL_ACTIVE;
ASYNC_CALLOUT_ACTIVE);
} }
if (test_and_clear_bit(Cy_EVENT_OPEN_WAKEUP, &info->event)) { if (test_and_clear_bit(Cy_EVENT_OPEN_WAKEUP, &info->event)) {
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
...@@ -1912,8 +1908,6 @@ cy_close(struct tty_struct * tty, struct file * filp) ...@@ -1912,8 +1908,6 @@ cy_close(struct tty_struct * tty, struct file * filp)
*/ */
if (info->flags & ASYNC_NORMAL_ACTIVE) if (info->flags & ASYNC_NORMAL_ACTIVE)
info->normal_termios = *tty->termios; info->normal_termios = *tty->termios;
if (info->flags & ASYNC_CALLOUT_ACTIVE)
info->callout_termios = *tty->termios;
if (info->flags & ASYNC_INITIALIZED) if (info->flags & ASYNC_INITIALIZED)
tty_wait_until_sent(tty, 3000); /* 30 seconds timeout */ tty_wait_until_sent(tty, 3000); /* 30 seconds timeout */
shutdown(info); shutdown(info);
...@@ -1938,8 +1932,7 @@ cy_close(struct tty_struct * tty, struct file * filp) ...@@ -1938,8 +1932,7 @@ cy_close(struct tty_struct * tty, struct file * filp)
} }
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
} }
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE| info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait); wake_up_interruptible(&info->close_wait);
#ifdef SERIAL_DEBUG_OTHER #ifdef SERIAL_DEBUG_OTHER
...@@ -1973,7 +1966,7 @@ cy_hangup(struct tty_struct *tty) ...@@ -1973,7 +1966,7 @@ cy_hangup(struct tty_struct *tty)
#endif #endif
info->tty = 0; info->tty = 0;
#endif #endif
info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CALLOUT_ACTIVE); info->flags &= ~ASYNC_NORMAL_ACTIVE;
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
} /* cy_hangup */ } /* cy_hangup */
...@@ -2008,36 +2001,11 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -2008,36 +2001,11 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
} }
} }
/*
* If this is a callout device, then just make sure the normal
* device isn't being used.
*/
if (tty->driver->subtype == SERIAL_TYPE_CALLOUT) {
if (info->flags & ASYNC_NORMAL_ACTIVE){
return -EBUSY;
}
if ((info->flags & ASYNC_CALLOUT_ACTIVE) &&
(info->flags & ASYNC_SESSION_LOCKOUT) &&
(info->session != current->session)){
return -EBUSY;
}
if ((info->flags & ASYNC_CALLOUT_ACTIVE) &&
(info->flags & ASYNC_PGRP_LOCKOUT) &&
(info->pgrp != current->pgrp)){
return -EBUSY;
}
info->flags |= ASYNC_CALLOUT_ACTIVE;
return 0;
}
/* /*
* If non-blocking mode is set, then make the check up front * If non-blocking mode is set, then make the check up front
* and then exit. * and then exit.
*/ */
if (filp->f_flags & O_NONBLOCK) { if (filp->f_flags & O_NONBLOCK) {
if (info->flags & ASYNC_CALLOUT_ACTIVE){
return -EBUSY;
}
info->flags |= ASYNC_NORMAL_ACTIVE; info->flags |= ASYNC_NORMAL_ACTIVE;
return 0; return 0;
} }
...@@ -2065,16 +2033,14 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -2065,16 +2033,14 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
while (1) { while (1) {
local_irq_save(flags); local_irq_save(flags);
if (!(info->flags & ASYNC_CALLOUT_ACTIVE)){ base_addr[CyCAR] = (u_char)channel;
base_addr[CyCAR] = (u_char)channel; base_addr[CyMSVR1] = CyRTS;
base_addr[CyMSVR1] = CyRTS;
/* CP('S');CP('4'); */ /* CP('S');CP('4'); */
base_addr[CyMSVR2] = CyDTR; base_addr[CyMSVR2] = CyDTR;
#ifdef SERIAL_DEBUG_DTR #ifdef SERIAL_DEBUG_DTR
printk("cyc: %d: raising DTR\n", __LINE__); printk("cyc: %d: raising DTR\n", __LINE__);
printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]); printk(" status: 0x%x, 0x%x\n", base_addr[CyMSVR1], base_addr[CyMSVR2]);
#endif #endif
}
local_irq_restore(flags); local_irq_restore(flags);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) if (tty_hung_up_p(filp)
...@@ -2089,8 +2055,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -2089,8 +2055,7 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
local_irq_save(flags); local_irq_save(flags);
base_addr[CyCAR] = (u_char)channel; base_addr[CyCAR] = (u_char)channel;
/* CP('L');CP1(1 && C_CLOCAL(tty)); CP1(1 && (base_addr[CyMSVR1] & CyDCD) ); */ /* CP('L');CP1(1 && C_CLOCAL(tty)); CP1(1 && (base_addr[CyMSVR1] & CyDCD) ); */
if (!(info->flags & ASYNC_CALLOUT_ACTIVE) if (!(info->flags & ASYNC_CLOSING)
&& !(info->flags & ASYNC_CLOSING)
&& (C_CLOCAL(tty) && (C_CLOCAL(tty)
|| (base_addr[CyMSVR1] & CyDCD))) { || (base_addr[CyMSVR1] & CyDCD))) {
local_irq_restore(flags); local_irq_restore(flags);
...@@ -2169,10 +2134,7 @@ cy_open(struct tty_struct *tty, struct file * filp) ...@@ -2169,10 +2134,7 @@ cy_open(struct tty_struct *tty, struct file * filp)
} }
if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) { if ((info->count == 1) && (info->flags & ASYNC_SPLIT_TERMIOS)) {
if (tty->driver->subtype == SERIAL_TYPE_NORMAL) *tty->termios = info->normal_termios;
*tty->termios = info->normal_termios;
else
*tty->termios = info->callout_termios;
} }
/* /*
* Start up serial port * Start up serial port
...@@ -2191,9 +2153,6 @@ cy_open(struct tty_struct *tty, struct file * filp) ...@@ -2191,9 +2153,6 @@ cy_open(struct tty_struct *tty, struct file * filp)
return retval; return retval;
} }
info->session = current->session;
info->pgrp = current->pgrp;
#ifdef SERIAL_DEBUG_OPEN #ifdef SERIAL_DEBUG_OPEN
printk("cy_open done\n");/**/ printk("cy_open done\n");/**/
#endif #endif
...@@ -2434,29 +2393,11 @@ scrn[1] = '\0'; ...@@ -2434,29 +2393,11 @@ scrn[1] = '\0';
cy_serial_driver.start = cy_start; cy_serial_driver.start = cy_start;
cy_serial_driver.hangup = cy_hangup; cy_serial_driver.hangup = cy_hangup;
/*
* The callout device is just like normal device except for
* major number and the subtype code.
*/
cy_callout_driver = cy_serial_driver;
#ifdef CONFIG_DEVFS_FS
cy_callout_driver.name = "cua/";
#else
cy_callout_driver.name = "cua";
#endif
cy_callout_driver.major = TTYAUX_MAJOR;
cy_callout_driver.subtype = SERIAL_TYPE_CALLOUT;
ret = tty_register_driver(&cy_serial_driver); ret = tty_register_driver(&cy_serial_driver);
if (ret) { if (ret) {
printk(KERN_ERR "Couldn't register MVME166/7 serial driver\n"); printk(KERN_ERR "Couldn't register MVME166/7 serial driver\n");
return ret; return ret;
} }
ret = tty_register_driver(&cy_callout_driver);
if (ret) {
printk(KERN_ERR "Couldn't register MVME166/7 callout driver\n");
goto cleanup_serial_driver;
}
init_bh(CYCLADES_BH, do_cyclades_bh); init_bh(CYCLADES_BH, do_cyclades_bh);
...@@ -2499,7 +2440,6 @@ scrn[1] = '\0'; ...@@ -2499,7 +2440,6 @@ scrn[1] = '\0';
info->default_timeout = 0; info->default_timeout = 0;
info->tqueue.routine = do_softint; info->tqueue.routine = do_softint;
info->tqueue.data = info; info->tqueue.data = info;
info->callout_termios =cy_callout_driver.init_termios;
info->normal_termios = cy_serial_driver.init_termios; info->normal_termios = cy_serial_driver.init_termios;
init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->open_wait);
init_waitqueue_head(&info->close_wait); init_waitqueue_head(&info->close_wait);
...@@ -2530,7 +2470,7 @@ scrn[1] = '\0'; ...@@ -2530,7 +2470,7 @@ scrn[1] = '\0';
"cd2401_errors", cd2401_rxerr_interrupt); "cd2401_errors", cd2401_rxerr_interrupt);
if (ret) { if (ret) {
printk(KERN_ERR "Could't get cd2401_errors IRQ"); printk(KERN_ERR "Could't get cd2401_errors IRQ");
goto cleanup_callout_driver; goto cleanup_serial_driver;
} }
ret = request_irq(MVME167_IRQ_SER_MODEM, cd2401_modem_interrupt, 0, ret = request_irq(MVME167_IRQ_SER_MODEM, cd2401_modem_interrupt, 0,
...@@ -2569,9 +2509,6 @@ scrn[1] = '\0'; ...@@ -2569,9 +2509,6 @@ scrn[1] = '\0';
free_irq(MVME167_IRQ_SER_MODEM, cd2401_modem_interrupt); free_irq(MVME167_IRQ_SER_MODEM, cd2401_modem_interrupt);
cleanup_irq_cd2401_errors: cleanup_irq_cd2401_errors:
free_irq(MVME167_IRQ_SER_ERR, cd2401_rxerr_interrupt); free_irq(MVME167_IRQ_SER_ERR, cd2401_rxerr_interrupt);
cleanup_callout_driver:
if (tty_unregister_driver(&cy_callout_driver))
printk(KERN_ERR "Couldn't unregister MVME166/7 callout driver\n");
cleanup_serial_driver: cleanup_serial_driver:
if (tty_unregister_driver(&cy_serial_driver)) if (tty_unregister_driver(&cy_serial_driver))
printk(KERN_ERR "Couldn't unregister MVME166/7 serial driver\n"); printk(KERN_ERR "Couldn't unregister MVME166/7 serial driver\n");
...@@ -2607,8 +2544,8 @@ show_status(int line_num) ...@@ -2607,8 +2544,8 @@ show_status(int line_num)
info->close_delay, info->event, info->count); info->close_delay, info->event, info->count);
printk(" x_char blocked_open = %x %x\n", printk(" x_char blocked_open = %x %x\n",
info->x_char, info->blocked_open); info->x_char, info->blocked_open);
printk(" session pgrp open_wait = %lx %lx %lx\n", printk(" open_wait = %lx %lx %lx\n",
info->session, info->pgrp, (long)info->open_wait); (long)info->open_wait);
local_irq_save(flags); local_irq_save(flags);
......
...@@ -43,8 +43,6 @@ struct cyclades_port { ...@@ -43,8 +43,6 @@ struct cyclades_port {
int x_char; /* to be pushed out ASAP */ int x_char; /* to be pushed out ASAP */
int x_break; int x_break;
int blocked_open; /* # of blocked opens */ int blocked_open; /* # of blocked opens */
long session; /* Session of opening process */
long pgrp; /* pgrp of opening process */
unsigned char *xmit_buf; unsigned char *xmit_buf;
int xmit_head; int xmit_head;
int xmit_tail; int xmit_tail;
...@@ -53,7 +51,6 @@ struct cyclades_port { ...@@ -53,7 +51,6 @@ struct cyclades_port {
int default_timeout; int default_timeout;
struct work_struct tqueue; struct work_struct tqueue;
struct termios normal_termios; struct termios normal_termios;
struct termios callout_termios;
wait_queue_head_t open_wait; wait_queue_head_t open_wait;
wait_queue_head_t close_wait; wait_queue_head_t close_wait;
struct cyclades_monitor mon; struct cyclades_monitor mon;
......
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