diff options
author | sos <sos@FreeBSD.org> | 2000-05-26 13:59:05 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2000-05-26 13:59:05 +0000 |
commit | c356d44517cddb13eaa427eb4e80bddd411bb1d9 (patch) | |
tree | f11dedf4cdcd6a87f58233a1ce7645a652280a8e /sys | |
parent | 0eb0bb6777534bbb9dd3aac1d82ae83306648b43 (diff) | |
download | FreeBSD-src-c356d44517cddb13eaa427eb4e80bddd411bb1d9.zip FreeBSD-src-c356d44517cddb13eaa427eb4e80bddd411bb1d9.tar.gz |
If devclass_alloc_unit() is called with a wired unit #, and this is
buzy, only search upwards for a free slot to use..
This broke unit numbering on ATA systems where PCI attached controllers
come before the mainboard ones...
Reviewed by: dfr
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_bus.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index ddd1e4f..ffade19 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -350,27 +350,22 @@ devclass_alloc_unit(devclass_t dc, int *unitp) PDEBUG(("unit %d in devclass %s", unit, DEVCLANAME(dc))); - /* - * If we have been given a wired unit number, check for existing - * device. - */ + /* If we have been given a wired unit number, check for existing device */ if (unit != -1) { if (unit >= 0 && unit < dc->maxunit && dc->devices[unit] != NULL) { if (bootverbose) printf("%s-: %s%d exists, using next available unit number\n", dc->name, dc->name, unit); - unit = -1; + /* find the next available slot */ + while (++unit < dc->maxunit && dc->devices[unit] != NULL) + ; } } - - /* - * We ended up with an unwired device, so let's find the next available - * slot for it. - */ - if (unit == -1) { + else { + /* Unwired device, find the next available slot for it */ unit = 0; while (unit < dc->maxunit && dc->devices[unit] != NULL) - unit++; + unit++; } /* |