From owner-svn-src-all@FreeBSD.ORG Tue Apr 14 13:11:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED4211065673; Tue, 14 Apr 2009 13:11:34 +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 C01EB8FC0C; Tue, 14 Apr 2009 13:11:34 +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 n3EDBYl2006666; Tue, 14 Apr 2009 13:11:34 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3EDBYVr006665; Tue, 14 Apr 2009 13:11:34 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200904141311.n3EDBYVr006665@svn.freebsd.org> From: Ed Schouten Date: Tue, 14 Apr 2009 13:11:34 +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: r191057 - head/sys/dev/agp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2009 13:11:36 -0000 Author: ed Date: Tue Apr 14 13:11:34 2009 New Revision: 191057 URL: http://svn.freebsd.org/changeset/base/191057 Log: Use si_drv1 instead of dev2unit() inside agp(4). Reviewed by: rnoland Modified: head/sys/dev/agp/agp.c Modified: head/sys/dev/agp/agp.c ============================================================================== --- head/sys/dev/agp/agp.c Tue Apr 14 11:57:26 2009 (r191056) +++ head/sys/dev/agp/agp.c Tue Apr 14 13:11:34 2009 (r191057) @@ -81,7 +81,6 @@ static struct cdevsw agp_cdevsw = { }; static devclass_t agp_devclass; -#define KDEV2DEV(kdev) devclass_get_device(agp_devclass, dev2unit(kdev)) /* Helper functions for implementing chipset mini drivers. */ @@ -254,11 +253,8 @@ agp_generic_attach(device_t dev) sc->as_nextid = 1; sc->as_devnode = make_dev(&agp_cdevsw, - device_get_unit(dev), - UID_ROOT, - GID_WHEEL, - 0600, - "agpgart"); + 0, UID_ROOT, GID_WHEEL, 0600, "agpgart"); + sc->as_devnode->si_drv1 = dev; return 0; } @@ -802,7 +798,7 @@ agp_unbind_user(device_t dev, agp_unbind static int agp_open(struct cdev *kdev, int oflags, int devtype, struct thread *td) { - device_t dev = KDEV2DEV(kdev); + device_t dev = kdev->si_drv1; struct agp_softc *sc = device_get_softc(dev); if (!sc->as_isopen) { @@ -816,7 +812,7 @@ agp_open(struct cdev *kdev, int oflags, static int agp_close(struct cdev *kdev, int fflag, int devtype, struct thread *td) { - device_t dev = KDEV2DEV(kdev); + device_t dev = kdev->si_drv1; struct agp_softc *sc = device_get_softc(dev); struct agp_memory *mem; @@ -839,7 +835,7 @@ agp_close(struct cdev *kdev, int fflag, static int agp_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) { - device_t dev = KDEV2DEV(kdev); + device_t dev = kdev->si_drv1; switch (cmd) { case AGPIOC_INFO: @@ -874,7 +870,7 @@ agp_ioctl(struct cdev *kdev, u_long cmd, static int agp_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { - device_t dev = KDEV2DEV(kdev); + device_t dev = kdev->si_drv1; struct agp_softc *sc = device_get_softc(dev); if (offset > AGP_GET_APERTURE(dev))