diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-06-21 04:54:17 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-06-21 15:43:46 -0400 |
commit | 46bfdf9a2e8e7067e5e452e0d668d98becd89dbc (patch) | |
tree | b57d7fe59885fbc7bba27df3e34049aeca282b0f | |
parent | a742946a1ba57e24e8be205ea87224c05b38c380 (diff) |
drm: Nuke SET_UNIQUE ioctl
Ever since
commit 2e1868b560315a8b20d688e646c489a5ad93eeae
Author: Eric Anholt <anholt@freebsd.org>
Date: Wed Jun 16 09:25:21 2004 +0000
DRI trunk-20040613 import
the X server supports drm 1.1, thus doesn't call call libdrm's
drmSetBusid - the sole user of this ioctl. When reviewing this note
that for hilarity both the kernel-internal functions (set_busid) and
the libdrm wrapper (drmSetBusid) have names not matching this ioctl
(SET_UNIQUE).
v2: Polish commit message (Emil).
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1466499262-18717-6-git-send-email-daniel.vetter@ffwll.ch
-rw-r--r-- | drivers/gpu/drm/drm_internal.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_ioctl.c | 47 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_pci.c | 51 |
3 files changed, 1 insertions, 100 deletions
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 38401d406532..b86dc9b921a5 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h | |||
@@ -29,9 +29,6 @@ extern struct mutex drm_global_mutex; | |||
29 | void drm_lastclose(struct drm_device *dev); | 29 | void drm_lastclose(struct drm_device *dev); |
30 | 30 | ||
31 | /* drm_pci.c */ | 31 | /* drm_pci.c */ |
32 | int drm_pci_set_unique(struct drm_device *dev, | ||
33 | struct drm_master *master, | ||
34 | struct drm_unique *u); | ||
35 | int drm_irq_by_busid(struct drm_device *dev, void *data, | 32 | int drm_irq_by_busid(struct drm_device *dev, void *data, |
36 | struct drm_file *file_priv); | 33 | struct drm_file *file_priv); |
37 | 34 | ||
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index b7f7d968e4cd..1fa7619face3 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c | |||
@@ -75,51 +75,6 @@ drm_unset_busid(struct drm_device *dev, | |||
75 | master->unique_len = 0; | 75 | master->unique_len = 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | /* | ||
79 | * Set the bus id. | ||
80 | * | ||
81 | * \param inode device inode. | ||
82 | * \param file_priv DRM file private. | ||
83 | * \param cmd command. | ||
84 | * \param arg user argument, pointing to a drm_unique structure. | ||
85 | * \return zero on success or a negative number on failure. | ||
86 | * | ||
87 | * Copies the bus id from userspace into drm_device::unique, and verifies that | ||
88 | * it matches the device this DRM is attached to (EINVAL otherwise). Deprecated | ||
89 | * in interface version 1.1 and will return EBUSY when setversion has requested | ||
90 | * version 1.1 or greater. Also note that KMS is all version 1.1 and later and | ||
91 | * UMS was only ever supported on pci devices. | ||
92 | */ | ||
93 | static int drm_setunique(struct drm_device *dev, void *data, | ||
94 | struct drm_file *file_priv) | ||
95 | { | ||
96 | struct drm_unique *u = data; | ||
97 | struct drm_master *master = file_priv->master; | ||
98 | int ret; | ||
99 | |||
100 | if (master->unique_len || master->unique) | ||
101 | return -EBUSY; | ||
102 | |||
103 | if (!u->unique_len || u->unique_len > 1024) | ||
104 | return -EINVAL; | ||
105 | |||
106 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
107 | return 0; | ||
108 | |||
109 | if (WARN_ON(!dev->pdev)) | ||
110 | return -EINVAL; | ||
111 | |||
112 | ret = drm_pci_set_unique(dev, master, u); | ||
113 | if (ret) | ||
114 | goto err; | ||
115 | |||
116 | return 0; | ||
117 | |||
118 | err: | ||
119 | drm_unset_busid(dev, master); | ||
120 | return ret; | ||
121 | } | ||
122 | |||
123 | static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv) | 78 | static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv) |
124 | { | 79 | { |
125 | struct drm_master *master = file_priv->master; | 80 | struct drm_master *master = file_priv->master; |
@@ -508,7 +463,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = { | |||
508 | DRM_IOCTL_DEF(DRM_IOCTL_SET_CLIENT_CAP, drm_setclientcap, 0), | 463 | DRM_IOCTL_DEF(DRM_IOCTL_SET_CLIENT_CAP, drm_setclientcap, 0), |
509 | DRM_IOCTL_DEF(DRM_IOCTL_SET_VERSION, drm_setversion, DRM_MASTER), | 464 | DRM_IOCTL_DEF(DRM_IOCTL_SET_VERSION, drm_setversion, DRM_MASTER), |
510 | 465 | ||
511 | DRM_IOCTL_DEF(DRM_IOCTL_SET_UNIQUE, drm_setunique, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 466 | DRM_IOCTL_DEF(DRM_IOCTL_SET_UNIQUE, drm_invalid_op, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
512 | DRM_IOCTL_DEF(DRM_IOCTL_BLOCK, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 467 | DRM_IOCTL_DEF(DRM_IOCTL_BLOCK, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
513 | DRM_IOCTL_DEF(DRM_IOCTL_UNBLOCK, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 468 | DRM_IOCTL_DEF(DRM_IOCTL_UNBLOCK, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
514 | DRM_IOCTL_DEF(DRM_IOCTL_AUTH_MAGIC, drm_authmagic, DRM_AUTH|DRM_UNLOCKED|DRM_MASTER), | 469 | DRM_IOCTL_DEF(DRM_IOCTL_AUTH_MAGIC, drm_authmagic, DRM_AUTH|DRM_UNLOCKED|DRM_MASTER), |
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 29d5a548d07a..b2f8f1062d5f 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -144,50 +144,6 @@ int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) | |||
144 | } | 144 | } |
145 | EXPORT_SYMBOL(drm_pci_set_busid); | 145 | EXPORT_SYMBOL(drm_pci_set_busid); |
146 | 146 | ||
147 | int drm_pci_set_unique(struct drm_device *dev, | ||
148 | struct drm_master *master, | ||
149 | struct drm_unique *u) | ||
150 | { | ||
151 | int domain, bus, slot, func, ret; | ||
152 | |||
153 | master->unique_len = u->unique_len; | ||
154 | master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL); | ||
155 | if (!master->unique) { | ||
156 | ret = -ENOMEM; | ||
157 | goto err; | ||
158 | } | ||
159 | |||
160 | if (copy_from_user(master->unique, u->unique, master->unique_len)) { | ||
161 | ret = -EFAULT; | ||
162 | goto err; | ||
163 | } | ||
164 | |||
165 | master->unique[master->unique_len] = '\0'; | ||
166 | |||
167 | /* Return error if the busid submitted doesn't match the device's actual | ||
168 | * busid. | ||
169 | */ | ||
170 | ret = sscanf(master->unique, "PCI:%d:%d:%d", &bus, &slot, &func); | ||
171 | if (ret != 3) { | ||
172 | ret = -EINVAL; | ||
173 | goto err; | ||
174 | } | ||
175 | |||
176 | domain = bus >> 8; | ||
177 | bus &= 0xff; | ||
178 | |||
179 | if ((domain != drm_get_pci_domain(dev)) || | ||
180 | (bus != dev->pdev->bus->number) || | ||
181 | (slot != PCI_SLOT(dev->pdev->devfn)) || | ||
182 | (func != PCI_FUNC(dev->pdev->devfn))) { | ||
183 | ret = -EINVAL; | ||
184 | goto err; | ||
185 | } | ||
186 | return 0; | ||
187 | err: | ||
188 | return ret; | ||
189 | } | ||
190 | |||
191 | static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) | 147 | static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) |
192 | { | 148 | { |
193 | if ((p->busnum >> 8) != drm_get_pci_domain(dev) || | 149 | if ((p->busnum >> 8) != drm_get_pci_domain(dev) || |
@@ -444,13 +400,6 @@ int drm_irq_by_busid(struct drm_device *dev, void *data, | |||
444 | { | 400 | { |
445 | return -EINVAL; | 401 | return -EINVAL; |
446 | } | 402 | } |
447 | |||
448 | int drm_pci_set_unique(struct drm_device *dev, | ||
449 | struct drm_master *master, | ||
450 | struct drm_unique *u) | ||
451 | { | ||
452 | return -EINVAL; | ||
453 | } | ||
454 | #endif | 403 | #endif |
455 | 404 | ||
456 | EXPORT_SYMBOL(drm_pci_init); | 405 | EXPORT_SYMBOL(drm_pci_init); |