Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates-src > by-pkgid > 45e4f5da4952e351d997dd2c88575427 > files > 58

kernel-5.3.2-1.mga7.src.rpm

Adapt mach64 to build with 2.6.31 series kernels

Signed-off-by: Thomas Backlund <tmb@mandriva.org>

diff -urp linux-2.6.31-rc3-git5-mnb1/drivers/gpu/drm/mach64/mach64_dma.c linux-2.6.31-rc3-git5-mnb1/drivers/gpu/drm/mach64.fixed/mach64_dma.c
--- linux-2.6.31-rc3-git5-mnb1/drivers/gpu/drm/mach64/mach64_dma.c	2009-07-23 00:24:12.000000000 +0300
+++ linux-2.6.31-rc3-git5-mnb1/drivers/gpu/drm/mach64.fixed/mach64_dma.c	2009-07-23 02:28:21.000000000 +0300
@@ -1006,7 +1006,7 @@ static int mach64_do_dma_init(struct drm
 
 	DRM_DEBUG("\n");
 
-	dev_priv = drm_alloc(sizeof(drm_mach64_private_t), DRM_MEM_DRIVER);
+	dev_priv = kmalloc(sizeof(drm_mach64_private_t), GFP_KERNEL);
 	if (dev_priv == NULL)
 		return -ENOMEM;
 
@@ -1386,8 +1386,7 @@ int mach64_do_cleanup_dma(struct drm_dev
 
 		mach64_destroy_freelist(dev);
 
-		drm_free(dev_priv, sizeof(drm_mach64_private_t),
-			 DRM_MEM_DRIVER);
+		kfree(dev_priv);
 		dev->dev_private = NULL;
 	}
 
@@ -1476,8 +1475,8 @@ int mach64_init_freelist(struct drm_devi
 	for (i = 0; i < dma->buf_count; i++) {
 		if ((entry =
 		     (drm_mach64_freelist_t *)
-		     drm_alloc(sizeof(drm_mach64_freelist_t),
-			       DRM_MEM_BUFLISTS)) == NULL)
+		     kmalloc(sizeof(drm_mach64_freelist_t),
+			       GFP_KERNEL)) == NULL)
 			return -ENOMEM;
 		memset(entry, 0, sizeof(drm_mach64_freelist_t));
 		entry->buf = dma->buflist[i];
@@ -1500,18 +1499,18 @@ void mach64_destroy_freelist(struct drm_
 	list_for_each_safe(ptr, tmp, &dev_priv->pending) {
 		list_del(ptr);
 		entry = list_entry(ptr, drm_mach64_freelist_t, list);
-		drm_free(entry, sizeof(*entry), DRM_MEM_BUFLISTS);
+		kfree(entry);
 	}
 	list_for_each_safe(ptr, tmp, &dev_priv->placeholders) {
 		list_del(ptr);
 		entry = list_entry(ptr, drm_mach64_freelist_t, list);
-		drm_free(entry, sizeof(*entry), DRM_MEM_BUFLISTS);
+		kfree(entry);
 	}
 
 	list_for_each_safe(ptr, tmp, &dev_priv->free_list) {
 		list_del(ptr);
 		entry = list_entry(ptr, drm_mach64_freelist_t, list);
-		drm_free(entry, sizeof(*entry), DRM_MEM_BUFLISTS);
+		kfree(entry);
 	}
 }
 
diff -urp linux-2.6.31-rc3-git5-mnb1/drivers/gpu/drm/mach64/mach64_state.c linux-2.6.31-rc3-git5-mnb1/drivers/gpu/drm/mach64.fixed/mach64_state.c
--- linux-2.6.31-rc3-git5-mnb1/drivers/gpu/drm/mach64/mach64_state.c	2009-07-23 00:24:12.000000000 +0300
+++ linux-2.6.31-rc3-git5-mnb1/drivers/gpu/drm/mach64.fixed/mach64_state.c	2009-07-23 02:29:24.000000000 +0300
@@ -490,12 +490,12 @@ static __inline__ int copy_from_user_ver
 	unsigned long n = bytes;	/* dwords remaining in buffer */
 	u32 *from, *orig_from;
 
-	from = drm_alloc(bytes, DRM_MEM_DRIVER);
+	from = kmalloc(bytes, GFP_KERNEL);
 	if (from == NULL)
 		return -ENOMEM;
 
 	if (DRM_COPY_FROM_USER(from, ufrom, bytes)) {
-		drm_free(from, bytes, DRM_MEM_DRIVER);
+		kfree(from);
 		return -EFAULT;
 	}
 	orig_from = from; /* we'll be modifying the "from" ptr, so save it */
@@ -526,19 +526,19 @@ static __inline__ int copy_from_user_ver
 				to += count;
 			} else {
 				DRM_ERROR("Got bad command: 0x%04x\n", reg);
-				drm_free(orig_from, bytes, DRM_MEM_DRIVER);
+				kfree(orig_from);
 				return -EACCES;
 			}
 		} else {
 			DRM_ERROR
 			    ("Got bad command count(=%u) dwords remaining=%lu\n",
 			     count, n);
-			drm_free(orig_from, bytes, DRM_MEM_DRIVER);
+			kfree(orig_from);
 			return -EINVAL;
 		}
 	}
 
-	drm_free(orig_from, bytes, DRM_MEM_DRIVER);
+	kfree(orig_from);
 	if (n == 0)
 		return 0;
 	else {