[PATCH 2/5] drm: Remove dev_priv_size from struct drm_buf

Damien Lespiau damien.lespiau at intel.com
Wed Jan 8 10:31:49 PST 2014


This field is only used when creating a new buffer and can already be
found in the drm_driver structure, so no need to duplicate the
information for every buffer.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 drivers/gpu/drm/drm_bufs.c | 13 ++++++-------
 include/drm/drmP.h         |  1 -
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index edec31f..3bf8cc5 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -705,8 +705,8 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
 		buf->pending = 0;
 		buf->file_priv = NULL;
 
-		buf->dev_priv_size = dev->driver->dev_priv_size;
-		buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL);
+		buf->dev_private = kzalloc(dev->driver->dev_priv_size,
+					   GFP_KERNEL);
 		if (!buf->dev_private) {
 			/* Set count correctly so we free the proper amount. */
 			entry->buf_count = count;
@@ -902,9 +902,8 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
 			buf->pending = 0;
 			buf->file_priv = NULL;
 
-			buf->dev_priv_size = dev->driver->dev_priv_size;
-			buf->dev_private = kzalloc(buf->dev_priv_size,
-						GFP_KERNEL);
+			buf->dev_private = kzalloc(dev->driver->dev_priv_size,
+						   GFP_KERNEL);
 			if (!buf->dev_private) {
 				/* Set count correctly so we free the proper amount. */
 				entry->buf_count = count;
@@ -1066,8 +1065,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request
 		buf->pending = 0;
 		buf->file_priv = NULL;
 
-		buf->dev_priv_size = dev->driver->dev_priv_size;
-		buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL);
+		buf->dev_private = kzalloc(dev->driver->dev_priv_size,
+					   GFP_KERNEL);
 		if (!buf->dev_private) {
 			/* Set count correctly so we free the proper amount. */
 			entry->buf_count = count;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2fe9b5d..2274274 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -364,7 +364,6 @@ struct drm_buf {
 		DRM_LIST_RECLAIM = 5
 	} list;			       /**< Which list we're on */
 
-	int dev_priv_size;		 /**< Size of buffer private storage */
 	void *dev_private;		 /**< Per-buffer private storage */
 };
 
-- 
1.8.3.1



More information about the dri-devel mailing list