diff options
author | Ed Schouten <ed@FreeBSD.org> | 2008-09-27 08:51:18 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2008-09-27 08:51:18 +0000 |
commit | 6bfa9a2d66dd0e00182017d6741d44e54d0b2cca (patch) | |
tree | dd0035910760a440d495b23940f57a42ed24ca85 /sys/kern/kern_conf.c | |
parent | 45cfb1dc538113eab50616b88da908b1bb728561 (diff) | |
download | src-6bfa9a2d66dd0e00182017d6741d44e54d0b2cca.tar.gz src-6bfa9a2d66dd0e00182017d6741d44e54d0b2cca.zip |
Replace all calls to minor() with dev2unit().
After I removed all the unit2minor()/minor2unit() calls from the kernel
yesterday, I realised calling minor() everywhere is quite confusing.
Character devices now only have the ability to store a unit number, not
a minor number. Remove the confusion by using dev2unit() everywhere.
This commit could also be considered as a bug fix. A lot of drivers call
minor(), while they should actually be calling dev2unit(). In -CURRENT
this isn't a problem, but it turns out we never had any problem reports
related to that issue in the past. I suspect not many people connect
more than 256 pieces of the same hardware.
Reviewed by: kib
Notes
Notes:
svn path=/head/; revision=183397
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r-- | sys/kern/kern_conf.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index daf7e0c6bfa2..98bae8878423 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -674,7 +674,7 @@ make_dev_credv(int flags, struct cdevsw *devsw, int unit, } KASSERT(!(dev->si_flags & SI_NAMED), ("make_dev() by driver %s on pre-existing device (min=%x, name=%s)", - devsw->d_name, minor(dev), devtoname(dev))); + devsw->d_name, dev2unit(dev), devtoname(dev))); i = vsnrprintf(dev->__si_namebuf, sizeof dev->__si_namebuf, 32, fmt, ap); if (i > (sizeof dev->__si_namebuf - 1)) { @@ -800,7 +800,7 @@ destroy_devl(struct cdev *dev) mtx_assert(&devmtx, MA_OWNED); KASSERT(dev->si_flags & SI_NAMED, - ("WARNING: Driver mistake: destroy_dev on %d\n", minor(dev))); + ("WARNING: Driver mistake: destroy_dev on %d\n", dev2unit(dev))); devfs_destroy(dev); @@ -896,7 +896,7 @@ devtoname(struct cdev *dev) dev_relthread(dev); } p += strlen(p); - mynor = minor(dev); + mynor = dev2unit(dev); if (mynor < 0 || mynor > 255) sprintf(p, "/%#x", (u_int)mynor); else |