/*****************************************************************************/
+static DEFINE_MUTEX(stl_brdslock);
static struct stlbrd *stl_brds[STL_MAXBRDS];
/*
goto err;
}
- stl_brds[brdp->brdnr] = brdp;
if ((brdp->state & BRD_FOUND) == 0) {
printk("STALLION: %s board not found, board=%d io=%x irq=%d\n",
stl_brdnames[brdp->brdtype], brdp->brdnr,
release_region(brdp->ioaddr1, brdp->iosize1);
if (brdp->iosize2 > 0)
release_region(brdp->ioaddr2, brdp->iosize2);
-
- stl_brds[brdp->brdnr] = NULL;
err:
return retval;
}
retval = -ENOMEM;
goto err;
}
+ mutex_lock(&stl_brdslock);
brdp->brdnr = stl_getbrdnr();
if (brdp->brdnr < 0) {
dev_err(&pdev->dev, "too many boards found, "
"maximum supported %d\n", STL_MAXBRDS);
+ mutex_unlock(&stl_brdslock);
goto err_fr;
}
+ stl_brds[brdp->brdnr] = brdp;
+ mutex_unlock(&stl_brdslock);
+
brdp->brdtype = brdtype;
brdp->state |= STL_PROBED;
brdp->irq = pdev->irq;
retval = stl_brdinit(brdp);
if (retval)
- goto err_fr;
+ goto err_null;
pci_set_drvdata(pdev, brdp);
return 0;
+err_null:
+ stl_brds[brdp->brdnr] = NULL;
err_fr:
kfree(brdp);
err:
brdp->irqtype = conf.irqtype;
if (stl_brdinit(brdp))
kfree(brdp);
- else
+ else {
+ stl_brds[brdp->brdnr] = brdp;
stl_nrbrds = i + 1;
+ }
}
+ /* this has to be _after_ isa finding because of locking */
retval = pci_register_driver(&stl_pcidriver);
if (retval && stl_nrbrds == 0)
goto err;