svn commit: r184164 - head/sys/dev/ppbus
Ed Schouten
ed at 80386.nl
Wed Oct 22 17:08:07 UTC 2008
Hi John,
It seems I forgot to CC my message to you, so I'll just stick it to to
the commit message as well. Sorry.
* John Baldwin <jhb at FreeBSD.org> wrote:
> Modified: head/sys/dev/ppbus/lpt.c
> ==============================================================================
> --- head/sys/dev/ppbus/lpt.c Wed Oct 22 14:58:23 2008 (r184163)
> +++ head/sys/dev/ppbus/lpt.c Wed Oct 22 15:00:22 2008 (r184164)
> @@ -399,7 +399,7 @@ lpt_attach(device_t dev)
> sc->cdev_bypass = make_dev(&lpt_cdevsw, unit,
> UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d.ctl", unit);
> sc->cdev_bypass->si_drv1 = sc;
> - sc->cdev_bypass->si_drv2 = LP_BYPASS;
> + sc->cdev_bypass->si_drv2 = (void *)LP_BYPASS;
> return (0);
> }
>
> @@ -476,7 +476,7 @@ lptopen(struct cdev *dev, int flags, int
> } else
> sc->sc_state |= LPTINIT;
>
> - sc->sc_flags = dev->si_drv2;
> + sc->sc_flags = (uintptr_t)dev->si_drv2;
>
> /* Check for open with BYPASS flag set. */
> if (sc->sc_flags & LP_BYPASS) {
Maybe it's better to just use the device unit number to store these
flags? This value is stored inside si_drv0, which is an integer.
Hopefully we'll get rid of make_dev()'s unit number argument somewhere
in the far future, which means drivers can use si_drv0 directly.
I sent the following patch to current@ this morning:
--- sys/dev/ppbus/lpt.c
+++ sys/dev/ppbus/lpt.c
@@ -392,14 +392,12 @@
lpt_release_ppbus(dev);
sc->dev = dev;
- sc->cdev = make_dev(&lpt_cdevsw, unit,
+ sc->cdev = make_dev(&lpt_cdevsw, 0,
UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d", unit);
sc->cdev->si_drv1 = sc;
- sc->cdev->si_drv2 = 0;
- sc->cdev_bypass = make_dev(&lpt_cdevsw, unit,
+ sc->cdev_bypass = make_dev(&lpt_cdevsw, LP_BYPASS,
UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d.ctl", unit);
sc->cdev_bypass->si_drv1 = sc;
- sc->cdev_bypass->si_drv2 = LP_BYPASS;
return (0);
}
@@ -476,7 +474,7 @@
} else
sc->sc_state |= LPTINIT;
- sc->sc_flags = dev->si_drv2;
+ sc->sc_flags = dev2unit(dev);
/* Check for open with BYPASS flag set. */
if (sc->sc_flags & LP_BYPASS) {
--
Ed Schouten <ed at 80386.nl>
WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20081022/ab502a86/attachment.pgp
More information about the svn-src-head
mailing list