From fec94a82748b3603da7239e39d247a9654765659 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 9 Oct 2004 11:12:24 +0000 Subject: Lindent the via stuff so I can include it in kernel --- shared-core/via_dma.c | 30 ++++++++++++++---------------- shared-core/via_drm.h | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-) (limited to 'shared-core') diff --git a/shared-core/via_dma.c b/shared-core/via_dma.c index 773356fb..182964f6 100644 --- a/shared-core/via_dma.c +++ b/shared-core/via_dma.c @@ -23,7 +23,6 @@ static void via_cmdbuf_reset(drm_via_private_t * dev_priv); static void via_cmdbuf_rewind(drm_via_private_t * dev_priv); static int via_wait_idle(drm_via_private_t * dev_priv); - /* * This function needs to be extended whenever a new command set * is implemented. Currently it works only for the 2D engine @@ -39,8 +38,7 @@ static int via_wait_idle(drm_via_private_t * dev_priv); * after an update!!!!!!!!! */ -static int via_check_command_stream(const uint32_t *buf, - unsigned int size) +static int via_check_command_stream(const uint32_t * buf, unsigned int size) { uint32_t offset; @@ -48,19 +46,20 @@ static int via_check_command_stream(const uint32_t *buf, if (size & 7) { DRM_ERROR("Illegal command buffer size.\n"); - return DRM_ERR( EINVAL ); + return DRM_ERR(EINVAL); } - size >>=3; - for (i=0; i>= 3; + for (i = 0; i < size; ++i) { + offset = *buf; buf += 2; - if ((offset > ((0x3FF >> 2) | VIA_2D_CMD)) && - (offset < ((0xC00 >> 2) | VIA_2D_CMD)) ) { - DRM_ERROR("Attempt to access Burst Command / 3D Area.\n"); - return DRM_ERR( EINVAL ); + if ((offset > ((0x3FF >> 2) | VIA_2D_CMD)) && + (offset < ((0xC00 >> 2) | VIA_2D_CMD))) { + DRM_ERROR + ("Attempt to access Burst Command / 3D Area.\n"); + return DRM_ERR(EINVAL); } else if (offset > ((0xDFF >> 2) | VIA_2D_CMD)) { DRM_ERROR("Attempt to access DMA or VGA registers.\n"); - return DRM_ERR( EINVAL ); + return DRM_ERR(EINVAL); } /* @@ -72,7 +71,6 @@ static int via_check_command_stream(const uint32_t *buf, } return 0; } - static inline int via_cmdbuf_wait(drm_via_private_t * dev_priv, unsigned int size) @@ -220,8 +218,8 @@ static int via_dispatch_cmdbuffer(drm_device_t * dev, drm_via_cmdbuffer_t * cmd) if (DRM_COPY_FROM_USER(vb, cmd->buf, cmd->size)) { return DRM_ERR(EFAULT); } - - if ((ret = via_check_command_stream( vb, cmd->size))) + + if ((ret = via_check_command_stream(vb, cmd->size))) return ret; dev_priv->dma_low += cmd->size; @@ -285,7 +283,7 @@ static int via_parse_pci_cmdbuffer(drm_device_t * dev, const char *buf, unsigned int i; int ret; - if ((ret = via_check_command_stream( regbuf, size))) + if ((ret = via_check_command_stream(regbuf, size))) return ret; size >>= 3; diff --git a/shared-core/via_drm.h b/shared-core/via_drm.h index a90366ff..75c72806 100644 --- a/shared-core/via_drm.h +++ b/shared-core/via_drm.h @@ -111,7 +111,7 @@ typedef struct { } drm_via_fb_t; typedef struct { - uint32_t context; + uint32_t context; uint32_t type; uint32_t size; unsigned long index; -- cgit v1.2.3