From 4efdef565f9a0ca3468534f97c6ac4aaaf747c9a Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 27 Sep 2008 08:51:18 +0000 Subject: 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 --- sys/pc98/cbus/olpt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sys/pc98/cbus/olpt.c') diff --git a/sys/pc98/cbus/olpt.c b/sys/pc98/cbus/olpt.c index f0d0da7..f86cf12 100644 --- a/sys/pc98/cbus/olpt.c +++ b/sys/pc98/cbus/olpt.c @@ -381,7 +381,7 @@ lptopen (struct cdev *dev, int flags, int fmt, struct thread *td) int s; int port; - sc = devclass_get_softc(olpt_devclass, LPTUNIT(minor(dev))); + sc = devclass_get_softc(olpt_devclass, LPTUNIT(dev2unit(dev))); if (sc->sc_port == 0) return (ENXIO); @@ -391,7 +391,7 @@ lptopen (struct cdev *dev, int flags, int fmt, struct thread *td) } else sc->sc_state |= INIT; - sc->sc_flags = LPTFLAGS(minor(dev)); + sc->sc_flags = LPTFLAGS(dev2unit(dev)); /* Check for open with BYPASS flag set. */ if (sc->sc_flags & LP_BYPASS) { @@ -469,7 +469,7 @@ lptclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct lpt_softc *sc; - sc = devclass_get_softc(olpt_devclass, LPTUNIT(minor(dev))); + sc = devclass_get_softc(olpt_devclass, LPTUNIT(dev2unit(dev))); if(sc->sc_flags & LP_BYPASS) goto end_close; @@ -558,7 +558,7 @@ lptwrite(struct cdev *dev, struct uio * uio, int ioflag) int pl, err; struct lpt_softc *sc; - sc = devclass_get_softc(olpt_devclass, LPTUNIT(minor(dev))); + sc = devclass_get_softc(olpt_devclass, LPTUNIT(dev2unit(dev))); if(sc->sc_flags & LP_BYPASS) { /* we can't do writes in bypass mode */ return(EPERM); @@ -614,7 +614,7 @@ lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t { int error = 0; struct lpt_softc *sc; - u_int unit = LPTUNIT(minor(dev)); + u_int unit = LPTUNIT(dev2unit(dev)); u_char old_sc_irq; /* old printer IRQ status */ sc = devclass_get_softc(olpt_devclass, unit); -- cgit v1.1