Date: Sun, 23 Aug 2009 14:31:20 +0000 (UTC) From: Robert Noland <rnoland@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r196465 - head/sys/dev/drm Message-ID: <200908231431.n7NEVKv0063405@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rnoland Date: Sun Aug 23 14:31:20 2009 New Revision: 196465 URL: http://svn.freebsd.org/changeset/base/196465 Log: Clean up the handling of device minors Submitted by: Ed MFC after: 2 weeks Modified: head/sys/dev/drm/drmP.h head/sys/dev/drm/drm_drv.c head/sys/dev/drm/drm_fops.c head/sys/dev/drm/drm_sysctl.c Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drmP.h Sun Aug 23 14:31:20 2009 (r196465) @@ -416,7 +416,6 @@ struct drm_file { struct drm_device *dev; int authenticated; int master; - int minor; pid_t pid; uid_t uid; drm_magic_t magic; Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drm_drv.c Sun Aug 23 14:31:20 2009 (r196465) @@ -53,9 +53,6 @@ static void drm_unload(struct drm_device static drm_pci_id_list_t *drm_find_description(int vendor, int device, drm_pci_id_list_t *idlist); -#define DRIVER_SOFTC(unit) \ - ((struct drm_device *)devclass_get_softc(drm_devclass, unit)) - MODULE_VERSION(drm, 1); MODULE_DEPEND(drm, agp, 1, 1, 1); MODULE_DEPEND(drm, pci, 1, 1, 1); @@ -210,11 +207,12 @@ int drm_attach(device_t kdev, drm_pci_id dev->device = kdev; #endif dev->devnode = make_dev(&drm_cdevsw, - unit, + 0, DRM_DEV_UID, DRM_DEV_GID, DRM_DEV_MODE, "dri/card%d", unit); + dev->devnode->si_drv1 = dev; #if __FreeBSD_version >= 700053 dev->pci_domain = pci_get_domain(dev->device); @@ -606,7 +604,7 @@ int drm_open(struct cdev *kdev, int flag struct drm_device *dev = NULL; int retcode = 0; - dev = DRIVER_SOFTC(dev2unit(kdev)); + dev = kdev->si_drv1; DRM_DEBUG("open_count = %d\n", dev->open_count); Modified: head/sys/dev/drm/drm_fops.c ============================================================================== --- head/sys/dev/drm/drm_fops.c Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drm_fops.c Sun Aug 23 14:31:20 2009 (r196465) @@ -44,14 +44,13 @@ int drm_open_helper(struct cdev *kdev, i struct drm_device *dev) { struct drm_file *priv; - int m = dev2unit(kdev); int retcode; if (flags & O_EXCL) return EBUSY; /* No exclusive opens */ dev->flags = flags; - DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m); + DRM_DEBUG("pid = %d, device = %s\n", DRM_CURRENTPID, devtoname(kdev)); priv = malloc(sizeof(*priv), DRM_MEM_FILES, M_NOWAIT | M_ZERO); if (priv == NULL) { @@ -68,7 +67,6 @@ int drm_open_helper(struct cdev *kdev, i priv->dev = dev; priv->uid = p->td_ucred->cr_svuid; priv->pid = p->td_proc->p_pid; - priv->minor = m; priv->ioctl_count = 0; /* for compatibility root is always authenticated */ Modified: head/sys/dev/drm/drm_sysctl.c ============================================================================== --- head/sys/dev/drm/drm_sysctl.c Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drm_sysctl.c Sun Aug 23 14:31:20 2009 (r196465) @@ -298,12 +298,13 @@ static int drm_clients_info DRM_SYSCTL_H DRM_UNLOCK(); - DRM_SYSCTL_PRINT("\na dev pid uid magic ioctls\n"); + DRM_SYSCTL_PRINT( + "\na dev pid uid magic ioctls\n"); for (i = 0; i < privcount; i++) { priv = &tempprivs[i]; - DRM_SYSCTL_PRINT("%c %3d %5d %5d %10u %10lu\n", + DRM_SYSCTL_PRINT("%c %-12s %5d %5d %10u %10lu\n", priv->authenticated ? 'y' : 'n', - priv->minor, + devtoname(priv->dev->devnode), priv->pid, priv->uid, priv->magic,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908231431.n7NEVKv0063405>