svn commit: r198681 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/drm dev/xen/xenpci

Robert Noland rnoland at FreeBSD.org
Fri Oct 30 16:12:29 UTC 2009


Author: rnoland
Date: Fri Oct 30 16:12:28 2009
New Revision: 198681
URL: http://svn.freebsd.org/changeset/base/198681

Log:
  MFC r196465
  
  Clean up the handling of device minors

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/drm/drmP.h
  stable/8/sys/dev/drm/drm_drv.c
  stable/8/sys/dev/drm/drm_fops.c
  stable/8/sys/dev/drm/drm_sysctl.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/drm/drmP.h
==============================================================================
--- stable/8/sys/dev/drm/drmP.h	Fri Oct 30 16:07:06 2009	(r198680)
+++ stable/8/sys/dev/drm/drmP.h	Fri Oct 30 16:12:28 2009	(r198681)
@@ -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: stable/8/sys/dev/drm/drm_drv.c
==============================================================================
--- stable/8/sys/dev/drm/drm_drv.c	Fri Oct 30 16:07:06 2009	(r198680)
+++ stable/8/sys/dev/drm/drm_drv.c	Fri Oct 30 16:12:28 2009	(r198681)
@@ -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: stable/8/sys/dev/drm/drm_fops.c
==============================================================================
--- stable/8/sys/dev/drm/drm_fops.c	Fri Oct 30 16:07:06 2009	(r198680)
+++ stable/8/sys/dev/drm/drm_fops.c	Fri Oct 30 16:12:28 2009	(r198681)
@@ -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: stable/8/sys/dev/drm/drm_sysctl.c
==============================================================================
--- stable/8/sys/dev/drm/drm_sysctl.c	Fri Oct 30 16:07:06 2009	(r198680)
+++ stable/8/sys/dev/drm/drm_sysctl.c	Fri Oct 30 16:12:28 2009	(r198681)
@@ -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,


More information about the svn-src-stable mailing list