summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrnoland <rnoland@FreeBSD.org>2009-08-23 14:31:20 +0000
committerrnoland <rnoland@FreeBSD.org>2009-08-23 14:31:20 +0000
commitf98d8dac77d63020f80f0dfab1d03e4e7a9dac22 (patch)
tree14a46ba90b7479e2652c5a75387fb9cb53a43195
parentb149016ae831053f369bfced2e0b0c0627a9327c (diff)
downloadFreeBSD-src-f98d8dac77d63020f80f0dfab1d03e4e7a9dac22.zip
FreeBSD-src-f98d8dac77d63020f80f0dfab1d03e4e7a9dac22.tar.gz
Clean up the handling of device minors
Submitted by: Ed MFC after: 2 weeks
-rw-r--r--sys/dev/drm/drmP.h1
-rw-r--r--sys/dev/drm/drm_drv.c8
-rw-r--r--sys/dev/drm/drm_fops.c4
-rw-r--r--sys/dev/drm/drm_sysctl.c7
4 files changed, 8 insertions, 12 deletions
diff --git a/sys/dev/drm/drmP.h b/sys/dev/drm/drmP.h
index e630f86..9c5f4a4 100644
--- a/sys/dev/drm/drmP.h
+++ b/sys/dev/drm/drmP.h
@@ -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;
diff --git a/sys/dev/drm/drm_drv.c b/sys/dev/drm/drm_drv.c
index 561afd5..1fb8342 100644
--- a/sys/dev/drm/drm_drv.c
+++ b/sys/dev/drm/drm_drv.c
@@ -53,9 +53,6 @@ static void drm_unload(struct drm_device *dev);
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_list_t *idlist)
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 flags, int fmt, DRM_STRUCTPROC *p)
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);
diff --git a/sys/dev/drm/drm_fops.c b/sys/dev/drm/drm_fops.c
index f766928..3f743e0 100644
--- a/sys/dev/drm/drm_fops.c
+++ b/sys/dev/drm/drm_fops.c
@@ -44,14 +44,13 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
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, int flags, int fmt, DRM_STRUCTPROC *p,
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 */
diff --git a/sys/dev/drm/drm_sysctl.c b/sys/dev/drm/drm_sysctl.c
index 0d59d48..cc33283 100644
--- a/sys/dev/drm/drm_sysctl.c
+++ b/sys/dev/drm/drm_sysctl.c
@@ -298,12 +298,13 @@ static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
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,
OpenPOWER on IntegriCloud