summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/mga_dma.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-11-24 05:51:24 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-11-24 05:51:24 +0000
commit3162ea963766ba6b006f688ae05c692d7a955d60 (patch)
treee00bcd0ec8653957deb47b0510513b0034d90177 /sys/dev/pci/drm/mga_dma.c
parent76a1250eebd5c78858b3fadb4399f38cf77c399c (diff)
Instead of having a ``private data'' pointer in the dma buffers, just
ask the driver how large they need the structure we allocate to be, and use inheritance like we do for struct device. Simplifies things a little bit and saves us a pointer.
Diffstat (limited to 'sys/dev/pci/drm/mga_dma.c')
-rw-r--r--sys/dev/pci/drm/mga_dma.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/dev/pci/drm/mga_dma.c b/sys/dev/pci/drm/mga_dma.c
index 992e04ce227..5798718cb05 100644
--- a/sys/dev/pci/drm/mga_dma.c
+++ b/sys/dev/pci/drm/mga_dma.c
@@ -261,7 +261,7 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr
for (i = 0; i < dma->buf_count; i++) {
buf = dma->buflist[i];
- buf_priv = buf->dev_private;
+ buf_priv = (drm_mga_buf_priv_t *)buf;
entry = drm_calloc(1, sizeof(drm_mga_freelist_t),
DRM_MEM_DRIVER);
@@ -271,7 +271,6 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr
entry->next = dev_priv->head->next;
entry->prev = dev_priv->head;
SET_AGE(&entry->age, MGA_BUFFER_FREE, 0);
- entry->buf = buf;
if (dev_priv->head->next != NULL)
dev_priv->head->next->prev = entry;
@@ -359,7 +358,7 @@ static struct drm_buf *mga_freelist_get(struct drm_device * dev)
int mga_freelist_put(struct drm_device * dev, struct drm_buf * buf)
{
drm_mga_private_t *dev_priv = dev->dev_private;
- drm_mga_buf_priv_t *buf_priv = buf->dev_private;
+ drm_mga_buf_priv_t *buf_priv = (drm_mga_buf_priv_t *)buf;
drm_mga_freelist_t *head, *entry, *prev;
DRM_DEBUG("age=0x%06lx wrap=%d\n",