summaryrefslogtreecommitdiff
path: root/bsd-core/drm_fops.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-02-05 08:00:14 +0000
committerEric Anholt <anholt@freebsd.org>2005-02-05 08:00:14 +0000
commit080a547d4d42d42e08a525aca9a62b5ece7616d5 (patch)
tree6996ba882ce26098fb69ba336969d88aa47dc39c /bsd-core/drm_fops.c
parent270ca5f3cee387c10a06a4d58e50c5d0e1cea837 (diff)
- Implement drm_initmap, and extend it with the resource number to help
FreeBSD. Add drm_get_resource_{start|len} so linux-specific stuff doesn't need to be in shared code. - Fix mach64 build by using __DECONST to work around passing a const pointer to useracc, which is unfortunately not marked const. - Get rid of a lot of maplist code by not having dev->maplist be a pointer, and by sticking the link entries directly in drm_local_map_t rather than having a separate structure for the linked list. - Factor out map uninit and removal into its own routine, rather than duplicating in both drm_takedown() and drm_rmmap(). - Hook up more driver functions, and correct FreeBSD-specific bits of radeon_cp.c, making radeon work. - Baby steps towards using bus_space as we should.
Diffstat (limited to 'bsd-core/drm_fops.c')
-rw-r--r--bsd-core/drm_fops.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/bsd-core/drm_fops.c b/bsd-core/drm_fops.c
index eeb4847a..44c2b8de 100644
--- a/bsd-core/drm_fops.c
+++ b/bsd-core/drm_fops.c
@@ -58,6 +58,7 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
{
int m = minor(kdev);
drm_file_t *priv;
+ int retcode;
if (flags & O_EXCL)
return EBUSY; /* No exclusive opens */
@@ -88,8 +89,14 @@ int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
priv->ioctl_count = 0;
priv->authenticated = !DRM_SUSER(p);
- if (dev->open_helper)
- dev->open_helper(dev, priv);
+ if (dev->open_helper) {
+ retcode = dev->open_helper(dev, priv);
+ if (retcode != 0) {
+ free(priv, M_DRM);
+ DRM_UNLOCK();
+ return retcode;
+ }
+ }
TAILQ_INSERT_TAIL(&dev->files, priv, link);
}