aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/radeon_irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/radeon_irq.c')
-rw-r--r--drivers/char/drm/radeon_irq.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/char/drm/radeon_irq.c b/drivers/char/drm/radeon_irq.c
index ad8a0ac7182e..f89e57665b64 100644
--- a/drivers/char/drm/radeon_irq.c
+++ b/drivers/char/drm/radeon_irq.c
@@ -155,7 +155,7 @@ int radeon_driver_vblank_do_wait(struct drm_device * dev, unsigned int *sequence
155 atomic_t *counter; 155 atomic_t *counter;
156 if (!dev_priv) { 156 if (!dev_priv) {
157 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 157 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
158 return DRM_ERR(EINVAL); 158 return -EINVAL;
159 } 159 }
160 160
161 if (crtc == DRM_RADEON_VBLANK_CRTC1) { 161 if (crtc == DRM_RADEON_VBLANK_CRTC1) {
@@ -165,7 +165,7 @@ int radeon_driver_vblank_do_wait(struct drm_device * dev, unsigned int *sequence
165 counter = &dev->vbl_received2; 165 counter = &dev->vbl_received2;
166 ack |= RADEON_CRTC2_VBLANK_STAT; 166 ack |= RADEON_CRTC2_VBLANK_STAT;
167 } else 167 } else
168 return DRM_ERR(EINVAL); 168 return -EINVAL;
169 169
170 radeon_acknowledge_irqs(dev_priv, ack); 170 radeon_acknowledge_irqs(dev_priv, ack);
171 171
@@ -196,28 +196,24 @@ int radeon_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence)
196 196
197/* Needs the lock as it touches the ring. 197/* Needs the lock as it touches the ring.
198 */ 198 */
199int radeon_irq_emit(DRM_IOCTL_ARGS) 199int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_priv)
200{ 200{
201 DRM_DEVICE;
202 drm_radeon_private_t *dev_priv = dev->dev_private; 201 drm_radeon_private_t *dev_priv = dev->dev_private;
203 drm_radeon_irq_emit_t emit; 202 drm_radeon_irq_emit_t *emit = data;
204 int result; 203 int result;
205 204
206 LOCK_TEST_WITH_RETURN(dev, filp); 205 LOCK_TEST_WITH_RETURN(dev, file_priv);
207 206
208 if (!dev_priv) { 207 if (!dev_priv) {
209 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 208 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
210 return DRM_ERR(EINVAL); 209 return -EINVAL;
211 } 210 }
212 211
213 DRM_COPY_FROM_USER_IOCTL(emit, (drm_radeon_irq_emit_t __user *) data,
214 sizeof(emit));
215
216 result = radeon_emit_irq(dev); 212 result = radeon_emit_irq(dev);
217 213
218 if (DRM_COPY_TO_USER(emit.irq_seq, &result, sizeof(int))) { 214 if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) {
219 DRM_ERROR("copy_to_user\n"); 215 DRM_ERROR("copy_to_user\n");
220 return DRM_ERR(EFAULT); 216 return -EFAULT;
221 } 217 }
222 218
223 return 0; 219 return 0;
@@ -225,21 +221,17 @@ int radeon_irq_emit(DRM_IOCTL_ARGS)
225 221
226/* Doesn't need the hardware lock. 222/* Doesn't need the hardware lock.
227 */ 223 */
228int radeon_irq_wait(DRM_IOCTL_ARGS) 224int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_priv)
229{ 225{
230 DRM_DEVICE;
231 drm_radeon_private_t *dev_priv = dev->dev_private; 226 drm_radeon_private_t *dev_priv = dev->dev_private;
232 drm_radeon_irq_wait_t irqwait; 227 drm_radeon_irq_wait_t *irqwait = data;
233 228
234 if (!dev_priv) { 229 if (!dev_priv) {
235 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 230 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
236 return DRM_ERR(EINVAL); 231 return -EINVAL;
237 } 232 }
238 233
239 DRM_COPY_FROM_USER_IOCTL(irqwait, (drm_radeon_irq_wait_t __user *) data, 234 return radeon_wait_irq(dev, irqwait->irq_seq);
240 sizeof(irqwait));
241
242 return radeon_wait_irq(dev, irqwait.irq_seq);
243} 235}
244 236
245static void radeon_enable_interrupt(struct drm_device *dev) 237static void radeon_enable_interrupt(struct drm_device *dev)
@@ -320,7 +312,7 @@ int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value)
320 drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private; 312 drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private;
321 if (value & ~(DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) { 313 if (value & ~(DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) {
322 DRM_ERROR("called with invalid crtc 0x%x\n", (unsigned int)value); 314 DRM_ERROR("called with invalid crtc 0x%x\n", (unsigned int)value);
323 return DRM_ERR(EINVAL); 315 return -EINVAL;
324 } 316 }
325 dev_priv->vblank_crtc = (unsigned int)value; 317 dev_priv->vblank_crtc = (unsigned int)value;
326 radeon_enable_interrupt(dev); 318 radeon_enable_interrupt(dev);