aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sis/sis_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/sis/sis_drv.c')
-rw-r--r--drivers/gpu/drm/sis/sis_drv.c56
1 files changed, 41 insertions, 15 deletions
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c
index a9c5716bea4e..06da063ece2e 100644
--- a/drivers/gpu/drm/sis/sis_drv.c
+++ b/drivers/gpu/drm/sis/sis_drv.c
@@ -48,9 +48,7 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset)
48 48
49 dev->dev_private = (void *)dev_priv; 49 dev->dev_private = (void *)dev_priv;
50 dev_priv->chipset = chipset; 50 dev_priv->chipset = chipset;
51 ret = drm_sman_init(&dev_priv->sman, 2, 12, 8); 51 idr_init(&dev->object_name_idr);
52 if (ret)
53 kfree(dev_priv);
54 52
55 return ret; 53 return ret;
56} 54}
@@ -59,32 +57,60 @@ static int sis_driver_unload(struct drm_device *dev)
59{ 57{
60 drm_sis_private_t *dev_priv = dev->dev_private; 58 drm_sis_private_t *dev_priv = dev->dev_private;
61 59
62 drm_sman_takedown(&dev_priv->sman); 60 idr_remove_all(&dev_priv->object_idr);
61 idr_destroy(&dev_priv->object_idr);
62
63 kfree(dev_priv); 63 kfree(dev_priv);
64 64
65 return 0; 65 return 0;
66} 66}
67 67
68static const struct file_operations sis_driver_fops = {
69 .owner = THIS_MODULE,
70 .open = drm_open,
71 .release = drm_release,
72 .unlocked_ioctl = drm_ioctl,
73 .mmap = drm_mmap,
74 .poll = drm_poll,
75 .fasync = drm_fasync,
76 .llseek = noop_llseek,
77};
78
79static int sis_driver_open(struct drm_device *dev, struct drm_file *file)
80{
81 struct sis_file_private *file_priv;
82
83 DRM_DEBUG_DRIVER("\n");
84 file_priv = kmalloc(sizeof(*file_priv), GFP_KERNEL);
85 if (!file_priv)
86 return -ENOMEM;
87
88 file->driver_priv = file_priv;
89
90 INIT_LIST_HEAD(&file_priv->obj_list);
91
92 return 0;
93}
94
95void sis_driver_postclose(struct drm_device *dev, struct drm_file *file)
96{
97 struct sis_file_private *file_priv = file->driver_priv;
98
99 kfree(file_priv);
100}
101
68static struct drm_driver driver = { 102static struct drm_driver driver = {
69 .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR, 103 .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR,
70 .load = sis_driver_load, 104 .load = sis_driver_load,
71 .unload = sis_driver_unload, 105 .unload = sis_driver_unload,
106 .open = sis_driver_open,
107 .postclose = sis_driver_postclose,
72 .dma_quiescent = sis_idle, 108 .dma_quiescent = sis_idle,
73 .reclaim_buffers = NULL, 109 .reclaim_buffers = NULL,
74 .reclaim_buffers_idlelocked = sis_reclaim_buffers_locked, 110 .reclaim_buffers_idlelocked = sis_reclaim_buffers_locked,
75 .lastclose = sis_lastclose, 111 .lastclose = sis_lastclose,
76 .ioctls = sis_ioctls, 112 .ioctls = sis_ioctls,
77 .fops = { 113 .fops = &sis_driver_fops,
78 .owner = THIS_MODULE,
79 .open = drm_open,
80 .release = drm_release,
81 .unlocked_ioctl = drm_ioctl,
82 .mmap = drm_mmap,
83 .poll = drm_poll,
84 .fasync = drm_fasync,
85 .llseek = noop_llseek,
86 },
87
88 .name = DRIVER_NAME, 114 .name = DRIVER_NAME,
89 .desc = DRIVER_DESC, 115 .desc = DRIVER_DESC,
90 .date = DRIVER_DATE, 116 .date = DRIVER_DATE,