diff options
author | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2001-08-28 07:43:48 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2001-08-28 07:43:48 +0000 |
commit | 73adb5e130141e76d04b6c7132536952232af4ba (patch) | |
tree | 8d8cc0cd8e2d935e6ed9d2bbf7ff06ae9d455169 | |
parent | 4e3c16d6b36034c59bc541a5bdd8df26805907ba (diff) |
Apply Eric Anholt's fixes
-rw-r--r-- | bsd-core/drm_sysctl.c | 34 | ||||
-rw-r--r-- | bsd/drm_sysctl.h | 34 | ||||
-rw-r--r-- | linux-core/drm_drv.c | 11 | ||||
-rw-r--r-- | linux-core/drm_fops.c | 2 | ||||
-rw-r--r-- | linux/drm_drv.h | 11 | ||||
-rw-r--r-- | linux/drm_fops.h | 2 | ||||
-rw-r--r-- | linux/drm_lists.h | 2 |
7 files changed, 51 insertions, 45 deletions
diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c index fd3a358f..d9cbce26 100644 --- a/bsd-core/drm_sysctl.c +++ b/bsd-core/drm_sysctl.c @@ -136,23 +136,25 @@ static int DRM(_vm_info)DRM_SYSCTL_HANDLER_ARGS error = SYSCTL_OUT(req, buf, strlen(buf)); if (error) return error; - TAILQ_FOREACH(listentry, dev->maplist, link) { - map = listentry->map; - if (map->type < 0 || map->type > 2) type = "??"; - else type = types[map->type]; - DRM_SYSCTL_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", - i, - map->offset, - map->size, - type, - map->flags, - (unsigned long)map->handle); - if (map->mtrr < 0) { - DRM_SYSCTL_PRINT("none\n"); - } else { - DRM_SYSCTL_PRINT("%4d\n", map->mtrr); + if (dev->maplist != NULL) { + TAILQ_FOREACH(listentry, dev->maplist, link) { + map = listentry->map; + if (map->type < 0 || map->type > 2) type = "??"; + else type = types[map->type]; + DRM_SYSCTL_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", + i, + map->offset, + map->size, + type, + map->flags, + (unsigned long)map->handle); + if (map->mtrr < 0) { + DRM_SYSCTL_PRINT("none\n"); + } else { + DRM_SYSCTL_PRINT("%4d\n", map->mtrr); + } + i++; } - i++; } SYSCTL_OUT(req, "", 1); diff --git a/bsd/drm_sysctl.h b/bsd/drm_sysctl.h index fd3a358f..d9cbce26 100644 --- a/bsd/drm_sysctl.h +++ b/bsd/drm_sysctl.h @@ -136,23 +136,25 @@ static int DRM(_vm_info)DRM_SYSCTL_HANDLER_ARGS error = SYSCTL_OUT(req, buf, strlen(buf)); if (error) return error; - TAILQ_FOREACH(listentry, dev->maplist, link) { - map = listentry->map; - if (map->type < 0 || map->type > 2) type = "??"; - else type = types[map->type]; - DRM_SYSCTL_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", - i, - map->offset, - map->size, - type, - map->flags, - (unsigned long)map->handle); - if (map->mtrr < 0) { - DRM_SYSCTL_PRINT("none\n"); - } else { - DRM_SYSCTL_PRINT("%4d\n", map->mtrr); + if (dev->maplist != NULL) { + TAILQ_FOREACH(listentry, dev->maplist, link) { + map = listentry->map; + if (map->type < 0 || map->type > 2) type = "??"; + else type = types[map->type]; + DRM_SYSCTL_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", + i, + map->offset, + map->size, + type, + map->flags, + (unsigned long)map->handle); + if (map->mtrr < 0) { + DRM_SYSCTL_PRINT("none\n"); + } else { + DRM_SYSCTL_PRINT("%4d\n", map->mtrr); + } + i++; } - i++; } SYSCTL_OUT(req, "", 1); diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 226b913e..52653171 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -726,7 +726,7 @@ static int DRM(init)( device_t nbdev ) if (!DRM(device)) { DRM_OS_RETURN(ENOMEM); } - DRM(minor) = DRM_OS_MALLOC(*(DRM(minor)) * DRM(numdevs)); + DRM(minor) = DRM_OS_MALLOC(sizeof(*(DRM(minor))) * DRM(numdevs)); if (!DRM(minor)) { DRM_OS_FREE(DRM(device)); DRM_OS_RETURN(ENOMEM); @@ -743,6 +743,7 @@ static int DRM(init)( device_t nbdev ) dev = &(DRM(device)[i]); #endif /* __linux__ */ #ifdef __FreeBSD__ + int unit = device_get_unit(nbdev); /* FIXME??? - multihead !!! */ dev = device_get_softc(nbdev); #endif /* __FreeBSD__ */ @@ -756,15 +757,15 @@ static int DRM(init)( device_t nbdev ) dev->name = DRIVER_NAME; #endif /* __linux__ */ #ifdef __FreeBSD__ - DRM_OS_SPININIT(&dev->count_lock, "drm device"); + DRM_OS_SPININIT(dev->count_lock, "drm device"); lockinit(&dev->dev_lock, PZERO, "drmlk", 0, 0); dev->device = nbdev; - dev->devnode = make_dev(&DRM( cdevsw), - device_get_unit(nbdev), + dev->devnode = make_dev( &DRM(cdevsw), + unit, DRM_DEV_UID, DRM_DEV_GID, DRM_DEV_MODE, - "dri/card0"); /* card0 - FIXME !!! */ + "dri/card%d", unit ); dev->name = DRIVER_NAME; DRM(mem_init)(); DRM(sysctl_init)(dev); diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c index ff7b8988..09533113 100644 --- a/linux-core/drm_fops.c +++ b/linux-core/drm_fops.c @@ -122,7 +122,7 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, struct proc *p, priv = (drm_file_t *) DRM(alloc)(sizeof(*priv), DRM_MEM_FILES); bzero(priv, sizeof(*priv)); #if __FreeBSD_version >= 500021 - priv->uid = p->p_ucred->cr_svuid; + priv->uid = p->p_ucred->cr_svuid; #else priv->uid = p->p_cred->p_svuid; #endif diff --git a/linux/drm_drv.h b/linux/drm_drv.h index 226b913e..52653171 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -726,7 +726,7 @@ static int DRM(init)( device_t nbdev ) if (!DRM(device)) { DRM_OS_RETURN(ENOMEM); } - DRM(minor) = DRM_OS_MALLOC(*(DRM(minor)) * DRM(numdevs)); + DRM(minor) = DRM_OS_MALLOC(sizeof(*(DRM(minor))) * DRM(numdevs)); if (!DRM(minor)) { DRM_OS_FREE(DRM(device)); DRM_OS_RETURN(ENOMEM); @@ -743,6 +743,7 @@ static int DRM(init)( device_t nbdev ) dev = &(DRM(device)[i]); #endif /* __linux__ */ #ifdef __FreeBSD__ + int unit = device_get_unit(nbdev); /* FIXME??? - multihead !!! */ dev = device_get_softc(nbdev); #endif /* __FreeBSD__ */ @@ -756,15 +757,15 @@ static int DRM(init)( device_t nbdev ) dev->name = DRIVER_NAME; #endif /* __linux__ */ #ifdef __FreeBSD__ - DRM_OS_SPININIT(&dev->count_lock, "drm device"); + DRM_OS_SPININIT(dev->count_lock, "drm device"); lockinit(&dev->dev_lock, PZERO, "drmlk", 0, 0); dev->device = nbdev; - dev->devnode = make_dev(&DRM( cdevsw), - device_get_unit(nbdev), + dev->devnode = make_dev( &DRM(cdevsw), + unit, DRM_DEV_UID, DRM_DEV_GID, DRM_DEV_MODE, - "dri/card0"); /* card0 - FIXME !!! */ + "dri/card%d", unit ); dev->name = DRIVER_NAME; DRM(mem_init)(); DRM(sysctl_init)(dev); diff --git a/linux/drm_fops.h b/linux/drm_fops.h index ff7b8988..09533113 100644 --- a/linux/drm_fops.h +++ b/linux/drm_fops.h @@ -122,7 +122,7 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, struct proc *p, priv = (drm_file_t *) DRM(alloc)(sizeof(*priv), DRM_MEM_FILES); bzero(priv, sizeof(*priv)); #if __FreeBSD_version >= 500021 - priv->uid = p->p_ucred->cr_svuid; + priv->uid = p->p_ucred->cr_svuid; #else priv->uid = p->p_cred->p_svuid; #endif diff --git a/linux/drm_lists.h b/linux/drm_lists.h index da4c5131..7063482d 100644 --- a/linux/drm_lists.h +++ b/linux/drm_lists.h @@ -213,7 +213,7 @@ int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf) atomic_inc(&bl->count); if (atomic_read(&bl->count) > dma->buf_count) { - DRM_ERROR("%d of %d buffers free after addition of %d\n", + DRM_ERROR("%ld of %d buffers free after addition of %d\n", atomic_read(&bl->count), dma->buf_count, buf->idx); return 1; } |