#define NR_PORTS 1 /* only one port for now */
-#define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? IRQF_SHARED : IRQF_DISABLED)
+#define IRQ_T(state) ((state->flags & ASYNC_SHARE_IRQ) ? IRQF_SHARED : IRQF_DISABLED)
static char *serial_name = "SimSerial driver";
static char *serial_version = "0.6";
static void shutdown(struct async_struct * info)
{
unsigned long flags;
- struct serial_state *state;
+ struct serial_state *state = info->state;
int retval;
- if (!(info->flags & ASYNC_INITIALIZED)) return;
-
- state = info->state;
+ if (!(state->flags & ASYNC_INITIALIZED))
+ return;
#ifdef SIMSERIAL_DEBUG
printk("Shutting down serial port %d (irq %d)....", info->line,
if (IRQ_ports[state->irq]) {
free_irq(state->irq, NULL);
retval = request_irq(state->irq, rs_interrupt_single,
- IRQ_T(info), "serial", NULL);
+ IRQ_T(state), "serial",
+ NULL);
if (retval)
printk(KERN_ERR "serial shutdown: request_irq: error %d"
if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags);
- info->flags &= ~ASYNC_INITIALIZED;
+ state->flags &= ~ASYNC_INITIALIZED;
}
local_irq_restore(flags);
}
local_irq_restore(flags);
return;
}
- info->flags |= ASYNC_CLOSING;
+ state->flags |= ASYNC_CLOSING;
local_irq_restore(flags);
/*
schedule_timeout_interruptible(info->close_delay);
wake_up_interruptible(&info->open_wait);
}
- info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
+ state->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
wake_up_interruptible(&info->close_wait);
}
printk("rs_hangup: called\n");
#endif
- state = info->state;
-
rs_flush_buffer(tty);
- if (info->flags & ASYNC_CLOSING)
+ if (state->flags & ASYNC_CLOSING)
return;
shutdown(info);
state->count = 0;
- info->flags &= ~ASYNC_NORMAL_ACTIVE;
+ state->flags &= ~ASYNC_NORMAL_ACTIVE;
info->tty = NULL;
wake_up_interruptible(&info->open_wait);
}
init_waitqueue_head(&info->open_wait);
init_waitqueue_head(&info->close_wait);
info->port = sstate->port;
- info->flags = sstate->flags;
info->xmit_fifo_size = sstate->xmit_fifo_size;
info->line = line;
info->state = sstate;
local_irq_save(flags);
- if (info->flags & ASYNC_INITIALIZED) {
+ if (state->flags & ASYNC_INITIALIZED) {
free_page(page);
goto errout;
}
} else
handler = rs_interrupt_single;
- retval = request_irq(state->irq, handler, IRQ_T(info), "simserial", NULL);
+ retval = request_irq(state->irq, handler, IRQ_T(state),
+ "simserial", NULL);
if (retval)
goto errout;
}
* Set up the tty->alt_speed kludge
*/
if (info->tty) {
- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
+ if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
info->tty->alt_speed = 57600;
- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
+ if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
info->tty->alt_speed = 115200;
- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
+ if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
info->tty->alt_speed = 230400;
- if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
+ if ((state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
info->tty->alt_speed = 460800;
}
- info->flags |= ASYNC_INITIALIZED;
+ state->flags |= ASYNC_INITIALIZED;
local_irq_restore(flags);
return 0;
#ifdef SIMSERIAL_DEBUG
printk("rs_open %s, count = %d\n", tty->name, info->state->count);
#endif
- info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+ info->tty->low_latency = (info->state->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
if (!tmp_buf) {
page = get_zeroed_page(GFP_KERNEL);
* If the port is the middle of closing, bail out now
*/
if (tty_hung_up_p(filp) ||
- (info->flags & ASYNC_CLOSING)) {
- if (info->flags & ASYNC_CLOSING)
+ (info->state->flags & ASYNC_CLOSING)) {
+ if (info->state->flags & ASYNC_CLOSING)
interruptible_sleep_on(&info->close_wait);
#ifdef SERIAL_DO_RESTART
- return ((info->flags & ASYNC_HUP_NOTIFY) ?
+ return ((info->state->flags & ASYNC_HUP_NOTIFY) ?
-EAGAIN : -ERESTARTSYS);
#else
return -EAGAIN;