hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/gpu/drm/r128/r128_cce.c
....@@ -29,13 +29,21 @@
2929 * Gareth Hughes <gareth@valinux.com>
3030 */
3131
32
+#include <linux/delay.h>
33
+#include <linux/dma-mapping.h>
3234 #include <linux/firmware.h>
35
+#include <linux/module.h>
3336 #include <linux/platform_device.h>
3437 #include <linux/slab.h>
35
-#include <linux/module.h>
38
+#include <linux/uaccess.h>
3639
37
-#include <drm/drmP.h>
40
+#include <drm/drm_agpsupport.h>
41
+#include <drm/drm_device.h>
42
+#include <drm/drm_file.h>
43
+#include <drm/drm_irq.h>
44
+#include <drm/drm_print.h>
3845 #include <drm/r128_drm.h>
46
+
3947 #include "r128_drv.h"
4048
4149 #define R128_FIFO_DEBUG 0
....@@ -85,7 +93,7 @@
8593 for (i = 0; i < dev_priv->usec_timeout; i++) {
8694 if (!(R128_READ(R128_PC_NGUI_CTLSTAT) & R128_PC_BUSY))
8795 return 0;
88
- DRM_UDELAY(1);
96
+ udelay(1);
8997 }
9098
9199 #if R128_FIFO_DEBUG
....@@ -102,7 +110,7 @@
102110 int slots = R128_READ(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK;
103111 if (slots >= entries)
104112 return 0;
105
- DRM_UDELAY(1);
113
+ udelay(1);
106114 }
107115
108116 #if R128_FIFO_DEBUG
....@@ -124,7 +132,7 @@
124132 r128_do_pixcache_flush(dev_priv);
125133 return 0;
126134 }
127
- DRM_UDELAY(1);
135
+ udelay(1);
128136 }
129137
130138 #if R128_FIFO_DEBUG
....@@ -211,7 +219,7 @@
211219 return r128_do_pixcache_flush(dev_priv);
212220 }
213221 }
214
- DRM_UDELAY(1);
222
+ udelay(1);
215223 }
216224
217225 #if R128_FIFO_DEBUG
....@@ -560,11 +568,12 @@
560568 dev_priv->gart_info.addr = NULL;
561569 dev_priv->gart_info.bus_addr = 0;
562570 dev_priv->gart_info.gart_reg_if = DRM_ATI_GART_PCI;
563
- if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) {
571
+ rc = drm_ati_pcigart_init(dev, &dev_priv->gart_info);
572
+ if (rc) {
564573 DRM_ERROR("failed to init PCI GART!\n");
565574 dev->dev_private = (void *)dev_priv;
566575 r128_do_cleanup_cce(dev);
567
- return -ENOMEM;
576
+ return rc;
568577 }
569578 R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr);
570579 #if IS_ENABLED(CONFIG_AGP)
....@@ -837,7 +846,7 @@
837846 return buf;
838847 }
839848 }
840
- DRM_UDELAY(1);
849
+ udelay(1);
841850 }
842851
843852 DRM_DEBUG("returning NULL!\n");
....@@ -869,7 +878,7 @@
869878 r128_update_ring_snapshot(dev_priv);
870879 if (ring->space >= n)
871880 return 0;
872
- DRM_UDELAY(1);
881
+ udelay(1);
873882 }
874883
875884 /* FIXME: This is being ignored... */
....@@ -915,7 +924,7 @@
915924 */
916925 if (d->send_count != 0) {
917926 DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
918
- DRM_CURRENTPID, d->send_count);
927
+ task_pid_nr(current), d->send_count);
919928 return -EINVAL;
920929 }
921930
....@@ -923,7 +932,7 @@
923932 */
924933 if (d->request_count < 0 || d->request_count > dma->buf_count) {
925934 DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
926
- DRM_CURRENTPID, d->request_count, dma->buf_count);
935
+ task_pid_nr(current), d->request_count, dma->buf_count);
927936 return -EINVAL;
928937 }
929938