From owner-svn-src-head@FreeBSD.ORG Tue Apr 14 11:23:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BB94106564A; Tue, 14 Apr 2009 11:23:10 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FA8A8FC29; Tue, 14 Apr 2009 11:23:10 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3EBN9DS004481; Tue, 14 Apr 2009 11:23:09 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3EBN9sL004480; Tue, 14 Apr 2009 11:23:09 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904141123.n3EBN9sL004480@svn.freebsd.org> From: Ed Schouten Date: Tue, 14 Apr 2009 11:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191054 - head/sys/dev/joy X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2009 11:23:10 -0000 Author: ed Date: Tue Apr 14 11:23:09 2009 New Revision: 191054 URL: http://svn.freebsd.org/changeset/base/191054 Log: Use si_drv1 to store joy(4)'s softc. There are still some calls to dev2unit() left, but I guess we should take care of those another time. Modified: head/sys/dev/joy/joy.c Modified: head/sys/dev/joy/joy.c ============================================================================== --- head/sys/dev/joy/joy.c Tue Apr 14 10:55:20 2009 (r191053) +++ head/sys/dev/joy/joy.c Tue Apr 14 11:23:09 2009 (r191054) @@ -55,14 +55,10 @@ __FBSDID("$FreeBSD$"); */ #define joypart(d) (dev2unit(d)&1) -#define UNIT(d) ((dev2unit(d)>>1)&3) #ifndef JOY_TIMEOUT #define JOY_TIMEOUT 2000 /* 2 milliseconds */ #endif -#define JOY_SOFTC(unit) (struct joy_softc *) \ - devclass_get_softc(joy_devclass,(unit)) - static d_open_t joyopen; static d_close_t joyclose; static d_read_t joyread; @@ -111,6 +107,7 @@ joy_attach(device_t dev) joy->port = rman_get_bushandle(joy->res); joy->timeout[0] = joy->timeout[1] = 0; joy->d = make_dev(&joy_cdevsw, unit, 0, 0, 0600, "joy%d", unit); + joy->d->si_drv1 = joy; return (0); } @@ -131,7 +128,7 @@ static int joyopen(struct cdev *dev, int flags, int fmt, struct thread *td) { int i = joypart (dev); - struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); + struct joy_softc *joy = dev->si_drv1; if (joy->timeout[i]) return (EBUSY); @@ -144,7 +141,7 @@ static int joyclose(struct cdev *dev, int flags, int fmt, struct thread *td) { int i = joypart (dev); - struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); + struct joy_softc *joy = dev->si_drv1; joy->timeout[i] = 0; return (0); @@ -153,7 +150,7 @@ joyclose(struct cdev *dev, int flags, in static int joyread(struct cdev *dev, struct uio *uio, int flag) { - struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); + struct joy_softc *joy = dev->si_drv1; bus_space_handle_t port = joy->port; bus_space_tag_t bt = joy->bt; struct timespec t, start, end; @@ -217,7 +214,7 @@ joyread(struct cdev *dev, struct uio *ui static int joyioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { - struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); + struct joy_softc *joy = dev->si_drv1; int i = joypart (dev); int x;