drm_ioctl.c revision 1.1.1.1.2.4 1 1.1.1.1.2.2 riastrad /**
2 1.1.1.1.2.2 riastrad * \file drm_ioctl.c
3 1.1.1.1.2.2 riastrad * IOCTL processing for DRM
4 1.1.1.1.2.2 riastrad *
5 1.1.1.1.2.2 riastrad * \author Rickard E. (Rik) Faith <faith (at) valinux.com>
6 1.1.1.1.2.2 riastrad * \author Gareth Hughes <gareth (at) valinux.com>
7 1.1.1.1.2.2 riastrad */
8 1.1.1.1.2.2 riastrad
9 1.1.1.1.2.2 riastrad /*
10 1.1.1.1.2.2 riastrad * Created: Fri Jan 8 09:01:26 1999 by faith (at) valinux.com
11 1.1.1.1.2.2 riastrad *
12 1.1.1.1.2.2 riastrad * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
13 1.1.1.1.2.2 riastrad * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
14 1.1.1.1.2.2 riastrad * All Rights Reserved.
15 1.1.1.1.2.2 riastrad *
16 1.1.1.1.2.2 riastrad * Permission is hereby granted, free of charge, to any person obtaining a
17 1.1.1.1.2.2 riastrad * copy of this software and associated documentation files (the "Software"),
18 1.1.1.1.2.2 riastrad * to deal in the Software without restriction, including without limitation
19 1.1.1.1.2.2 riastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense,
20 1.1.1.1.2.2 riastrad * and/or sell copies of the Software, and to permit persons to whom the
21 1.1.1.1.2.2 riastrad * Software is furnished to do so, subject to the following conditions:
22 1.1.1.1.2.2 riastrad *
23 1.1.1.1.2.2 riastrad * The above copyright notice and this permission notice (including the next
24 1.1.1.1.2.2 riastrad * paragraph) shall be included in all copies or substantial portions of the
25 1.1.1.1.2.2 riastrad * Software.
26 1.1.1.1.2.2 riastrad *
27 1.1.1.1.2.2 riastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28 1.1.1.1.2.2 riastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29 1.1.1.1.2.2 riastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
30 1.1.1.1.2.2 riastrad * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
31 1.1.1.1.2.2 riastrad * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32 1.1.1.1.2.2 riastrad * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
33 1.1.1.1.2.2 riastrad * OTHER DEALINGS IN THE SOFTWARE.
34 1.1.1.1.2.2 riastrad */
35 1.1.1.1.2.2 riastrad
36 1.1.1.1.2.2 riastrad #include <drm/drmP.h>
37 1.1.1.1.2.2 riastrad #include <drm/drm_core.h>
38 1.1.1.1.2.2 riastrad
39 1.1.1.1.2.2 riastrad #include <linux/pci.h>
40 1.1.1.1.2.2 riastrad #include <linux/export.h>
41 1.1.1.1.2.2 riastrad
42 1.1.1.1.2.2 riastrad /**
43 1.1.1.1.2.2 riastrad * Get the bus id.
44 1.1.1.1.2.2 riastrad *
45 1.1.1.1.2.2 riastrad * \param inode device inode.
46 1.1.1.1.2.2 riastrad * \param file_priv DRM file private.
47 1.1.1.1.2.2 riastrad * \param cmd command.
48 1.1.1.1.2.2 riastrad * \param arg user argument, pointing to a drm_unique structure.
49 1.1.1.1.2.2 riastrad * \return zero on success or a negative number on failure.
50 1.1.1.1.2.2 riastrad *
51 1.1.1.1.2.2 riastrad * Copies the bus id from drm_device::unique into user space.
52 1.1.1.1.2.2 riastrad */
53 1.1.1.1.2.2 riastrad int drm_getunique(struct drm_device *dev, void *data,
54 1.1.1.1.2.2 riastrad struct drm_file *file_priv)
55 1.1.1.1.2.2 riastrad {
56 1.1.1.1.2.2 riastrad struct drm_unique *u = data;
57 1.1.1.1.2.2 riastrad struct drm_master *master = file_priv->master;
58 1.1.1.1.2.2 riastrad
59 1.1.1.1.2.2 riastrad if (u->unique_len >= master->unique_len) {
60 1.1.1.1.2.2 riastrad if (copy_to_user(u->unique, master->unique, master->unique_len))
61 1.1.1.1.2.2 riastrad return -EFAULT;
62 1.1.1.1.2.2 riastrad }
63 1.1.1.1.2.2 riastrad u->unique_len = master->unique_len;
64 1.1.1.1.2.2 riastrad
65 1.1.1.1.2.2 riastrad return 0;
66 1.1.1.1.2.2 riastrad }
67 1.1.1.1.2.2 riastrad
68 1.1.1.1.2.2 riastrad static void
69 1.1.1.1.2.2 riastrad drm_unset_busid(struct drm_device *dev,
70 1.1.1.1.2.2 riastrad struct drm_master *master)
71 1.1.1.1.2.2 riastrad {
72 1.1.1.1.2.2 riastrad kfree(dev->devname);
73 1.1.1.1.2.2 riastrad dev->devname = NULL;
74 1.1.1.1.2.2 riastrad
75 1.1.1.1.2.2 riastrad kfree(master->unique);
76 1.1.1.1.2.2 riastrad master->unique = NULL;
77 1.1.1.1.2.2 riastrad master->unique_len = 0;
78 1.1.1.1.2.2 riastrad master->unique_size = 0;
79 1.1.1.1.2.2 riastrad }
80 1.1.1.1.2.2 riastrad
81 1.1.1.1.2.2 riastrad /**
82 1.1.1.1.2.2 riastrad * Set the bus id.
83 1.1.1.1.2.2 riastrad *
84 1.1.1.1.2.2 riastrad * \param inode device inode.
85 1.1.1.1.2.2 riastrad * \param file_priv DRM file private.
86 1.1.1.1.2.2 riastrad * \param cmd command.
87 1.1.1.1.2.2 riastrad * \param arg user argument, pointing to a drm_unique structure.
88 1.1.1.1.2.2 riastrad * \return zero on success or a negative number on failure.
89 1.1.1.1.2.2 riastrad *
90 1.1.1.1.2.2 riastrad * Copies the bus id from userspace into drm_device::unique, and verifies that
91 1.1.1.1.2.2 riastrad * it matches the device this DRM is attached to (EINVAL otherwise). Deprecated
92 1.1.1.1.2.2 riastrad * in interface version 1.1 and will return EBUSY when setversion has requested
93 1.1.1.1.2.2 riastrad * version 1.1 or greater.
94 1.1.1.1.2.2 riastrad */
95 1.1.1.1.2.2 riastrad int drm_setunique(struct drm_device *dev, void *data,
96 1.1.1.1.2.2 riastrad struct drm_file *file_priv)
97 1.1.1.1.2.2 riastrad {
98 1.1.1.1.2.2 riastrad struct drm_unique *u = data;
99 1.1.1.1.2.2 riastrad struct drm_master *master = file_priv->master;
100 1.1.1.1.2.2 riastrad int ret;
101 1.1.1.1.2.2 riastrad
102 1.1.1.1.2.2 riastrad if (master->unique_len || master->unique)
103 1.1.1.1.2.2 riastrad return -EBUSY;
104 1.1.1.1.2.2 riastrad
105 1.1.1.1.2.2 riastrad if (!u->unique_len || u->unique_len > 1024)
106 1.1.1.1.2.2 riastrad return -EINVAL;
107 1.1.1.1.2.2 riastrad
108 1.1.1.1.2.2 riastrad if (!dev->driver->bus->set_unique)
109 1.1.1.1.2.2 riastrad return -EINVAL;
110 1.1.1.1.2.2 riastrad
111 1.1.1.1.2.2 riastrad ret = dev->driver->bus->set_unique(dev, master, u);
112 1.1.1.1.2.2 riastrad if (ret)
113 1.1.1.1.2.2 riastrad goto err;
114 1.1.1.1.2.2 riastrad
115 1.1.1.1.2.2 riastrad return 0;
116 1.1.1.1.2.2 riastrad
117 1.1.1.1.2.2 riastrad err:
118 1.1.1.1.2.2 riastrad drm_unset_busid(dev, master);
119 1.1.1.1.2.2 riastrad return ret;
120 1.1.1.1.2.2 riastrad }
121 1.1.1.1.2.2 riastrad
122 1.1.1.1.2.2 riastrad static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)
123 1.1.1.1.2.2 riastrad {
124 1.1.1.1.2.2 riastrad struct drm_master *master = file_priv->master;
125 1.1.1.1.2.2 riastrad int ret;
126 1.1.1.1.2.2 riastrad
127 1.1.1.1.2.2 riastrad if (master->unique != NULL)
128 1.1.1.1.2.2 riastrad drm_unset_busid(dev, master);
129 1.1.1.1.2.2 riastrad
130 1.1.1.1.2.2 riastrad ret = dev->driver->bus->set_busid(dev, master);
131 1.1.1.1.2.2 riastrad if (ret)
132 1.1.1.1.2.2 riastrad goto err;
133 1.1.1.1.2.2 riastrad return 0;
134 1.1.1.1.2.2 riastrad err:
135 1.1.1.1.2.2 riastrad drm_unset_busid(dev, master);
136 1.1.1.1.2.2 riastrad return ret;
137 1.1.1.1.2.2 riastrad }
138 1.1.1.1.2.2 riastrad
139 1.1.1.1.2.2 riastrad /**
140 1.1.1.1.2.2 riastrad * Get a mapping information.
141 1.1.1.1.2.2 riastrad *
142 1.1.1.1.2.2 riastrad * \param inode device inode.
143 1.1.1.1.2.2 riastrad * \param file_priv DRM file private.
144 1.1.1.1.2.2 riastrad * \param cmd command.
145 1.1.1.1.2.2 riastrad * \param arg user argument, pointing to a drm_map structure.
146 1.1.1.1.2.2 riastrad *
147 1.1.1.1.2.2 riastrad * \return zero on success or a negative number on failure.
148 1.1.1.1.2.2 riastrad *
149 1.1.1.1.2.2 riastrad * Searches for the mapping with the specified offset and copies its information
150 1.1.1.1.2.2 riastrad * into userspace
151 1.1.1.1.2.2 riastrad */
152 1.1.1.1.2.2 riastrad int drm_getmap(struct drm_device *dev, void *data,
153 1.1.1.1.2.2 riastrad struct drm_file *file_priv)
154 1.1.1.1.2.2 riastrad {
155 1.1.1.1.2.2 riastrad struct drm_map *map = data;
156 1.1.1.1.2.2 riastrad struct drm_map_list *r_list = NULL;
157 1.1.1.1.2.2 riastrad struct list_head *list;
158 1.1.1.1.2.2 riastrad int idx;
159 1.1.1.1.2.2 riastrad int i;
160 1.1.1.1.2.2 riastrad
161 1.1.1.1.2.2 riastrad idx = map->offset;
162 1.1.1.1.2.2 riastrad if (idx < 0)
163 1.1.1.1.2.2 riastrad return -EINVAL;
164 1.1.1.1.2.2 riastrad
165 1.1.1.1.2.2 riastrad i = 0;
166 1.1.1.1.2.2 riastrad mutex_lock(&dev->struct_mutex);
167 1.1.1.1.2.2 riastrad list_for_each(list, &dev->maplist) {
168 1.1.1.1.2.2 riastrad if (i == idx) {
169 1.1.1.1.2.2 riastrad r_list = list_entry(list, struct drm_map_list, head);
170 1.1.1.1.2.2 riastrad break;
171 1.1.1.1.2.2 riastrad }
172 1.1.1.1.2.2 riastrad i++;
173 1.1.1.1.2.2 riastrad }
174 1.1.1.1.2.2 riastrad if (!r_list || !r_list->map) {
175 1.1.1.1.2.2 riastrad mutex_unlock(&dev->struct_mutex);
176 1.1.1.1.2.2 riastrad return -EINVAL;
177 1.1.1.1.2.2 riastrad }
178 1.1.1.1.2.2 riastrad
179 1.1.1.1.2.2 riastrad map->offset = r_list->map->offset;
180 1.1.1.1.2.2 riastrad map->size = r_list->map->size;
181 1.1.1.1.2.2 riastrad map->type = r_list->map->type;
182 1.1.1.1.2.2 riastrad map->flags = r_list->map->flags;
183 1.1.1.1.2.2 riastrad map->handle = (void *)(unsigned long) r_list->user_token;
184 1.1.1.1.2.2 riastrad map->mtrr = r_list->map->mtrr;
185 1.1.1.1.2.2 riastrad mutex_unlock(&dev->struct_mutex);
186 1.1.1.1.2.2 riastrad
187 1.1.1.1.2.2 riastrad return 0;
188 1.1.1.1.2.2 riastrad }
189 1.1.1.1.2.2 riastrad
190 1.1.1.1.2.2 riastrad /**
191 1.1.1.1.2.2 riastrad * Get client information.
192 1.1.1.1.2.2 riastrad *
193 1.1.1.1.2.2 riastrad * \param inode device inode.
194 1.1.1.1.2.2 riastrad * \param file_priv DRM file private.
195 1.1.1.1.2.2 riastrad * \param cmd command.
196 1.1.1.1.2.2 riastrad * \param arg user argument, pointing to a drm_client structure.
197 1.1.1.1.2.2 riastrad *
198 1.1.1.1.2.2 riastrad * \return zero on success or a negative number on failure.
199 1.1.1.1.2.2 riastrad *
200 1.1.1.1.2.2 riastrad * Searches for the client with the specified index and copies its information
201 1.1.1.1.2.2 riastrad * into userspace
202 1.1.1.1.2.2 riastrad */
203 1.1.1.1.2.2 riastrad int drm_getclient(struct drm_device *dev, void *data,
204 1.1.1.1.2.2 riastrad struct drm_file *file_priv)
205 1.1.1.1.2.2 riastrad {
206 1.1.1.1.2.2 riastrad struct drm_client *client = data;
207 1.1.1.1.2.2 riastrad struct drm_file *pt;
208 1.1.1.1.2.2 riastrad int idx;
209 1.1.1.1.2.2 riastrad int i;
210 1.1.1.1.2.2 riastrad
211 1.1.1.1.2.2 riastrad idx = client->idx;
212 1.1.1.1.2.2 riastrad i = 0;
213 1.1.1.1.2.2 riastrad
214 1.1.1.1.2.2 riastrad mutex_lock(&dev->struct_mutex);
215 1.1.1.1.2.2 riastrad list_for_each_entry(pt, &dev->filelist, lhead) {
216 1.1.1.1.2.2 riastrad if (i++ >= idx) {
217 1.1.1.1.2.2 riastrad client->auth = pt->authenticated;
218 1.1.1.1.2.4 riastrad #ifdef __NetBSD__ /* XXX Too scary to contemplate. */
219 1.1.1.1.2.4 riastrad client->pid = -1;
220 1.1.1.1.2.4 riastrad client->uid = -1;
221 1.1.1.1.2.4 riastrad #else
222 1.1.1.1.2.2 riastrad client->pid = pid_vnr(pt->pid);
223 1.1.1.1.2.2 riastrad client->uid = from_kuid_munged(current_user_ns(), pt->uid);
224 1.1.1.1.2.4 riastrad #endif
225 1.1.1.1.2.2 riastrad client->magic = pt->magic;
226 1.1.1.1.2.2 riastrad client->iocs = pt->ioctl_count;
227 1.1.1.1.2.2 riastrad mutex_unlock(&dev->struct_mutex);
228 1.1.1.1.2.2 riastrad
229 1.1.1.1.2.2 riastrad return 0;
230 1.1.1.1.2.2 riastrad }
231 1.1.1.1.2.2 riastrad }
232 1.1.1.1.2.2 riastrad mutex_unlock(&dev->struct_mutex);
233 1.1.1.1.2.2 riastrad
234 1.1.1.1.2.2 riastrad return -EINVAL;
235 1.1.1.1.2.2 riastrad }
236 1.1.1.1.2.2 riastrad
237 1.1.1.1.2.2 riastrad /**
238 1.1.1.1.2.2 riastrad * Get statistics information.
239 1.1.1.1.2.2 riastrad *
240 1.1.1.1.2.2 riastrad * \param inode device inode.
241 1.1.1.1.2.2 riastrad * \param file_priv DRM file private.
242 1.1.1.1.2.2 riastrad * \param cmd command.
243 1.1.1.1.2.2 riastrad * \param arg user argument, pointing to a drm_stats structure.
244 1.1.1.1.2.2 riastrad *
245 1.1.1.1.2.2 riastrad * \return zero on success or a negative number on failure.
246 1.1.1.1.2.2 riastrad */
247 1.1.1.1.2.2 riastrad int drm_getstats(struct drm_device *dev, void *data,
248 1.1.1.1.2.2 riastrad struct drm_file *file_priv)
249 1.1.1.1.2.2 riastrad {
250 1.1.1.1.2.2 riastrad struct drm_stats *stats = data;
251 1.1.1.1.2.2 riastrad int i;
252 1.1.1.1.2.2 riastrad
253 1.1.1.1.2.2 riastrad memset(stats, 0, sizeof(*stats));
254 1.1.1.1.2.2 riastrad
255 1.1.1.1.2.2 riastrad for (i = 0; i < dev->counters; i++) {
256 1.1.1.1.2.2 riastrad if (dev->types[i] == _DRM_STAT_LOCK)
257 1.1.1.1.2.2 riastrad stats->data[i].value =
258 1.1.1.1.2.2 riastrad (file_priv->master->lock.hw_lock ? file_priv->master->lock.hw_lock->lock : 0);
259 1.1.1.1.2.2 riastrad else
260 1.1.1.1.2.2 riastrad stats->data[i].value = atomic_read(&dev->counts[i]);
261 1.1.1.1.2.2 riastrad stats->data[i].type = dev->types[i];
262 1.1.1.1.2.2 riastrad }
263 1.1.1.1.2.2 riastrad
264 1.1.1.1.2.2 riastrad stats->count = dev->counters;
265 1.1.1.1.2.2 riastrad
266 1.1.1.1.2.2 riastrad return 0;
267 1.1.1.1.2.2 riastrad }
268 1.1.1.1.2.2 riastrad
269 1.1.1.1.2.2 riastrad /**
270 1.1.1.1.2.2 riastrad * Get device/driver capabilities
271 1.1.1.1.2.2 riastrad */
272 1.1.1.1.2.2 riastrad int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
273 1.1.1.1.2.2 riastrad {
274 1.1.1.1.2.2 riastrad struct drm_get_cap *req = data;
275 1.1.1.1.2.2 riastrad
276 1.1.1.1.2.2 riastrad req->value = 0;
277 1.1.1.1.2.2 riastrad switch (req->capability) {
278 1.1.1.1.2.2 riastrad case DRM_CAP_DUMB_BUFFER:
279 1.1.1.1.2.2 riastrad if (dev->driver->dumb_create)
280 1.1.1.1.2.2 riastrad req->value = 1;
281 1.1.1.1.2.2 riastrad break;
282 1.1.1.1.2.2 riastrad case DRM_CAP_VBLANK_HIGH_CRTC:
283 1.1.1.1.2.2 riastrad req->value = 1;
284 1.1.1.1.2.2 riastrad break;
285 1.1.1.1.2.2 riastrad case DRM_CAP_DUMB_PREFERRED_DEPTH:
286 1.1.1.1.2.2 riastrad req->value = dev->mode_config.preferred_depth;
287 1.1.1.1.2.2 riastrad break;
288 1.1.1.1.2.2 riastrad case DRM_CAP_DUMB_PREFER_SHADOW:
289 1.1.1.1.2.2 riastrad req->value = dev->mode_config.prefer_shadow;
290 1.1.1.1.2.2 riastrad break;
291 1.1.1.1.2.2 riastrad case DRM_CAP_PRIME:
292 1.1.1.1.2.2 riastrad req->value |= dev->driver->prime_fd_to_handle ? DRM_PRIME_CAP_IMPORT : 0;
293 1.1.1.1.2.2 riastrad req->value |= dev->driver->prime_handle_to_fd ? DRM_PRIME_CAP_EXPORT : 0;
294 1.1.1.1.2.2 riastrad break;
295 1.1.1.1.2.2 riastrad case DRM_CAP_TIMESTAMP_MONOTONIC:
296 1.1.1.1.2.2 riastrad req->value = drm_timestamp_monotonic;
297 1.1.1.1.2.2 riastrad break;
298 1.1.1.1.2.2 riastrad default:
299 1.1.1.1.2.2 riastrad return -EINVAL;
300 1.1.1.1.2.2 riastrad }
301 1.1.1.1.2.2 riastrad return 0;
302 1.1.1.1.2.2 riastrad }
303 1.1.1.1.2.2 riastrad
304 1.1.1.1.2.2 riastrad /**
305 1.1.1.1.2.2 riastrad * Setversion ioctl.
306 1.1.1.1.2.2 riastrad *
307 1.1.1.1.2.2 riastrad * \param inode device inode.
308 1.1.1.1.2.2 riastrad * \param file_priv DRM file private.
309 1.1.1.1.2.2 riastrad * \param cmd command.
310 1.1.1.1.2.2 riastrad * \param arg user argument, pointing to a drm_lock structure.
311 1.1.1.1.2.2 riastrad * \return zero on success or negative number on failure.
312 1.1.1.1.2.2 riastrad *
313 1.1.1.1.2.2 riastrad * Sets the requested interface version
314 1.1.1.1.2.2 riastrad */
315 1.1.1.1.2.2 riastrad int drm_setversion(struct drm_device *dev, void *data, struct drm_file *file_priv)
316 1.1.1.1.2.2 riastrad {
317 1.1.1.1.2.2 riastrad struct drm_set_version *sv = data;
318 1.1.1.1.2.2 riastrad int if_version, retcode = 0;
319 1.1.1.1.2.2 riastrad
320 1.1.1.1.2.2 riastrad if (sv->drm_di_major != -1) {
321 1.1.1.1.2.2 riastrad if (sv->drm_di_major != DRM_IF_MAJOR ||
322 1.1.1.1.2.2 riastrad sv->drm_di_minor < 0 || sv->drm_di_minor > DRM_IF_MINOR) {
323 1.1.1.1.2.2 riastrad retcode = -EINVAL;
324 1.1.1.1.2.2 riastrad goto done;
325 1.1.1.1.2.2 riastrad }
326 1.1.1.1.2.2 riastrad if_version = DRM_IF_VERSION(sv->drm_di_major,
327 1.1.1.1.2.2 riastrad sv->drm_di_minor);
328 1.1.1.1.2.2 riastrad dev->if_version = max(if_version, dev->if_version);
329 1.1.1.1.2.2 riastrad if (sv->drm_di_minor >= 1) {
330 1.1.1.1.2.2 riastrad /*
331 1.1.1.1.2.2 riastrad * Version 1.1 includes tying of DRM to specific device
332 1.1.1.1.2.2 riastrad * Version 1.4 has proper PCI domain support
333 1.1.1.1.2.2 riastrad */
334 1.1.1.1.2.2 riastrad retcode = drm_set_busid(dev, file_priv);
335 1.1.1.1.2.2 riastrad if (retcode)
336 1.1.1.1.2.2 riastrad goto done;
337 1.1.1.1.2.2 riastrad }
338 1.1.1.1.2.2 riastrad }
339 1.1.1.1.2.2 riastrad
340 1.1.1.1.2.2 riastrad if (sv->drm_dd_major != -1) {
341 1.1.1.1.2.2 riastrad if (sv->drm_dd_major != dev->driver->major ||
342 1.1.1.1.2.2 riastrad sv->drm_dd_minor < 0 || sv->drm_dd_minor >
343 1.1.1.1.2.2 riastrad dev->driver->minor) {
344 1.1.1.1.2.2 riastrad retcode = -EINVAL;
345 1.1.1.1.2.2 riastrad goto done;
346 1.1.1.1.2.2 riastrad }
347 1.1.1.1.2.2 riastrad
348 1.1.1.1.2.2 riastrad if (dev->driver->set_version)
349 1.1.1.1.2.2 riastrad dev->driver->set_version(dev, sv);
350 1.1.1.1.2.2 riastrad }
351 1.1.1.1.2.2 riastrad
352 1.1.1.1.2.2 riastrad done:
353 1.1.1.1.2.2 riastrad sv->drm_di_major = DRM_IF_MAJOR;
354 1.1.1.1.2.2 riastrad sv->drm_di_minor = DRM_IF_MINOR;
355 1.1.1.1.2.2 riastrad sv->drm_dd_major = dev->driver->major;
356 1.1.1.1.2.2 riastrad sv->drm_dd_minor = dev->driver->minor;
357 1.1.1.1.2.2 riastrad
358 1.1.1.1.2.2 riastrad return retcode;
359 1.1.1.1.2.2 riastrad }
360 1.1.1.1.2.2 riastrad
361 1.1.1.1.2.2 riastrad /** No-op ioctl. */
362 1.1.1.1.2.2 riastrad int drm_noop(struct drm_device *dev, void *data,
363 1.1.1.1.2.2 riastrad struct drm_file *file_priv)
364 1.1.1.1.2.2 riastrad {
365 1.1.1.1.2.2 riastrad DRM_DEBUG("\n");
366 1.1.1.1.2.2 riastrad return 0;
367 1.1.1.1.2.2 riastrad }
368 1.1.1.1.2.2 riastrad EXPORT_SYMBOL(drm_noop);
369