struct tty_driver *hp_simserial_driver;
-static struct async_struct *IRQ_ports[NR_IRQS];
-
static struct console *console;
static unsigned char *tmp_buf;
*/
static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
{
- struct async_struct * info;
+ struct async_struct *info = dev_id;
- /*
- * I don't know exactly why they don't use the dev_id opaque data
- * pointer instead of this extra lookup table
- */
- info = IRQ_ports[irq];
- if (!info || !info->tty) {
+ if (!info->tty) {
printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info);
return IRQ_NONE;
}
{
unsigned long flags;
struct serial_state *state = info->state;
- int retval;
if (!(state->flags & ASYNC_INITIALIZED))
return;
local_irq_save(flags);
{
- /*
- * First unlink the serial port from the IRQ chain...
- */
- if (info->next_port)
- info->next_port->prev_port = info->prev_port;
- if (info->prev_port)
- info->prev_port->next_port = info->next_port;
- else
- IRQ_ports[state->irq] = info->next_port;
-
- /*
- * Free the IRQ, if necessary
- */
- if (state->irq && (!IRQ_ports[state->irq] ||
- !IRQ_ports[state->irq]->next_port)) {
- if (IRQ_ports[state->irq]) {
- free_irq(state->irq, NULL);
- retval = request_irq(state->irq, rs_interrupt_single,
- IRQ_T(state), "serial",
- NULL);
-
- if (retval)
- printk(KERN_ERR "serial shutdown: request_irq: error %d"
- " Couldn't reacquire IRQ.\n", retval);
- } else
- free_irq(state->irq, NULL);
- }
+ if (state->irq)
+ free_irq(state->irq, info);
if (info->xmit.buf) {
free_page((unsigned long) info->xmit.buf);
{
unsigned long flags;
int retval=0;
- irq_handler_t handler;
struct serial_state *state= info->state;
unsigned long page;
/*
* Allocate the IRQ if necessary
*/
- if (state->irq && (!IRQ_ports[state->irq] ||
- !IRQ_ports[state->irq]->next_port)) {
- if (IRQ_ports[state->irq]) {
- retval = -EBUSY;
- goto errout;
- } else
- handler = rs_interrupt_single;
-
- retval = request_irq(state->irq, handler, IRQ_T(state),
- "simserial", NULL);
+ if (state->irq) {
+ retval = request_irq(state->irq, rs_interrupt_single,
+ IRQ_T(state), "simserial", info);
if (retval)
goto errout;
}
- /*
- * Insert serial port into IRQ chain.
- */
- info->prev_port = NULL;
- info->next_port = IRQ_ports[state->irq];
- if (info->next_port)
- info->next_port->prev_port = info;
- IRQ_ports[state->irq] = info;
-
if (info->tty) clear_bit(TTY_IO_ERROR, &info->tty->flags);
info->xmit.head = info->xmit.tail = 0;