static struct tty_driver *sx_driver;
+static DEFINE_MUTEX(sx_boards_lock);
static struct sx_board boards[SX_NBOARDS];
static struct sx_port *sx_ports;
static int sx_initialized;
}
if (chans) {
- /* board->flags |= SX_BOARD_PRESENT; */
if(board->irq > 0) {
/* fixed irq, probably PCI */
if(sx_irqmask & (1 << board->irq)) { /* may we use this irq? */
return 0;
sx_dprintk (SX_DEBUG_INIT, "reset the board...\n");
- board->flags |= SX_BOARD_PRESENT;
-
func_exit();
return 1;
}
return 0;
sx_dprintk (SX_DEBUG_INIT, "reset the board...\n");
- board->flags |= SX_BOARD_PRESENT;
-
func_exit();
return 1;
}
unsigned int i;
int retval = -EIO;
+ mutex_lock(&sx_boards_lock);
i = sx_find_free_board();
-
- if (i == SX_NBOARDS)
+ if (i == SX_NBOARDS) {
+ mutex_unlock(&sx_boards_lock);
goto err;
+ }
+ board = &boards[i];
+ board->flags |= SX_BOARD_PRESENT;
+ mutex_unlock(&sx_boards_lock);
dev_info(dev, "XIO : Signature found in EISA slot %lu, "
"Product %d Rev %d (REPORT THIS TO LKLM)\n",
inb(eisa_slot + EISA_VENDOR_ID_OFFSET + 2),
inb(eisa_slot + EISA_VENDOR_ID_OFFSET + 3));
- board = &boards[i];
board->eisa_base = eisa_slot;
board->flags &= ~SX_BOARD_TYPE;
board->flags |= SI_EISA_BOARD;
return 0;
err_unmap:
iounmap(board->base);
+ board->flags &= ~SX_BOARD_PRESENT;
err:
return retval;
}
unsigned int i;
int retval = -EIO;
+ mutex_lock(&sx_boards_lock);
i = sx_find_free_board();
-
- if (i == SX_NBOARDS)
+ if (i == SX_NBOARDS) {
+ mutex_unlock(&sx_boards_lock);
goto err;
+ }
+ board = &boards[i];
+ board->flags |= SX_BOARD_PRESENT;
+ mutex_unlock(&sx_boards_lock);
retval = pci_enable_device(pdev);
if (retval)
- goto err;
-
- board = &boards[i];
+ goto err_flag;
board->flags &= ~SX_BOARD_TYPE;
board->flags |= (pdev->subsystem_vendor == 0x200) ? SX_PCI_BOARD :
board->base = ioremap(board->hw_base, WINDOW_LEN (board));
if (!board->base) {
dev_err(&pdev->dev, "ioremap failed\n");
- goto err;
+ goto err_flag;
}
/* Most of the stuff on the CF board is offset by 0x18000 .... */
return 0;
err_unmap:
iounmap(board->base2);
+err_flag:
+ board->flags &= ~SX_BOARD_PRESENT;
err:
return retval;
}
board->irq = sx_irqmask?-1:0;
if (probe_sx (board)) {
+ board->flags |= SX_BOARD_PRESENT;
found++;
} else {
iounmap(board->base);
board->irq = sx_irqmask ?-1:0;
if (probe_si (board)) {
+ board->flags |= SX_BOARD_PRESENT;
found++;
} else {
iounmap (board->base);
board->irq = sx_irqmask ?-1:0;
if (probe_si (board)) {
+ board->flags |= SX_BOARD_PRESENT;
found++;
} else {
iounmap (board->base);