diff options
author | ed <ed@FreeBSD.org> | 2008-09-27 08:51:18 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2008-09-27 08:51:18 +0000 |
commit | 4efdef565f9a0ca3468534f97c6ac4aaaf747c9a (patch) | |
tree | dd0035910760a440d495b23940f57a42ed24ca85 /sys/dev/usb | |
parent | d720932e5974ce75bf983cc61010a6eb70f94b86 (diff) | |
download | FreeBSD-src-4efdef565f9a0ca3468534f97c6ac4aaaf747c9a.zip FreeBSD-src-4efdef565f9a0ca3468534f97c6ac4aaaf747c9a.tar.gz |
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
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/ucomvar.h | 6 | ||||
-rw-r--r-- | sys/dev/usb/ufm.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/ugen.c | 4 | ||||
-rw-r--r-- | sys/dev/usb/uhid.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/ulpt.c | 4 | ||||
-rw-r--r-- | sys/dev/usb/ums.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/urio.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/usb.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/uscanner.c | 2 |
9 files changed, 13 insertions, 13 deletions
diff --git a/sys/dev/usb/ucomvar.h b/sys/dev/usb/ucomvar.h index 32d7c04..0fcd7f3 100644 --- a/sys/dev/usb/ucomvar.h +++ b/sys/dev/usb/ucomvar.h @@ -82,9 +82,9 @@ #define UCOMDIALOUT_MASK 0x80000 #define UCOMCALLUNIT_MASK 0x40000 -#define UCOMUNIT(x) (minor(x) & UCOMUNIT_MASK) -#define UCOMDIALOUT(x) (minor(x) & UCOMDIALOUT_MASK) -#define UCOMCALLUNIT(x) (minor(x) & UCOMCALLUNIT_MASK) +#define UCOMUNIT(x) (dev2unit(x) & UCOMUNIT_MASK) +#define UCOMDIALOUT(x) (dev2unit(x) & UCOMDIALOUT_MASK) +#define UCOMCALLUNIT(x) (dev2unit(x) & UCOMCALLUNIT_MASK) #define UCOM_UNK_PORTNO -1 /* XXX */ diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c index 9eaf49720..2635827 100644 --- a/sys/dev/usb/ufm.c +++ b/sys/dev/usb/ufm.c @@ -96,7 +96,7 @@ struct ufm_softc { int sc_refcnt; }; -#define UFMUNIT(n) (minor(n)) +#define UFMUNIT(n) (dev2unit(n)) static device_probe_t ufm_match; static device_attach_t ufm_attach; diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 4856919..77ea2ef 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -182,8 +182,8 @@ static usb_config_descriptor_t *ugen_get_cdesc(struct ugen_softc *sc, static usbd_status ugen_set_interface(struct ugen_softc *, int, int); static int ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx); -#define UGENUNIT(n) ((minor(n) >> 4) & 0xf) -#define UGENENDPOINT(n) (minor(n) & 0xf) +#define UGENUNIT(n) ((dev2unit(n) >> 4) & 0xf) +#define UGENENDPOINT(n) (dev2unit(n) & 0xf) #define UGENMINOR(u, e) (((u) << 4) | (e)) static device_probe_t ugen_match; diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 44e8349..d821c01 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -137,7 +137,7 @@ struct uhid_softc { struct cdev *dev; }; -#define UHIDUNIT(dev) (minor(dev)) +#define UHIDUNIT(dev) (dev2unit(dev)) #define UHID_CHUNK 128 /* chunk size for read */ #define UHID_BSIZE 1020 /* buffer size */ diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 909aa28..99a1433 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -163,8 +163,8 @@ void ulpt_tick(void *xsc); void ieee1284_print_id(char *); #endif -#define ULPTUNIT(s) (minor(s) & 0x1f) -#define ULPTFLAGS(s) (minor(s) & 0xe0) +#define ULPTUNIT(s) (dev2unit(s) & 0x1f) +#define ULPTFLAGS(s) (dev2unit(s) & 0xe0) static device_probe_t ulpt_match; static device_attach_t ulpt_attach; diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index a869f75..6484303 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -81,7 +81,7 @@ SYSCTL_INT(_hw_usb_ums, OID_AUTO, debug, CTLFLAG_RW, #define DPRINTFN(n,x) #endif -#define UMSUNIT(s) (minor(s)&0x1f) +#define UMSUNIT(s) (dev2unit(s)&0x1f) #define MS_TO_TICKS(ms) ((ms) * hz / 1000) diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 01e276a..5f69918 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -126,7 +126,7 @@ struct urio_softc { u_char sc_dying; }; -#define URIOUNIT(n) (minor(n)) +#define URIOUNIT(n) (dev2unit(n)) #define RIO_RW_TIMEOUT 4000 /* ms */ diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 0cbf6bd..b1b7d44 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$"); #include <dev/usb/usbdi.h> #include <dev/usb/usbdi_util.h> -#define USBUNIT(d) (minor(d)) /* usb_discover device nodes, kthread */ +#define USBUNIT(d) (dev2unit(d)) /* usb_discover device nodes, kthread */ #define USB_DEV_MINOR 255 /* event queue device */ MALLOC_DEFINE(M_USB, "USB", "USB"); diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index 4c42f46..0f3293a 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -293,7 +293,7 @@ static int uscanner_do_read(struct uscanner_softc *, struct uio *, int); static int uscanner_do_write(struct uscanner_softc *, struct uio *, int); static void uscanner_do_close(struct uscanner_softc *); -#define USCANNERUNIT(n) (minor(n)) +#define USCANNERUNIT(n) (dev2unit(n)) static device_probe_t uscanner_match; static device_attach_t uscanner_attach; |