diff options
author | ed <ed@FreeBSD.org> | 2008-05-29 12:50:46 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2008-05-29 12:50:46 +0000 |
commit | 5de6a45e07a5027a8c6df5a9c354fbfd9c76aec1 (patch) | |
tree | ca425ff2b259e162d9f380346730fb449b867997 /sys/dev/led/led.c | |
parent | 68f17e9b6872a274fd98ed5d52f202e5157b39df (diff) | |
download | FreeBSD-src-5de6a45e07a5027a8c6df5a9c354fbfd9c76aec1.zip FreeBSD-src-5de6a45e07a5027a8c6df5a9c354fbfd9c76aec1.tar.gz |
Remove the distinction between device minor and unit numbers.
Even though we got rid of device major numbers some time ago, device
drivers still need to provide unique device minor numbers to make_dev().
These numbers are only used inside the kernel. They are not related to
device major and minor numbers which are visible in devfs. These are
actually based on the inode number of the device.
It would eventually be nice to remove minor numbers entirely, but we
don't want to be too agressive here.
Because the 8-15 bits of the device number field (si_drv0) are still
reserved for the major number, there is no 1:1 mapping of the device
minor and unit numbers. Because this is now unused, remove the
restrictions on these numbers.
The MAXMAJOR definition was actually used for two purposes. It was used
to convert both the userspace and kernelspace device numbers to their
major/minor pair, which is why it is now named UMINORMASK.
minor2unit() and unit2minor() have now become useless. Both minor() and
dev2unit() now serve the same purpose. We should eventually remove some
of them, at least turning them into macro's. If devfs would become
completely minor number unaware, we could consider using si_drv0 directly,
just like si_drv1 and si_drv2.
Approved by: philip (mentor)
Diffstat (limited to 'sys/dev/led/led.c')
-rw-r--r-- | sys/dev/led/led.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/led/led.c b/sys/dev/led/led.c index b9aae50..73af18a 100644 --- a/sys/dev/led/led.c +++ b/sys/dev/led/led.c @@ -15,6 +15,7 @@ __FBSDID("$FreeBSD$"); #include <sys/conf.h> #include <sys/kernel.h> #include <sys/systm.h> +#include <sys/limits.h> #include <sys/malloc.h> #include <sys/ctype.h> #include <sys/sbuf.h> @@ -298,7 +299,7 @@ static void led_drvinit(void *unused) { - led_unit = new_unrhdr(0, minor2unit(MAXMINOR), NULL); + led_unit = new_unrhdr(0, INT_MAX, NULL); mtx_init(&led_mtx, "LED mtx", NULL, MTX_DEF); sx_init(&led_sx, "LED sx"); callout_init(&led_ch, CALLOUT_MPSAFE); |