aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/radeon_cp.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-08-25 05:22:43 -0400
committerDave Airlie <airlied@optimus.(none)>2007-10-14 20:38:19 -0400
commit20caafa6ecb2487d9b223aa33e7cc704f912a758 (patch)
tree7df033fdee81305dad0a67ceba79f51ead7c1b8b /drivers/char/drm/radeon_cp.c
parent23fd50450a34f2558070ceabb0bfebc1c9604af5 (diff)
drm: Remove DRM_ERR OS macro.
This was used to make all ioctl handlers return -errno on linux and errno on *BSD. Instead, just return -errno in shared code, and flip sign on return f shared code to *BSD code. Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/radeon_cp.c')
-rw-r--r--drivers/char/drm/radeon_cp.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index af5790f8fd53..a023fce3f1b1 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -889,7 +889,7 @@ static int radeon_do_pixcache_flush(drm_radeon_private_t * dev_priv)
889 DRM_ERROR("failed!\n"); 889 DRM_ERROR("failed!\n");
890 radeon_status(dev_priv); 890 radeon_status(dev_priv);
891#endif 891#endif
892 return DRM_ERR(EBUSY); 892 return -EBUSY;
893} 893}
894 894
895static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries) 895static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries)
@@ -910,7 +910,7 @@ static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries)
910 DRM_ERROR("failed!\n"); 910 DRM_ERROR("failed!\n");
911 radeon_status(dev_priv); 911 radeon_status(dev_priv);
912#endif 912#endif
913 return DRM_ERR(EBUSY); 913 return -EBUSY;
914} 914}
915 915
916static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv) 916static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv)
@@ -936,7 +936,7 @@ static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv)
936 DRM_ERROR("failed!\n"); 936 DRM_ERROR("failed!\n");
937 radeon_status(dev_priv); 937 radeon_status(dev_priv);
938#endif 938#endif
939 return DRM_ERR(EBUSY); 939 return -EBUSY;
940} 940}
941 941
942/* ================================================================ 942/* ================================================================
@@ -1394,7 +1394,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1394 if ((dev_priv->flags & RADEON_NEW_MEMMAP) && !dev_priv->new_memmap) { 1394 if ((dev_priv->flags & RADEON_NEW_MEMMAP) && !dev_priv->new_memmap) {
1395 DRM_ERROR("Cannot initialise DRM on this card\nThis card requires a new X.org DDX for 3D\n"); 1395 DRM_ERROR("Cannot initialise DRM on this card\nThis card requires a new X.org DDX for 3D\n");
1396 radeon_do_cleanup_cp(dev); 1396 radeon_do_cleanup_cp(dev);
1397 return DRM_ERR(EINVAL); 1397 return -EINVAL;
1398 } 1398 }
1399 1399
1400 if (init->is_pci && (dev_priv->flags & RADEON_IS_AGP)) { 1400 if (init->is_pci && (dev_priv->flags & RADEON_IS_AGP)) {
@@ -1409,7 +1409,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1409 if ((!(dev_priv->flags & RADEON_IS_AGP)) && !dev->sg) { 1409 if ((!(dev_priv->flags & RADEON_IS_AGP)) && !dev->sg) {
1410 DRM_ERROR("PCI GART memory not allocated!\n"); 1410 DRM_ERROR("PCI GART memory not allocated!\n");
1411 radeon_do_cleanup_cp(dev); 1411 radeon_do_cleanup_cp(dev);
1412 return DRM_ERR(EINVAL); 1412 return -EINVAL;
1413 } 1413 }
1414 1414
1415 dev_priv->usec_timeout = init->usec_timeout; 1415 dev_priv->usec_timeout = init->usec_timeout;
@@ -1417,7 +1417,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1417 dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT) { 1417 dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT) {
1418 DRM_DEBUG("TIMEOUT problem!\n"); 1418 DRM_DEBUG("TIMEOUT problem!\n");
1419 radeon_do_cleanup_cp(dev); 1419 radeon_do_cleanup_cp(dev);
1420 return DRM_ERR(EINVAL); 1420 return -EINVAL;
1421 } 1421 }
1422 1422
1423 /* Enable vblank on CRTC1 for older X servers 1423 /* Enable vblank on CRTC1 for older X servers
@@ -1446,7 +1446,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1446 (init->cp_mode != RADEON_CSQ_PRIBM_INDBM)) { 1446 (init->cp_mode != RADEON_CSQ_PRIBM_INDBM)) {
1447 DRM_DEBUG("BAD cp_mode (%x)!\n", init->cp_mode); 1447 DRM_DEBUG("BAD cp_mode (%x)!\n", init->cp_mode);
1448 radeon_do_cleanup_cp(dev); 1448 radeon_do_cleanup_cp(dev);
1449 return DRM_ERR(EINVAL); 1449 return -EINVAL;
1450 } 1450 }
1451 1451
1452 switch (init->fb_bpp) { 1452 switch (init->fb_bpp) {
@@ -1515,27 +1515,27 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1515 if (!dev_priv->sarea) { 1515 if (!dev_priv->sarea) {
1516 DRM_ERROR("could not find sarea!\n"); 1516 DRM_ERROR("could not find sarea!\n");
1517 radeon_do_cleanup_cp(dev); 1517 radeon_do_cleanup_cp(dev);
1518 return DRM_ERR(EINVAL); 1518 return -EINVAL;
1519 } 1519 }
1520 1520
1521 dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset); 1521 dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset);
1522 if (!dev_priv->cp_ring) { 1522 if (!dev_priv->cp_ring) {
1523 DRM_ERROR("could not find cp ring region!\n"); 1523 DRM_ERROR("could not find cp ring region!\n");
1524 radeon_do_cleanup_cp(dev); 1524 radeon_do_cleanup_cp(dev);
1525 return DRM_ERR(EINVAL); 1525 return -EINVAL;
1526 } 1526 }
1527 dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); 1527 dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset);
1528 if (!dev_priv->ring_rptr) { 1528 if (!dev_priv->ring_rptr) {
1529 DRM_ERROR("could not find ring read pointer!\n"); 1529 DRM_ERROR("could not find ring read pointer!\n");
1530 radeon_do_cleanup_cp(dev); 1530 radeon_do_cleanup_cp(dev);
1531 return DRM_ERR(EINVAL); 1531 return -EINVAL;
1532 } 1532 }
1533 dev->agp_buffer_token = init->buffers_offset; 1533 dev->agp_buffer_token = init->buffers_offset;
1534 dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); 1534 dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset);
1535 if (!dev->agp_buffer_map) { 1535 if (!dev->agp_buffer_map) {
1536 DRM_ERROR("could not find dma buffer region!\n"); 1536 DRM_ERROR("could not find dma buffer region!\n");
1537 radeon_do_cleanup_cp(dev); 1537 radeon_do_cleanup_cp(dev);
1538 return DRM_ERR(EINVAL); 1538 return -EINVAL;
1539 } 1539 }
1540 1540
1541 if (init->gart_textures_offset) { 1541 if (init->gart_textures_offset) {
@@ -1544,7 +1544,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1544 if (!dev_priv->gart_textures) { 1544 if (!dev_priv->gart_textures) {
1545 DRM_ERROR("could not find GART texture region!\n"); 1545 DRM_ERROR("could not find GART texture region!\n");
1546 radeon_do_cleanup_cp(dev); 1546 radeon_do_cleanup_cp(dev);
1547 return DRM_ERR(EINVAL); 1547 return -EINVAL;
1548 } 1548 }
1549 } 1549 }
1550 1550
@@ -1562,7 +1562,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1562 !dev->agp_buffer_map->handle) { 1562 !dev->agp_buffer_map->handle) {
1563 DRM_ERROR("could not find ioremap agp regions!\n"); 1563 DRM_ERROR("could not find ioremap agp regions!\n");
1564 radeon_do_cleanup_cp(dev); 1564 radeon_do_cleanup_cp(dev);
1565 return DRM_ERR(EINVAL); 1565 return -EINVAL;
1566 } 1566 }
1567 } else 1567 } else
1568#endif 1568#endif
@@ -1710,14 +1710,14 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1710 DRM_ERROR 1710 DRM_ERROR
1711 ("Cannot use PCI Express without GART in FB memory\n"); 1711 ("Cannot use PCI Express without GART in FB memory\n");
1712 radeon_do_cleanup_cp(dev); 1712 radeon_do_cleanup_cp(dev);
1713 return DRM_ERR(EINVAL); 1713 return -EINVAL;
1714 } 1714 }
1715 } 1715 }
1716 1716
1717 if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { 1717 if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) {
1718 DRM_ERROR("failed to init PCI GART!\n"); 1718 DRM_ERROR("failed to init PCI GART!\n");
1719 radeon_do_cleanup_cp(dev); 1719 radeon_do_cleanup_cp(dev);
1720 return DRM_ERR(ENOMEM); 1720 return -ENOMEM;
1721 } 1721 }
1722 1722
1723 /* Turn on PCI GART */ 1723 /* Turn on PCI GART */
@@ -1797,7 +1797,7 @@ static int radeon_do_resume_cp(struct drm_device * dev)
1797 1797
1798 if (!dev_priv) { 1798 if (!dev_priv) {
1799 DRM_ERROR("Called with no initialization\n"); 1799 DRM_ERROR("Called with no initialization\n");
1800 return DRM_ERR(EINVAL); 1800 return -EINVAL;
1801 } 1801 }
1802 1802
1803 DRM_DEBUG("Starting radeon_do_resume_cp()\n"); 1803 DRM_DEBUG("Starting radeon_do_resume_cp()\n");
@@ -1845,7 +1845,7 @@ int radeon_cp_init(DRM_IOCTL_ARGS)
1845 return radeon_do_cleanup_cp(dev); 1845 return radeon_do_cleanup_cp(dev);
1846 } 1846 }
1847 1847
1848 return DRM_ERR(EINVAL); 1848 return -EINVAL;
1849} 1849}
1850 1850
1851int radeon_cp_start(DRM_IOCTL_ARGS) 1851int radeon_cp_start(DRM_IOCTL_ARGS)
@@ -1973,7 +1973,7 @@ int radeon_cp_reset(DRM_IOCTL_ARGS)
1973 1973
1974 if (!dev_priv) { 1974 if (!dev_priv) {
1975 DRM_DEBUG("%s called before init done\n", __FUNCTION__); 1975 DRM_DEBUG("%s called before init done\n", __FUNCTION__);
1976 return DRM_ERR(EINVAL); 1976 return -EINVAL;
1977 } 1977 }
1978 1978
1979 radeon_do_cp_reset(dev_priv); 1979 radeon_do_cp_reset(dev_priv);
@@ -2167,7 +2167,7 @@ int radeon_wait_ring(drm_radeon_private_t * dev_priv, int n)
2167 radeon_status(dev_priv); 2167 radeon_status(dev_priv);
2168 DRM_ERROR("failed!\n"); 2168 DRM_ERROR("failed!\n");
2169#endif 2169#endif
2170 return DRM_ERR(EBUSY); 2170 return -EBUSY;
2171} 2171}
2172 2172
2173static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev, 2173static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev,
@@ -2179,16 +2179,16 @@ static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev,
2179 for (i = d->granted_count; i < d->request_count; i++) { 2179 for (i = d->granted_count; i < d->request_count; i++) {
2180 buf = radeon_freelist_get(dev); 2180 buf = radeon_freelist_get(dev);
2181 if (!buf) 2181 if (!buf)
2182 return DRM_ERR(EBUSY); /* NOTE: broken client */ 2182 return -EBUSY; /* NOTE: broken client */
2183 2183
2184 buf->filp = filp; 2184 buf->filp = filp;
2185 2185
2186 if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, 2186 if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx,
2187 sizeof(buf->idx))) 2187 sizeof(buf->idx)))
2188 return DRM_ERR(EFAULT); 2188 return -EFAULT;
2189 if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, 2189 if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total,
2190 sizeof(buf->total))) 2190 sizeof(buf->total)))
2191 return DRM_ERR(EFAULT); 2191 return -EFAULT;
2192 2192
2193 d->granted_count++; 2193 d->granted_count++;
2194 } 2194 }
@@ -2212,7 +2212,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS)
2212 if (d.send_count != 0) { 2212 if (d.send_count != 0) {
2213 DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", 2213 DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
2214 DRM_CURRENTPID, d.send_count); 2214 DRM_CURRENTPID, d.send_count);
2215 return DRM_ERR(EINVAL); 2215 return -EINVAL;
2216 } 2216 }
2217 2217
2218 /* We'll send you buffers. 2218 /* We'll send you buffers.
@@ -2220,7 +2220,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS)
2220 if (d.request_count < 0 || d.request_count > dma->buf_count) { 2220 if (d.request_count < 0 || d.request_count > dma->buf_count) {
2221 DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", 2221 DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
2222 DRM_CURRENTPID, d.request_count, dma->buf_count); 2222 DRM_CURRENTPID, d.request_count, dma->buf_count);
2223 return DRM_ERR(EINVAL); 2223 return -EINVAL;
2224 } 2224 }
2225 2225
2226 d.granted_count = 0; 2226 d.granted_count = 0;
@@ -2241,7 +2241,7 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
2241 2241
2242 dev_priv = drm_alloc(sizeof(drm_radeon_private_t), DRM_MEM_DRIVER); 2242 dev_priv = drm_alloc(sizeof(drm_radeon_private_t), DRM_MEM_DRIVER);
2243 if (dev_priv == NULL) 2243 if (dev_priv == NULL)
2244 return DRM_ERR(ENOMEM); 2244 return -ENOMEM;
2245 2245
2246 memset(dev_priv, 0, sizeof(drm_radeon_private_t)); 2246 memset(dev_priv, 0, sizeof(drm_radeon_private_t));
2247 dev->dev_private = (void *)dev_priv; 2247 dev->dev_private = (void *)dev_priv;