Lines Matching refs:master

100 	struct drm_master *master;
103 master = kzalloc(sizeof(*master), GFP_KERNEL);
104 if (!master)
107 kref_init(&master->refcount);
108 mutex_init(&master->lock.lock_mutex, NULL, MUTEX_DRIVER, (void *)minor->dev->pdev->intr_block);
109 cv_init(&master->lock.lock_cv, NULL, CV_DRIVER, NULL);
112 master->magiclist[i].head = NULL;
113 master->magiclist[i].tail = NULL;
116 master->minor = minor;
118 list_add_tail(&master->head, &minor->master_list, (caddr_t)master);
120 return master;
123 struct drm_master *drm_master_get(struct drm_master *master)
125 kref_get(&master->refcount);
126 return master;
131 struct drm_master *master = container_of(kref, struct drm_master, refcount);
133 struct drm_device *dev = master->minor->dev;
137 list_del(&master->head);
140 dev->driver->master_destroy(dev, master);
143 if (r_list->master == master) {
149 if (master->unique) {
150 kfree(master->unique, master->unique_size);
151 master->unique = NULL;
152 master->unique_len = 0;
157 for (pt = master->magiclist[i].head; pt; pt = next) {
161 master->magiclist[i].head = master->magiclist[i].tail = NULL;
164 cv_destroy(&master->lock.lock_cv);
165 mutex_destroy(&master->lock.lock_mutex);
167 kfree(master, sizeof (struct drm_master));
170 void drm_master_put(struct drm_master **master)
172 kref_put(&(*master)->refcount, drm_master_destroy);
173 *master = NULL;
187 if (file->minor->master && file->minor->master != file->master)
190 if (!file->master)
193 if (!file->minor->master &&
194 file->minor->master != file->master) {
196 file->minor->master = drm_master_get(file->master);
202 drm_master_put(&file->minor->master);
217 if (!file->minor->master)
226 drm_master_put(&file->minor->master);