diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2011-10-25 16:32:34 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2011-12-22 00:33:15 +0100 |
commit | fdc0b8a63c1124bb025a2846d41531a123845740 (patch) | |
tree | 3913d201022d789970b6d07355864fece7455ff3 /drivers/gpu/drm/sis/sis_drv.c | |
parent | 4cf73129cbe001b41be2f8b56f763fbf3acaa4ce (diff) | |
download | talos-obmc-linux-fdc0b8a63c1124bb025a2846d41531a123845740.tar.gz talos-obmc-linux-fdc0b8a63c1124bb025a2846d41531a123845740.zip |
drm/sis: track obj->drm_fd relations in the driver
By attach a driver private struct to each open drm fd.
Because we steal the owner_list from drm_sman until things settle,
use list_move instead of list_add.
This requires to export a drm_sman function temporarily before
drm_sman will die for real completely.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/sis/sis_drv.c')
-rw-r--r-- | drivers/gpu/drm/sis/sis_drv.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c index bda96a8cd939..6ad0b857ba2e 100644 --- a/drivers/gpu/drm/sis/sis_drv.c +++ b/drivers/gpu/drm/sis/sis_drv.c @@ -76,10 +76,35 @@ static const struct file_operations sis_driver_fops = { .llseek = noop_llseek, }; +static int sis_driver_open(struct drm_device *dev, struct drm_file *file) +{ + struct sis_file_private *file_priv; + + DRM_DEBUG_DRIVER("\n"); + file_priv = kmalloc(sizeof(*file_priv), GFP_KERNEL); + if (!file_priv) + return -ENOMEM; + + file->driver_priv = file_priv; + + INIT_LIST_HEAD(&file_priv->obj_list); + + return 0; +} + +void sis_driver_postclose(struct drm_device *dev, struct drm_file *file) +{ + struct sis_file_private *file_priv = file->driver_priv; + + kfree(file_priv); +} + static struct drm_driver driver = { .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR, .load = sis_driver_load, .unload = sis_driver_unload, + .open = sis_driver_open, + .postclose = sis_driver_postclose, .dma_quiescent = sis_idle, .reclaim_buffers = NULL, .reclaim_buffers_idlelocked = sis_reclaim_buffers_locked, |