Commit ec9e8eb6 authored by William Stinson's avatar William Stinson Committed by Jeff Garzik

Janitor: request_region cleanups for stallion serial driver

parent bc14d0aa
...@@ -2402,16 +2402,23 @@ static inline int stl_initeio(stlbrd_t *brdp) ...@@ -2402,16 +2402,23 @@ static inline int stl_initeio(stlbrd_t *brdp)
brdp->ioctrl); brdp->ioctrl);
} }
if (check_region(brdp->ioaddr1, brdp->iosize1)) { if (!request_region(brdp->ioaddr1, brdp->iosize1, name)) {
printk("STALLION: Warning, board %d I/O address %x conflicts " printk(KERN_WARNING "STALLION: Warning, board %d I/O address "
"with another device\n", brdp->brdnr, brdp->ioaddr1); "%x conflicts with another device\n", brdp->brdnr,
} brdp->ioaddr1);
if (brdp->iosize2 > 0) { return(-EBUSY);
if (check_region(brdp->ioaddr2, brdp->iosize2)) {
printk("STALLION: Warning, board %d I/O address %x "
"conflicts with another device\n",
brdp->brdnr, brdp->ioaddr2);
} }
if (brdp->iosize2 > 0)
if (!request_region(brdp->ioaddr2, brdp->iosize2, name)) {
printk(KERN_WARNING "STALLION: Warning, board %d I/O "
"address %x conflicts with another device\n",
brdp->brdnr, brdp->ioaddr2);
printk(KERN_WARNING "STALLION: Warning, also "
"releasing board %d I/O address %x \n",
brdp->brdnr, brdp->ioaddr1);
release_region(brdp->ioaddr1, brdp->iosize1);
return(-EBUSY);
} }
/* /*
...@@ -2454,14 +2461,11 @@ static inline int stl_initeio(stlbrd_t *brdp) ...@@ -2454,14 +2461,11 @@ static inline int stl_initeio(stlbrd_t *brdp)
* We have verfied that the board is actually present, so now we * We have verfied that the board is actually present, so now we
* can complete the setup. * can complete the setup.
*/ */
request_region(brdp->ioaddr1, brdp->iosize1, name);
if (brdp->iosize2 > 0)
request_region(brdp->ioaddr2, brdp->iosize2, name);
panelp = (stlpanel_t *) stl_memalloc(sizeof(stlpanel_t)); panelp = (stlpanel_t *) stl_memalloc(sizeof(stlpanel_t));
if (panelp == (stlpanel_t *) NULL) { if (panelp == (stlpanel_t *) NULL) {
printk("STALLION: failed to allocate memory (size=%d)\n", printk(KERN_WARNING "STALLION: failed to allocate memory "
sizeof(stlpanel_t)); "(size=%d)\n", sizeof(stlpanel_t));
return(-ENOMEM); return(-ENOMEM);
} }
memset(panelp, 0, sizeof(stlpanel_t)); memset(panelp, 0, sizeof(stlpanel_t));
...@@ -2585,22 +2589,27 @@ static int inline stl_initech(stlbrd_t *brdp) ...@@ -2585,22 +2589,27 @@ static int inline stl_initech(stlbrd_t *brdp)
} }
/* /*
* Check boards for possible IO address conflicts. We won't actually * Check boards for possible IO address conflicts and return fail status
* do anything about it here, just issue a warning... * if an IO conflict found.
*/ */
conflict = check_region(brdp->ioaddr1, brdp->iosize1) ? if (!request_region(brdp->ioaddr1, brdp->iosize1, name)) {
brdp->ioaddr1 : 0; printk(KERN_WARNING "STALLION: Warning, board %d I/O address "
if ((conflict == 0) && (brdp->iosize2 > 0)) "%x conflicts with another device\n", brdp->brdnr,
conflict = check_region(brdp->ioaddr2, brdp->iosize2) ? brdp->ioaddr1);
brdp->ioaddr2 : 0; return(-EBUSY);
if (conflict) {
printk("STALLION: Warning, board %d I/O address %x conflicts "
"with another device\n", brdp->brdnr, conflict);
} }
request_region(brdp->ioaddr1, brdp->iosize1, name);
if (brdp->iosize2 > 0) if (brdp->iosize2 > 0)
request_region(brdp->ioaddr2, brdp->iosize2, name); if (!request_region(brdp->ioaddr2, brdp->iosize2, name)) {
printk(KERN_WARNING "STALLION: Warning, board %d I/O "
"address %x conflicts with another device\n",
brdp->brdnr, brdp->ioaddr2);
printk(KERN_WARNING "STALLION: Warning, also "
"releasing board %d I/O address %x \n",
brdp->brdnr, brdp->ioaddr1);
release_region(brdp->ioaddr1, brdp->iosize1);
return(-EBUSY);
}
/* /*
* Scan through the secondary io address space looking for panels. * Scan through the secondary io address space looking for panels.
......
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