Merge branch 'drm-radeon-next' of ../drm-radeon-next into drm-core-next
authorDave Airlie <airlied@redhat.com>
Mon, 2 Aug 2010 00:24:46 +0000 (10:24 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 2 Aug 2010 00:24:46 +0000 (10:24 +1000)
* 'drm-radeon-next' of ../drm-radeon-next: (333 commits)
  drm/radeon/kms: trivial code style fixes for audio
  drm/radeon: remove viewport transform from r6xx/r7xx blit emit
  drm/radeon: group r6xx/r7xx newly sequential blit state
  drm/radeon: reorder r6xx/r7xx blit state emit to make more regs sequential
  drm/radeon: r6xx/r7xx move vport clipping to a single packet
  drm/radeon: group r6xx/r7xx sequential blit state
  drm/radeon: remove duplicate state emit in r6xx/r7xx blit
  drm/radeon: add comments to r6xx/r7xx blit state
  drm/radeon/kms/r7xx: add workaround for hw issue with HDP flush
  drm/radeon/kms: remove rs4xx gart limit
  drm: radeon: fix sign bug
  drm/radeon/kms: check/restore sanity before doing anything else with GPU.
  drm/radeon: fall back to GTT if bo creation/validation in VRAM fails.
  drm/radeon/kms: add ioport register access
  drm/radeon/kms: enable HDMI audio on RS600/RS690/RS740
  drm/radeon/kms: track audio engine state, do not use not setup timer
  drm/radeon/kms/r6xx+: add query for tile config (v2)
  drm/radeon/kms: fix CS alignment checking for tiling (v2)
  drm/radeon/kms: add tiling support to the cs checker for r6xx/r7xx
  drm/radeon/kms: Add crtc tiling setup support for evergreen
  ...

36 files changed:
drivers/gpu/drm/drm_drv.c
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/drm_stub.c
drivers/gpu/drm/i2c/Makefile
drivers/gpu/drm/i2c/sil164_drv.c [new file with mode: 0644]
drivers/gpu/drm/i810/i810_dma.c
drivers/gpu/drm/i810/i810_drv.h
drivers/gpu/drm/i830/i830_dma.c
drivers/gpu/drm/i830/i830_drv.h
drivers/gpu/drm/i830/i830_irq.c
drivers/gpu/drm/mga/mga_dma.c
drivers/gpu/drm/mga/mga_drv.c
drivers/gpu/drm/mga/mga_drv.h
drivers/gpu/drm/mga/mga_irq.c
drivers/gpu/drm/mga/mga_state.c
drivers/gpu/drm/mga/mga_warp.c
drivers/gpu/drm/nouveau/Kconfig
drivers/gpu/drm/r128/r128_cce.c
drivers/gpu/drm/r128/r128_drv.c
drivers/gpu/drm/r128/r128_drv.h
drivers/gpu/drm/r128/r128_irq.c
drivers/gpu/drm/r128/r128_state.c
drivers/gpu/drm/sis/sis_drv.c
drivers/gpu/drm/sis/sis_mm.c
drivers/gpu/drm/via/via_dma.c
drivers/gpu/drm/via/via_dmablit.c
drivers/gpu/drm/via/via_dmablit.h
drivers/gpu/drm/via/via_drv.h
drivers/gpu/drm/via/via_irq.c
drivers/gpu/drm/via/via_map.c
drivers/gpu/drm/via/via_mm.c
drivers/gpu/drm/via/via_verifier.c
drivers/gpu/drm/via/via_verifier.h
drivers/gpu/drm/via/via_video.c
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
include/drm/i2c/sil164.h [new file with mode: 0644]

index 510bc87d98f6f991e93e31d74affe90fd9986792..b5a51686f492edce08e59bc0bb9fb391a5faae34 100644 (file)
@@ -335,6 +335,7 @@ static void __exit drm_core_exit(void)
 
        unregister_chrdev(DRM_MAJOR, "drm");
 
+       idr_remove_all(&drm_minors_idr);
        idr_destroy(&drm_minors_idr);
 }
 
index 8601b72b6f26694def3cc4329158b9c27f770c7a..4f1b8671448921dc74b4a7e201d2a03309f495d5 100644 (file)
@@ -429,6 +429,7 @@ drm_gem_release(struct drm_device *dev, struct drm_file *file_private)
        idr_for_each(&file_private->object_idr,
                     &drm_gem_object_release_handle, NULL);
 
+       idr_remove_all(&file_private->object_idr);
        idr_destroy(&file_private->object_idr);
 }
 
index 63575e2fa882493461bf2b0aba217e4be15bcc01..d1ad57450df1543af9cc502a281b23661075b331 100644 (file)
@@ -156,6 +156,9 @@ static void drm_master_destroy(struct kref *kref)
                master->unique_len = 0;
        }
 
+       kfree(dev->devname);
+       dev->devname = NULL;
+
        list_for_each_entry_safe(pt, next, &master->magicfree, head) {
                list_del(&pt->head);
                drm_ht_remove_item(&master->magiclist, &pt->hash_item);
index 6d2abaf35ba22641a3a8e2d6677ff64fb5571b6e..92862563e7ee3dd8fbafb46d7d319b9dfb432514 100644 (file)
@@ -2,3 +2,6 @@ ccflags-y := -Iinclude/drm
 
 ch7006-y := ch7006_drv.o ch7006_mode.o
 obj-$(CONFIG_DRM_I2C_CH7006) += ch7006.o
+
+sil164-y := sil164_drv.o
+obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o
diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/i2c/sil164_drv.c
new file mode 100644 (file)
index 0000000..0b67732
--- /dev/null
@@ -0,0 +1,462 @@
+/*
+ * Copyright (C) 2010 Francisco Jerez.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "drmP.h"
+#include "drm_crtc_helper.h"
+#include "drm_encoder_slave.h"
+#include "i2c/sil164.h"
+
+struct sil164_priv {
+       struct sil164_encoder_params config;
+       struct i2c_client *duallink_slave;
+
+       uint8_t saved_state[0x10];
+       uint8_t saved_slave_state[0x10];
+};
+
+#define to_sil164_priv(x) \
+       ((struct sil164_priv *)to_encoder_slave(x)->slave_priv)
+
+#define sil164_dbg(client, format, ...) do {                           \
+               if (drm_debug & DRM_UT_KMS)                             \
+                       dev_printk(KERN_DEBUG, &client->dev,            \
+                                  "%s: " format, __func__, ## __VA_ARGS__); \
+       } while (0)
+#define sil164_info(client, format, ...)               \
+       dev_info(&client->dev, format, __VA_ARGS__)
+#define sil164_err(client, format, ...)                        \
+       dev_err(&client->dev, format, __VA_ARGS__)
+
+#define SIL164_I2C_ADDR_MASTER                 0x38
+#define SIL164_I2C_ADDR_SLAVE                  0x39
+
+/* HW register definitions */
+
+#define SIL164_VENDOR_LO                       0x0
+#define SIL164_VENDOR_HI                       0x1
+#define SIL164_DEVICE_LO                       0x2
+#define SIL164_DEVICE_HI                       0x3
+#define SIL164_REVISION                                0x4
+#define SIL164_FREQ_MIN                                0x6
+#define SIL164_FREQ_MAX                                0x7
+#define SIL164_CONTROL0                                0x8
+#  define SIL164_CONTROL0_POWER_ON             0x01
+#  define SIL164_CONTROL0_EDGE_RISING          0x02
+#  define SIL164_CONTROL0_INPUT_24BIT          0x04
+#  define SIL164_CONTROL0_DUAL_EDGE            0x08
+#  define SIL164_CONTROL0_HSYNC_ON             0x10
+#  define SIL164_CONTROL0_VSYNC_ON             0x20
+#define SIL164_DETECT                          0x9
+#  define SIL164_DETECT_INTR_STAT              0x01
+#  define SIL164_DETECT_HOTPLUG_STAT           0x02
+#  define SIL164_DETECT_RECEIVER_STAT          0x04
+#  define SIL164_DETECT_INTR_MODE_RECEIVER     0x00
+#  define SIL164_DETECT_INTR_MODE_HOTPLUG      0x08
+#  define SIL164_DETECT_OUT_MODE_HIGH          0x00
+#  define SIL164_DETECT_OUT_MODE_INTR          0x10
+#  define SIL164_DETECT_OUT_MODE_RECEIVER      0x20
+#  define SIL164_DETECT_OUT_MODE_HOTPLUG       0x30
+#  define SIL164_DETECT_VSWING_STAT            0x80
+#define SIL164_CONTROL1                                0xa
+#  define SIL164_CONTROL1_DESKEW_ENABLE                0x10
+#  define SIL164_CONTROL1_DESKEW_INCR_SHIFT    5
+#define SIL164_GPIO                            0xb
+#define SIL164_CONTROL2                                0xc
+#  define SIL164_CONTROL2_FILTER_ENABLE                0x01
+#  define SIL164_CONTROL2_FILTER_SETTING_SHIFT 1
+#  define SIL164_CONTROL2_DUALLINK_MASTER      0x40
+#  define SIL164_CONTROL2_SYNC_CONT            0x80
+#define SIL164_DUALLINK                                0xd
+#  define SIL164_DUALLINK_ENABLE               0x10
+#  define SIL164_DUALLINK_SKEW_SHIFT           5
+#define SIL164_PLLZONE                         0xe
+#  define SIL164_PLLZONE_STAT                  0x08
+#  define SIL164_PLLZONE_FORCE_ON              0x10
+#  define SIL164_PLLZONE_FORCE_HIGH            0x20
+
+/* HW access functions */
+
+static void
+sil164_write(struct i2c_client *client, uint8_t addr, uint8_t val)
+{
+       uint8_t buf[] = {addr, val};
+       int ret;
+
+       ret = i2c_master_send(client, buf, ARRAY_SIZE(buf));
+       if (ret < 0)
+               sil164_err(client, "Error %d writing to subaddress 0x%x\n",
+                          ret, addr);
+}
+
+static uint8_t
+sil164_read(struct i2c_client *client, uint8_t addr)
+{
+       uint8_t val;
+       int ret;
+
+       ret = i2c_master_send(client, &addr, sizeof(addr));
+       if (ret < 0)
+               goto fail;
+
+       ret = i2c_master_recv(client, &val, sizeof(val));
+       if (ret < 0)
+               goto fail;
+
+       return val;
+
+fail:
+       sil164_err(client, "Error %d reading from subaddress 0x%x\n",
+                  ret, addr);
+       return 0;
+}
+
+static void
+sil164_save_state(struct i2c_client *client, uint8_t *state)
+{
+       int i;
+
+       for (i = 0x8; i <= 0xe; i++)
+               state[i] = sil164_read(client, i);
+}
+
+static void
+sil164_restore_state(struct i2c_client *client, uint8_t *state)
+{
+       int i;
+
+       for (i = 0x8; i <= 0xe; i++)
+               sil164_write(client, i, state[i]);
+}
+
+static void
+sil164_set_power_state(struct i2c_client *client, bool on)
+{
+       uint8_t control0 = sil164_read(client, SIL164_CONTROL0);
+
+       if (on)
+               control0 |= SIL164_CONTROL0_POWER_ON;
+       else
+               control0 &= ~SIL164_CONTROL0_POWER_ON;
+
+       sil164_write(client, SIL164_CONTROL0, control0);
+}
+
+static void
+sil164_init_state(struct i2c_client *client,
+                 struct sil164_encoder_params *config,
+                 bool duallink)
+{
+       sil164_write(client, SIL164_CONTROL0,
+                    SIL164_CONTROL0_HSYNC_ON |
+                    SIL164_CONTROL0_VSYNC_ON |
+                    (config->input_edge ? SIL164_CONTROL0_EDGE_RISING : 0) |
+                    (config->input_width ? SIL164_CONTROL0_INPUT_24BIT : 0) |
+                    (config->input_dual ? SIL164_CONTROL0_DUAL_EDGE : 0));
+
+       sil164_write(client, SIL164_DETECT,
+                    SIL164_DETECT_INTR_STAT |
+                    SIL164_DETECT_OUT_MODE_RECEIVER);
+
+       sil164_write(client, SIL164_CONTROL1,
+                    (config->input_skew ? SIL164_CONTROL1_DESKEW_ENABLE : 0) |
+                    (((config->input_skew + 4) & 0x7)
+                     << SIL164_CONTROL1_DESKEW_INCR_SHIFT));
+
+       sil164_write(client, SIL164_CONTROL2,
+                    SIL164_CONTROL2_SYNC_CONT |
+                    (config->pll_filter ? 0 : SIL164_CONTROL2_FILTER_ENABLE) |
+                    (4 << SIL164_CONTROL2_FILTER_SETTING_SHIFT));
+
+       sil164_write(client, SIL164_PLLZONE, 0);
+
+       if (duallink)
+               sil164_write(client, SIL164_DUALLINK,
+                            SIL164_DUALLINK_ENABLE |
+                            (((config->duallink_skew + 4) & 0x7)
+                             << SIL164_DUALLINK_SKEW_SHIFT));
+       else
+               sil164_write(client, SIL164_DUALLINK, 0);
+}
+
+/* DRM encoder functions */
+
+static void
+sil164_encoder_set_config(struct drm_encoder *encoder, void *params)
+{
+       struct sil164_priv *priv = to_sil164_priv(encoder);
+
+       priv->config = *(struct sil164_encoder_params *)params;
+}
+
+static void
+sil164_encoder_dpms(struct drm_encoder *encoder, int mode)
+{
+       struct sil164_priv *priv = to_sil164_priv(encoder);
+       bool on = (mode == DRM_MODE_DPMS_ON);
+       bool duallink = (on && encoder->crtc->mode.clock > 165000);
+
+       sil164_set_power_state(drm_i2c_encoder_get_client(encoder), on);
+
+       if (priv->duallink_slave)
+               sil164_set_power_state(priv->duallink_slave, duallink);
+}
+
+static void
+sil164_encoder_save(struct drm_encoder *encoder)
+{
+       struct sil164_priv *priv = to_sil164_priv(encoder);
+
+       sil164_save_state(drm_i2c_encoder_get_client(encoder),
+                         priv->saved_state);
+
+       if (priv->duallink_slave)
+               sil164_save_state(priv->duallink_slave,
+                                 priv->saved_slave_state);
+}
+
+static void
+sil164_encoder_restore(struct drm_encoder *encoder)
+{
+       struct sil164_priv *priv = to_sil164_priv(encoder);
+
+       sil164_restore_state(drm_i2c_encoder_get_client(encoder),
+                            priv->saved_state);
+
+       if (priv->duallink_slave)
+               sil164_restore_state(priv->duallink_slave,
+                                    priv->saved_slave_state);
+}
+
+static bool
+sil164_encoder_mode_fixup(struct drm_encoder *encoder,
+                         struct drm_display_mode *mode,
+                         struct drm_display_mode *adjusted_mode)
+{
+       return true;
+}
+
+static int
+sil164_encoder_mode_valid(struct drm_encoder *encoder,
+                         struct drm_display_mode *mode)
+{
+       struct sil164_priv *priv = to_sil164_priv(encoder);
+
+       if (mode->clock < 32000)
+               return MODE_CLOCK_LOW;
+
+       if (mode->clock > 330000 ||
+           (mode->clock > 165000 && !priv->duallink_slave))
+               return MODE_CLOCK_HIGH;
+
+       return MODE_OK;
+}
+
+static void
+sil164_encoder_mode_set(struct drm_encoder *encoder,
+                       struct drm_display_mode *mode,
+                       struct drm_display_mode *adjusted_mode)
+{
+       struct sil164_priv *priv = to_sil164_priv(encoder);
+       bool duallink = adjusted_mode->clock > 165000;
+
+       sil164_init_state(drm_i2c_encoder_get_client(encoder),
+                         &priv->config, duallink);
+
+       if (priv->duallink_slave)
+               sil164_init_state(priv->duallink_slave,
+                                 &priv->config, duallink);
+
+       sil164_encoder_dpms(encoder, DRM_MODE_DPMS_ON);
+}
+
+static enum drm_connector_status
+sil164_encoder_detect(struct drm_encoder *encoder,
+                     struct drm_connector *connector)
+{
+       struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
+
+       if (sil164_read(client, SIL164_DETECT) & SIL164_DETECT_HOTPLUG_STAT)
+               return connector_status_connected;
+       else
+               return connector_status_disconnected;
+}
+
+static int
+sil164_encoder_get_modes(struct drm_encoder *encoder,
+                        struct drm_connector *connector)
+{
+       return 0;
+}
+
+static int
+sil164_encoder_create_resources(struct drm_encoder *encoder,
+                               struct drm_connector *connector)
+{
+       return 0;
+}
+
+static int
+sil164_encoder_set_property(struct drm_encoder *encoder,
+                           struct drm_connector *connector,
+                           struct drm_property *property,
+                           uint64_t val)
+{
+       return 0;
+}
+
+static void
+sil164_encoder_destroy(struct drm_encoder *encoder)
+{
+       struct sil164_priv *priv = to_sil164_priv(encoder);
+
+       if (priv->duallink_slave)
+               i2c_unregister_device(priv->duallink_slave);
+
+       kfree(priv);
+       drm_i2c_encoder_destroy(encoder);
+}
+
+static struct drm_encoder_slave_funcs sil164_encoder_funcs = {
+       .set_config = sil164_encoder_set_config,
+       .destroy = sil164_encoder_destroy,
+       .dpms = sil164_encoder_dpms,
+       .save = sil164_encoder_save,
+       .restore = sil164_encoder_restore,
+       .mode_fixup = sil164_encoder_mode_fixup,
+       .mode_valid = sil164_encoder_mode_valid,
+       .mode_set = sil164_encoder_mode_set,
+       .detect = sil164_encoder_detect,
+       .get_modes = sil164_encoder_get_modes,
+       .create_resources = sil164_encoder_create_resources,
+       .set_property = sil164_encoder_set_property,
+};
+
+/* I2C driver functions */
+
+static int
+sil164_probe(struct i2c_client *client, const struct i2c_device_id *id)
+{
+       int vendor = sil164_read(client, SIL164_VENDOR_HI) << 8 |
+               sil164_read(client, SIL164_VENDOR_LO);
+       int device = sil164_read(client, SIL164_DEVICE_HI) << 8 |
+               sil164_read(client, SIL164_DEVICE_LO);
+       int rev = sil164_read(client, SIL164_REVISION);
+
+       if (vendor != 0x1 || device != 0x6) {
+               sil164_dbg(client, "Unknown device %x:%x.%x\n",
+                          vendor, device, rev);
+               return -ENODEV;
+       }
+
+       sil164_info(client, "Detected device %x:%x.%x\n",
+                   vendor, device, rev);
+
+       return 0;
+}
+
+static int
+sil164_remove(struct i2c_client *client)
+{
+       return 0;
+}
+
+static struct i2c_client *
+sil164_detect_slave(struct i2c_client *client)
+{
+       struct i2c_adapter *adap = client->adapter;
+       struct i2c_msg msg = {
+               .addr = SIL164_I2C_ADDR_SLAVE,
+               .len = 0,
+       };
+       const struct i2c_board_info info = {
+               I2C_BOARD_INFO("sil164", SIL164_I2C_ADDR_SLAVE)
+       };
+
+       if (i2c_transfer(adap, &msg, 1) != 1) {
+               sil164_dbg(adap, "No dual-link slave found.");
+               return NULL;
+       }
+
+       return i2c_new_device(adap, &info);
+}
+
+static int
+sil164_encoder_init(struct i2c_client *client,
+                   struct drm_device *dev,
+                   struct drm_encoder_slave *encoder)
+{
+       struct sil164_priv *priv;
+
+       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+       if (!priv)
+               return -ENOMEM;
+
+       encoder->slave_priv = priv;
+       encoder->slave_funcs = &sil164_encoder_funcs;
+
+       priv->duallink_slave = sil164_detect_slave(client);
+
+       return 0;
+}
+
+static struct i2c_device_id sil164_ids[] = {
+       { "sil164", 0 },
+       { }
+};
+MODULE_DEVICE_TABLE(i2c, sil164_ids);
+
+static struct drm_i2c_encoder_driver sil164_driver = {
+       .i2c_driver = {
+               .probe = sil164_probe,
+               .remove = sil164_remove,
+               .driver = {
+                       .name = "sil164",
+               },
+               .id_table = sil164_ids,
+       },
+       .encoder_init = sil164_encoder_init,
+};
+
+/* Module initialization */
+
+static int __init
+sil164_init(void)
+{
+       return drm_i2c_encoder_register(THIS_MODULE, &sil164_driver);
+}
+
+static void __exit
+sil164_exit(void)
+{
+       drm_i2c_encoder_unregister(&sil164_driver);
+}
+
+MODULE_AUTHOR("Francisco Jerez <currojerez@riseup.net>");
+MODULE_DESCRIPTION("Silicon Image sil164 TMDS transmitter driver");
+MODULE_LICENSE("GPL and additional rights");
+
+module_init(sil164_init);
+module_exit(sil164_exit);
index 997d91707ad217f545c9720c0b0b9a604617f7e2..09c86ed89927a82a8b384fe9c095252960350a8f 100644 (file)
@@ -60,9 +60,8 @@ static struct drm_buf *i810_freelist_get(struct drm_device * dev)
                /* In use is already a pointer */
                used = cmpxchg(buf_priv->in_use, I810_BUF_FREE,
                               I810_BUF_CLIENT);
-               if (used == I810_BUF_FREE) {
+               if (used == I810_BUF_FREE)
                        return buf;
-               }
        }
        return NULL;
 }
@@ -71,7 +70,7 @@ static struct drm_buf *i810_freelist_get(struct drm_device * dev)
  * yet, the hardware updates in use for us once its on the ring buffer.
  */
 
-static int i810_freelist_put(struct drm_device * dev, struct drm_buf * buf)
+static int i810_freelist_put(struct drm_device *dev, struct drm_buf *buf)
 {
        drm_i810_buf_priv_t *buf_priv = buf->dev_private;
        int used;
@@ -121,7 +120,7 @@ static const struct file_operations i810_buffer_fops = {
        .fasync = drm_fasync,
 };
 
-static int i810_map_buffer(struct drm_buf * buf, struct drm_file *file_priv)
+static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv)
 {
        struct drm_device *dev = file_priv->minor->dev;
        drm_i810_buf_priv_t *buf_priv = buf->dev_private;
@@ -152,7 +151,7 @@ static int i810_map_buffer(struct drm_buf * buf, struct drm_file *file_priv)
        return retcode;
 }
 
-static int i810_unmap_buffer(struct drm_buf * buf)
+static int i810_unmap_buffer(struct drm_buf *buf)
 {
        drm_i810_buf_priv_t *buf_priv = buf->dev_private;
        int retcode = 0;
@@ -172,7 +171,7 @@ static int i810_unmap_buffer(struct drm_buf * buf)
        return retcode;
 }
 
-static int i810_dma_get_buffer(struct drm_device * dev, drm_i810_dma_t * d,
+static int i810_dma_get_buffer(struct drm_device *dev, drm_i810_dma_t *d,
                               struct drm_file *file_priv)
 {
        struct drm_buf *buf;
@@ -202,7 +201,7 @@ static int i810_dma_get_buffer(struct drm_device * dev, drm_i810_dma_t * d,
        return retcode;
 }
 
-static int i810_dma_cleanup(struct drm_device * dev)
+static int i810_dma_cleanup(struct drm_device *dev)
 {
        struct drm_device_dma *dma = dev->dma;
 
@@ -218,9 +217,8 @@ static int i810_dma_cleanup(struct drm_device * dev)
                drm_i810_private_t *dev_priv =
                    (drm_i810_private_t *) dev->dev_private;
 
-               if (dev_priv->ring.virtual_start) {
+               if (dev_priv->ring.virtual_start)
                        drm_core_ioremapfree(&dev_priv->ring.map, dev);
-               }
                if (dev_priv->hw_status_page) {
                        pci_free_consistent(dev->pdev, PAGE_SIZE,
                                            dev_priv->hw_status_page,
@@ -242,7 +240,7 @@ static int i810_dma_cleanup(struct drm_device * dev)
        return 0;
 }
 
-static int i810_wait_ring(struct drm_device * dev, int n)
+static int i810_wait_ring(struct drm_device *dev, int n)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
        drm_i810_ring_buffer_t *ring = &(dev_priv->ring);
@@ -271,11 +269,11 @@ static int i810_wait_ring(struct drm_device * dev, int n)
                udelay(1);
        }
 
-      out_wait_ring:
+out_wait_ring:
        return iters;
 }
 
-static void i810_kernel_lost_context(struct drm_device * dev)
+static void i810_kernel_lost_context(struct drm_device *dev)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
        drm_i810_ring_buffer_t *ring = &(dev_priv->ring);
@@ -287,7 +285,7 @@ static void i810_kernel_lost_context(struct drm_device * dev)
                ring->space += ring->Size;
 }
 
-static int i810_freelist_init(struct drm_device * dev, drm_i810_private_t * dev_priv)
+static int i810_freelist_init(struct drm_device *dev, drm_i810_private_t *dev_priv)
 {
        struct drm_device_dma *dma = dev->dma;
        int my_idx = 24;
@@ -322,9 +320,9 @@ static int i810_freelist_init(struct drm_device * dev, drm_i810_private_t * dev_
        return 0;
 }
 
-static int i810_dma_initialize(struct drm_device * dev,
-                              drm_i810_private_t * dev_priv,
-                              drm_i810_init_t * init)
+static int i810_dma_initialize(struct drm_device *dev,
+                              drm_i810_private_t *dev_priv,
+                              drm_i810_init_t *init)
 {
        struct drm_map_list *r_list;
        memset(dev_priv, 0, sizeof(drm_i810_private_t));
@@ -462,7 +460,7 @@ static int i810_dma_init(struct drm_device *dev, void *data,
  * Use 'volatile' & local var tmp to force the emitted values to be
  * identical to the verified ones.
  */
-static void i810EmitContextVerified(struct drm_device * dev,
+static void i810EmitContextVerified(struct drm_device *dev,
                                    volatile unsigned int *code)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
@@ -495,7 +493,7 @@ static void i810EmitContextVerified(struct drm_device * dev,
        ADVANCE_LP_RING();
 }
 
-static void i810EmitTexVerified(struct drm_device * dev, volatile unsigned int *code)
+static void i810EmitTexVerified(struct drm_device *dev, volatile unsigned int *code)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
        int i, j = 0;
@@ -528,7 +526,7 @@ static void i810EmitTexVerified(struct drm_device * dev, volatile unsigned int *
 
 /* Need to do some additional checking when setting the dest buffer.
  */
-static void i810EmitDestVerified(struct drm_device * dev,
+static void i810EmitDestVerified(struct drm_device *dev,
                                 volatile unsigned int *code)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
@@ -563,7 +561,7 @@ static void i810EmitDestVerified(struct drm_device * dev,
        ADVANCE_LP_RING();
 }
 
-static void i810EmitState(struct drm_device * dev)
+static void i810EmitState(struct drm_device *dev)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
        drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -594,7 +592,7 @@ static void i810EmitState(struct drm_device * dev)
 
 /* need to verify
  */
-static void i810_dma_dispatch_clear(struct drm_device * dev, int flags,
+static void i810_dma_dispatch_clear(struct drm_device *dev, int flags,
                                    unsigned int clear_color,
                                    unsigned int clear_zval)
 {
@@ -669,7 +667,7 @@ static void i810_dma_dispatch_clear(struct drm_device * dev, int flags,
        }
 }
 
-static void i810_dma_dispatch_swap(struct drm_device * dev)
+static void i810_dma_dispatch_swap(struct drm_device *dev)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
        drm_i810_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -715,8 +713,8 @@ static void i810_dma_dispatch_swap(struct drm_device * dev)
        }
 }
 
-static void i810_dma_dispatch_vertex(struct drm_device * dev,
-                                    struct drm_buf * buf, int discard, int used)
+static void i810_dma_dispatch_vertex(struct drm_device *dev,
+                                    struct drm_buf *buf, int discard, int used)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
        drm_i810_buf_priv_t *buf_priv = buf->dev_private;
@@ -795,7 +793,7 @@ static void i810_dma_dispatch_vertex(struct drm_device * dev,
        }
 }
 
-static void i810_dma_dispatch_flip(struct drm_device * dev)
+static void i810_dma_dispatch_flip(struct drm_device *dev)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
        int pitch = dev_priv->pitch;
@@ -841,7 +839,7 @@ static void i810_dma_dispatch_flip(struct drm_device * dev)
 
 }
 
-static void i810_dma_quiescent(struct drm_device * dev)
+static void i810_dma_quiescent(struct drm_device *dev)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
        RING_LOCALS;
@@ -858,7 +856,7 @@ static void i810_dma_quiescent(struct drm_device * dev)
        i810_wait_ring(dev, dev_priv->ring.Size - 8);
 }
 
-static int i810_flush_queue(struct drm_device * dev)
+static int i810_flush_queue(struct drm_device *dev)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
        struct drm_device_dma *dma = dev->dma;
@@ -891,7 +889,7 @@ static int i810_flush_queue(struct drm_device * dev)
 }
 
 /* Must be called with the lock held */
-static void i810_reclaim_buffers(struct drm_device * dev,
+static void i810_reclaim_buffers(struct drm_device *dev,
                                 struct drm_file *file_priv)
 {
        struct drm_device_dma *dma = dev->dma;
@@ -969,9 +967,8 @@ static int i810_clear_bufs(struct drm_device *dev, void *data,
        LOCK_TEST_WITH_RETURN(dev, file_priv);
 
        /* GH: Someone's doing nasty things... */
-       if (!dev->dev_private) {
+       if (!dev->dev_private)
                return -EINVAL;
-       }
 
        i810_dma_dispatch_clear(dev, clear->flags,
                                clear->clear_color, clear->clear_depth);
@@ -1039,7 +1036,7 @@ static int i810_docopy(struct drm_device *dev, void *data,
        return 0;
 }
 
-static void i810_dma_dispatch_mc(struct drm_device * dev, struct drm_buf * buf, int used,
+static void i810_dma_dispatch_mc(struct drm_device *dev, struct drm_buf *buf, int used,
                                 unsigned int last_render)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
@@ -1053,9 +1050,8 @@ static void i810_dma_dispatch_mc(struct drm_device * dev, struct drm_buf * buf,
        i810_kernel_lost_context(dev);
 
        u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_HARDWARE);
-       if (u != I810_BUF_CLIENT) {
+       if (u != I810_BUF_CLIENT)
                DRM_DEBUG("MC found buffer that isn't mine!\n");
-       }
 
        if (used > 4 * 1024)
                used = 0;
@@ -1160,7 +1156,7 @@ static int i810_ov0_flip(struct drm_device *dev, void *data,
 
        LOCK_TEST_WITH_RETURN(dev, file_priv);
 
-       //Tell the overlay to update
+       /* Tell the overlay to update */
        I810_WRITE(0x30000, dev_priv->overlay_physical | 0x80000000);
 
        return 0;
@@ -1168,7 +1164,7 @@ static int i810_ov0_flip(struct drm_device *dev, void *data,
 
 /* Not sure why this isn't set all the time:
  */
-static void i810_do_init_pageflip(struct drm_device * dev)
+static void i810_do_init_pageflip(struct drm_device *dev)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
 
@@ -1178,7 +1174,7 @@ static void i810_do_init_pageflip(struct drm_device * dev)
        dev_priv->sarea_priv->pf_current_page = dev_priv->current_page;
 }
 
-static int i810_do_cleanup_pageflip(struct drm_device * dev)
+static int i810_do_cleanup_pageflip(struct drm_device *dev)
 {
        drm_i810_private_t *dev_priv = dev->dev_private;
 
@@ -1218,28 +1214,27 @@ int i810_driver_load(struct drm_device *dev, unsigned long flags)
        return 0;
 }
 
-void i810_driver_lastclose(struct drm_device * dev)
+void i810_driver_lastclose(struct drm_device *dev)
 {
        i810_dma_cleanup(dev);
 }
 
-void i810_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
+void i810_driver_preclose(struct drm_device *dev, struct drm_file *file_priv)
 {
        if (dev->dev_private) {
                drm_i810_private_t *dev_priv = dev->dev_private;
-               if (dev_priv->page_flipping) {
+               if (dev_priv->page_flipping)
                        i810_do_cleanup_pageflip(dev);
-               }
        }
 }
 
-void i810_driver_reclaim_buffers_locked(struct drm_device * dev,
+void i810_driver_reclaim_buffers_locked(struct drm_device *dev,
                                        struct drm_file *file_priv)
 {
        i810_reclaim_buffers(dev, file_priv);
 }
 
-int i810_driver_dma_quiescent(struct drm_device * dev)
+int i810_driver_dma_quiescent(struct drm_device *dev)
 {
        i810_dma_quiescent(dev);
        return 0;
@@ -1276,7 +1271,7 @@ int i810_max_ioctl = DRM_ARRAY_SIZE(i810_ioctls);
  * \returns
  * A value of 1 is always retured to indictate every i810 is AGP.
  */
-int i810_driver_device_is_agp(struct drm_device * dev)
+int i810_driver_device_is_agp(struct drm_device *dev)
 {
        return 1;
 }
index 21e2691f28f953c2ab84234b65c4bae0a1bc11bb..0743fe90f1e3f4dc9213429e941c7331ad528022 100644 (file)
@@ -115,16 +115,16 @@ typedef struct drm_i810_private {
 } drm_i810_private_t;
 
                                /* i810_dma.c */
-extern int i810_driver_dma_quiescent(struct drm_device * dev);
-extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev,
+extern int i810_driver_dma_quiescent(struct drm_device *dev);
+extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev,
                                               struct drm_file *file_priv);
 extern int i810_driver_load(struct drm_device *, unsigned long flags);
-extern void i810_driver_lastclose(struct drm_device * dev);
-extern void i810_driver_preclose(struct drm_device * dev,
+extern void i810_driver_lastclose(struct drm_device *dev);
+extern void i810_driver_preclose(struct drm_device *dev,
                                 struct drm_file *file_priv);
-extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev,
+extern void i810_driver_reclaim_buffers_locked(struct drm_device *dev,
                                               struct drm_file *file_priv);
-extern int i810_driver_device_is_agp(struct drm_device * dev);
+extern int i810_driver_device_is_agp(struct drm_device *dev);
 
 extern struct drm_ioctl_desc i810_ioctls[];
 extern int i810_max_ioctl;
@@ -132,39 +132,41 @@ extern int i810_max_ioctl;
 #define I810_BASE(reg)         ((unsigned long) \
                                dev_priv->mmio_map->handle)
 #define I810_ADDR(reg)         (I810_BASE(reg) + reg)
-#define I810_DEREF(reg)                *(__volatile__ int *)I810_ADDR(reg)
+#define I810_DEREF(reg)                (*(__volatile__ int *)I810_ADDR(reg))
 #define I810_READ(reg)         I810_DEREF(reg)
-#define I810_WRITE(reg,val)    do { I810_DEREF(reg) = val; } while (0)
-#define I810_DEREF16(reg)      *(__volatile__ u16 *)I810_ADDR(reg)
+#define I810_WRITE(reg, val)   do { I810_DEREF(reg) = val; } while (0)
+#define I810_DEREF16(reg)      (*(__volatile__ u16 *)I810_ADDR(reg))
 #define I810_READ16(reg)       I810_DEREF16(reg)
-#define I810_WRITE16(reg,val)  do { I810_DEREF16(reg) = val; } while (0)
+#define I810_WRITE16(reg, val) do { I810_DEREF16(reg) = val; } while (0)
 
 #define I810_VERBOSE 0
 #define RING_LOCALS    unsigned int outring, ringmask; \
-                        volatile char *virt;
-
-#define BEGIN_LP_RING(n) do {                                          \
-       if (I810_VERBOSE)                                               \
-               DRM_DEBUG("BEGIN_LP_RING(%d)\n", n);                    \
-       if (dev_priv->ring.space < n*4)                                 \
-               i810_wait_ring(dev, n*4);                               \
-       dev_priv->ring.space -= n*4;                                    \
-       outring = dev_priv->ring.tail;                                  \
-       ringmask = dev_priv->ring.tail_mask;                            \
-       virt = dev_priv->ring.virtual_start;                            \
+                       volatile char *virt;
+
+#define BEGIN_LP_RING(n) do {                                  \
+       if (I810_VERBOSE)                                       \
+               DRM_DEBUG("BEGIN_LP_RING(%d)\n", n);            \
+       if (dev_priv->ring.space < n*4)                         \
+               i810_wait_ring(dev, n*4);                       \
+       dev_priv->ring.space -= n*4;                            \
+       outring = dev_priv->ring.tail;                          \
+       ringmask = dev_priv->ring.tail_mask;                    \
+       virt = dev_priv->ring.virtual_start;                    \
 } while (0)
 
-#define ADVANCE_LP_RING() do {                                 \
-       if (I810_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING\n");       \
+#define ADVANCE_LP_RING() do {                                 \
+       if (I810_VERBOSE)                                       \
+               DRM_DEBUG("ADVANCE_LP_RING\n");                 \
        dev_priv->ring.tail = outring;                          \
-       I810_WRITE(LP_RING + RING_TAIL, outring);               \
-} while(0)
-
-#define OUT_RING(n) do {                                               \
-       if (I810_VERBOSE) DRM_DEBUG("   OUT_RING %x\n", (int)(n));      \
-       *(volatile unsigned int *)(virt + outring) = n;                 \
-       outring += 4;                                                   \
-       outring &= ringmask;                                            \
+       I810_WRITE(LP_RING + RING_TAIL, outring);               \
+} while (0)
+
+#define OUT_RING(n) do {                                       \
+       if (I810_VERBOSE)                                       \
+               DRM_DEBUG("   OUT_RING %x\n", (int)(n));        \
+       *(volatile unsigned int *)(virt + outring) = n;         \
+       outring += 4;                                           \
+       outring &= ringmask;                                    \
 } while (0)
 
 #define GFX_OP_USER_INTERRUPT          ((0<<29)|(2<<23))
index 65759a9a85c8e425714c3281f080880eaaf8d0fc..7ee85ea507cecdc3d2b6548a13b528738a07ef94 100644 (file)
@@ -62,9 +62,8 @@ static struct drm_buf *i830_freelist_get(struct drm_device * dev)
                /* In use is already a pointer */
                used = cmpxchg(buf_priv->in_use, I830_BUF_FREE,
                               I830_BUF_CLIENT);
-               if (used == I830_BUF_FREE) {
+               if (used == I830_BUF_FREE)
                        return buf;
-               }
        }
        return NULL;
 }
@@ -73,7 +72,7 @@ static struct drm_buf *i830_freelist_get(struct drm_device * dev)
  * yet, the hardware updates in use for us once its on the ring buffer.
  */
 
-static int i830_freelist_put(struct drm_device * dev, struct drm_buf * buf)
+static int i830_freelist_put(struct drm_device *dev, struct drm_buf *buf)
 {
        drm_i830_buf_priv_t *buf_priv = buf->dev_private;
        int used;
@@ -123,7 +122,7 @@ static const struct file_operations i830_buffer_fops = {
        .fasync = drm_fasync,
 };
 
-static int i830_map_buffer(struct drm_buf * buf, struct drm_file *file_priv)
+static int i830_map_buffer(struct drm_buf *buf, struct drm_file *file_priv)
 {
        struct drm_device *dev = file_priv->minor->dev;
        drm_i830_buf_priv_t *buf_priv = buf->dev_private;
@@ -156,7 +155,7 @@ static int i830_map_buffer(struct drm_buf * buf, struct drm_file *file_priv)
        return retcode;
 }
 
-static int i830_unmap_buffer(struct drm_buf * buf)
+static int i830_unmap_buffer(struct drm_buf *buf)
 {
        drm_i830_buf_priv_t *buf_priv = buf->dev_private;
        int retcode = 0;
@@ -176,7 +175,7 @@ static int i830_unmap_buffer(struct drm_buf * buf)
        return retcode;
 }
 
-static int i830_dma_get_buffer(struct drm_device * dev, drm_i830_dma_t * d,
+static int i830_dma_get_buffer(struct drm_device *dev, drm_i830_dma_t *d,
                               struct drm_file *file_priv)
 {
        struct drm_buf *buf;
@@ -206,7 +205,7 @@ static int i830_dma_get_buffer(struct drm_device * dev, drm_i830_dma_t * d,
        return retcode;
 }
 
-static int i830_dma_cleanup(struct drm_device * dev)
+static int i830_dma_cleanup(struct drm_device *dev)
 {
        struct drm_device_dma *dma = dev->dma;
 
@@ -222,9 +221,8 @@ static int i830_dma_cleanup(struct drm_device * dev)
                drm_i830_private_t *dev_priv =
                    (drm_i830_private_t *) dev->dev_private;
 
-               if (dev_priv->ring.virtual_start) {
+               if (dev_priv->ring.virtual_start)
                        drm_core_ioremapfree(&dev_priv->ring.map, dev);
-               }
                if (dev_priv->hw_status_page) {
                        pci_free_consistent(dev->pdev, PAGE_SIZE,
                                            dev_priv->hw_status_page,
@@ -246,7 +244,7 @@ static int i830_dma_cleanup(struct drm_device * dev)
        return 0;
 }
 
-int i830_wait_ring(struct drm_device * dev, int n, const char *caller)
+int i830_wait_ring(struct drm_device *dev, int n, const char *caller)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        drm_i830_ring_buffer_t *ring = &(dev_priv->ring);
@@ -276,11 +274,11 @@ int i830_wait_ring(struct drm_device * dev, int n, const char *caller)
                dev_priv->sarea_priv->perf_boxes |= I830_BOX_WAIT;
        }
 
-      out_wait_ring:
+out_wait_ring:
        return iters;
 }
 
-static void i830_kernel_lost_context(struct drm_device * dev)
+static void i830_kernel_lost_context(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        drm_i830_ring_buffer_t *ring = &(dev_priv->ring);
@@ -295,7 +293,7 @@ static void i830_kernel_lost_context(struct drm_device * dev)
                dev_priv->sarea_priv->perf_boxes |= I830_BOX_RING_EMPTY;
 }
 
-static int i830_freelist_init(struct drm_device * dev, drm_i830_private_t * dev_priv)
+static int i830_freelist_init(struct drm_device *dev, drm_i830_private_t *dev_priv)
 {
        struct drm_device_dma *dma = dev->dma;
        int my_idx = 36;
@@ -329,9 +327,9 @@ static int i830_freelist_init(struct drm_device * dev, drm_i830_private_t * dev_
        return 0;
 }
 
-static int i830_dma_initialize(struct drm_device * dev,
-                              drm_i830_private_t * dev_priv,
-                              drm_i830_init_t * init)
+static int i830_dma_initialize(struct drm_device *dev,
+                              drm_i830_private_t *dev_priv,
+                              drm_i830_init_t *init)
 {
        struct drm_map_list *r_list;
 
@@ -482,7 +480,7 @@ static int i830_dma_init(struct drm_device *dev, void *data,
 /* Most efficient way to verify state for the i830 is as it is
  * emitted.  Non-conformant state is silently dropped.
  */
-static void i830EmitContextVerified(struct drm_device * dev, unsigned int *code)
+static void i830EmitContextVerified(struct drm_device *dev, unsigned int *code)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        int i, j = 0;
@@ -527,7 +525,7 @@ static void i830EmitContextVerified(struct drm_device * dev, unsigned int *code)
        ADVANCE_LP_RING();
 }
 
-static void i830EmitTexVerified(struct drm_device * dev, unsigned int *code)
+static void i830EmitTexVerified(struct drm_device *dev, unsigned int *code)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        int i, j = 0;
@@ -561,7 +559,7 @@ static void i830EmitTexVerified(struct drm_device * dev, unsigned int *code)
                printk("rejected packet %x\n", code[0]);
 }
 
-static void i830EmitTexBlendVerified(struct drm_device * dev,
+static void i830EmitTexBlendVerified(struct drm_device *dev,
                                     unsigned int *code, unsigned int num)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
@@ -586,7 +584,7 @@ static void i830EmitTexBlendVerified(struct drm_device * dev,
        ADVANCE_LP_RING();
 }
 
-static void i830EmitTexPalette(struct drm_device * dev,
+static void i830EmitTexPalette(struct drm_device *dev,
                               unsigned int *palette, int number, int is_shared)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
@@ -603,9 +601,8 @@ static void i830EmitTexPalette(struct drm_device * dev,
        } else {
                OUT_RING(CMD_OP_MAP_PALETTE_LOAD | MAP_PALETTE_NUM(number));
        }
-       for (i = 0; i < 256; i++) {
+       for (i = 0; i < 256; i++)
                OUT_RING(palette[i]);
-       }
        OUT_RING(0);
        /* KW:  WHERE IS THE ADVANCE_LP_RING?  This is effectively a noop!
         */
@@ -613,7 +610,7 @@ static void i830EmitTexPalette(struct drm_device * dev,
 
 /* Need to do some additional checking when setting the dest buffer.
  */
-static void i830EmitDestVerified(struct drm_device * dev, unsigned int *code)
+static void i830EmitDestVerified(struct drm_device *dev, unsigned int *code)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        unsigned int tmp;
@@ -674,7 +671,7 @@ static void i830EmitDestVerified(struct drm_device * dev, unsigned int *code)
        ADVANCE_LP_RING();
 }
 
-static void i830EmitStippleVerified(struct drm_device * dev, unsigned int *code)
+static void i830EmitStippleVerified(struct drm_device *dev, unsigned int *code)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        RING_LOCALS;
@@ -685,7 +682,7 @@ static void i830EmitStippleVerified(struct drm_device * dev, unsigned int *code)
        ADVANCE_LP_RING();
 }
 
-static void i830EmitState(struct drm_device * dev)
+static void i830EmitState(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -788,7 +785,7 @@ static void i830EmitState(struct drm_device * dev)
  * Performance monitoring functions
  */
 
-static void i830_fill_box(struct drm_device * dev,
+static void i830_fill_box(struct drm_device *dev,
                          int x, int y, int w, int h, int r, int g, int b)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
@@ -816,17 +813,16 @@ static void i830_fill_box(struct drm_device * dev,
        OUT_RING((y << 16) | x);
        OUT_RING(((y + h) << 16) | (x + w));
 
-       if (dev_priv->current_page == 1) {
+       if (dev_priv->current_page == 1)
                OUT_RING(dev_priv->front_offset);
-       } else {
+       else
                OUT_RING(dev_priv->back_offset);
-       }
 
        OUT_RING(color);
        ADVANCE_LP_RING();
 }
 
-static void i830_cp_performance_boxes(struct drm_device * dev)
+static void i830_cp_performance_boxes(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
 
@@ -871,7 +867,7 @@ static void i830_cp_performance_boxes(struct drm_device * dev)
        dev_priv->sarea_priv->perf_boxes = 0;
 }
 
-static void i830_dma_dispatch_clear(struct drm_device * dev, int flags,
+static void i830_dma_dispatch_clear(struct drm_device *dev, int flags,
                                    unsigned int clear_color,
                                    unsigned int clear_zval,
                                    unsigned int clear_depthmask)
@@ -966,7 +962,7 @@ static void i830_dma_dispatch_clear(struct drm_device * dev, int flags,
        }
 }
 
-static void i830_dma_dispatch_swap(struct drm_device * dev)
+static void i830_dma_dispatch_swap(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        drm_i830_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -1036,7 +1032,7 @@ static void i830_dma_dispatch_swap(struct drm_device * dev)
        }
 }
 
-static void i830_dma_dispatch_flip(struct drm_device * dev)
+static void i830_dma_dispatch_flip(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        RING_LOCALS;
@@ -1079,8 +1075,8 @@ static void i830_dma_dispatch_flip(struct drm_device * dev)
        dev_priv->sarea_priv->pf_current_page = dev_priv->current_page;
 }
 
-static void i830_dma_dispatch_vertex(struct drm_device * dev,
-                                    struct drm_buf * buf, int discard, int used)
+static void i830_dma_dispatch_vertex(struct drm_device *dev,
+                                    struct drm_buf *buf, int discard, int used)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        drm_i830_buf_priv_t *buf_priv = buf->dev_private;
@@ -1100,9 +1096,8 @@ static void i830_dma_dispatch_vertex(struct drm_device * dev,
        if (discard) {
                u = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT,
                            I830_BUF_HARDWARE);
-               if (u != I830_BUF_CLIENT) {
+               if (u != I830_BUF_CLIENT)
                        DRM_DEBUG("xxxx 2\n");
-               }
        }
 
        if (used > 4 * 1023)
@@ -1191,7 +1186,7 @@ static void i830_dma_dispatch_vertex(struct drm_device * dev,
        }
 }
 
-static void i830_dma_quiescent(struct drm_device * dev)
+static void i830_dma_quiescent(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        RING_LOCALS;
@@ -1208,7 +1203,7 @@ static void i830_dma_quiescent(struct drm_device * dev)
        i830_wait_ring(dev, dev_priv->ring.Size - 8, __func__);
 }
 
-static int i830_flush_queue(struct drm_device * dev)
+static int i830_flush_queue(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        struct drm_device_dma *dma = dev->dma;
@@ -1241,7 +1236,7 @@ static int i830_flush_queue(struct drm_device * dev)
 }
 
 /* Must be called with the lock held */
-static void i830_reclaim_buffers(struct drm_device * dev, struct drm_file *file_priv)
+static void i830_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)
 {
        struct drm_device_dma *dma = dev->dma;
        int i;
@@ -1316,9 +1311,8 @@ static int i830_clear_bufs(struct drm_device *dev, void *data,
        LOCK_TEST_WITH_RETURN(dev, file_priv);
 
        /* GH: Someone's doing nasty things... */
-       if (!dev->dev_private) {
+       if (!dev->dev_private)
                return -EINVAL;
-       }
 
        i830_dma_dispatch_clear(dev, clear->flags,
                                clear->clear_color,
@@ -1339,7 +1333,7 @@ static int i830_swap_bufs(struct drm_device *dev, void *data,
 
 /* Not sure why this isn't set all the time:
  */
-static void i830_do_init_pageflip(struct drm_device * dev)
+static void i830_do_init_pageflip(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
 
@@ -1349,7 +1343,7 @@ static void i830_do_init_pageflip(struct drm_device * dev)
        dev_priv->sarea_priv->pf_current_page = dev_priv->current_page;
 }
 
-static int i830_do_cleanup_pageflip(struct drm_device * dev)
+static int i830_do_cleanup_pageflip(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
 
@@ -1490,27 +1484,26 @@ int i830_driver_load(struct drm_device *dev, unsigned long flags)
        return 0;
 }
 
-void i830_driver_lastclose(struct drm_device * dev)
+void i830_driver_lastclose(struct drm_device *dev)
 {
        i830_dma_cleanup(dev);
 }
 
-void i830_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
+void i830_driver_preclose(struct drm_device *dev, struct drm_file *file_priv)
 {
        if (dev->dev_private) {
                drm_i830_private_t *dev_priv = dev->dev_private;
-               if (dev_priv->page_flipping) {
+               if (dev_priv->page_flipping)
                        i830_do_cleanup_pageflip(dev);
-               }
        }
 }
 
-void i830_driver_reclaim_buffers_locked(struct drm_device * dev, struct drm_file *file_priv)
+void i830_driver_reclaim_buffers_locked(struct drm_device *dev, struct drm_file *file_priv)
 {
        i830_reclaim_buffers(dev, file_priv);
 }
 
-int i830_driver_dma_quiescent(struct drm_device * dev)
+int i830_driver_dma_quiescent(struct drm_device *dev)
 {
        i830_dma_quiescent(dev);
        return 0;
@@ -1546,7 +1539,7 @@ int i830_max_ioctl = DRM_ARRAY_SIZE(i830_ioctls);
  * \returns
  * A value of 1 is always retured to indictate every i8xx is AGP.
  */
-int i830_driver_device_is_agp(struct drm_device * dev)
+int i830_driver_device_is_agp(struct drm_device *dev)
 {
        return 1;
 }
index da82afe4ded5664734bc8869b055206dcb245a1c..ecfd25a35da386b594468960be05113cfb0d1513 100644 (file)
@@ -132,33 +132,33 @@ extern int i830_irq_wait(struct drm_device *dev, void *data,
                         struct drm_file *file_priv);
 
 extern irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS);
-extern void i830_driver_irq_preinstall(struct drm_device * dev);
-extern void i830_driver_irq_postinstall(struct drm_device * dev);
-extern void i830_driver_irq_uninstall(struct drm_device * dev);
+extern void i830_driver_irq_preinstall(struct drm_device *dev);
+extern void i830_driver_irq_postinstall(struct drm_device *dev);
+extern void i830_driver_irq_uninstall(struct drm_device *dev);
 extern int i830_driver_load(struct drm_device *, unsigned long flags);
-extern void i830_driver_preclose(struct drm_device * dev,
+extern void i830_driver_preclose(struct drm_device *dev,
                                 struct drm_file *file_priv);
-extern void i830_driver_lastclose(struct drm_device * dev);
-extern void i830_driver_reclaim_buffers_locked(struct drm_device * dev,
+extern void i830_driver_lastclose(struct drm_device *dev);
+extern void i830_driver_reclaim_buffers_locked(struct drm_device *dev,
                                               struct drm_file *file_priv);
-extern int i830_driver_dma_quiescent(struct drm_device * dev);
-extern int i830_driver_device_is_agp(struct drm_device * dev);
+extern int i830_driver_dma_quiescent(struct drm_device *dev);
+extern int i830_driver_device_is_agp(struct drm_device *dev);
 
-#define I830_READ(reg)          DRM_READ32(dev_priv->mmio_map, reg)
-#define I830_WRITE(reg,val)     DRM_WRITE32(dev_priv->mmio_map, reg, val)
-#define I830_READ16(reg)        DRM_READ16(dev_priv->mmio_map, reg)
-#define I830_WRITE16(reg,val)   DRM_WRITE16(dev_priv->mmio_map, reg, val)
+#define I830_READ(reg)         DRM_READ32(dev_priv->mmio_map, reg)
+#define I830_WRITE(reg, val)   DRM_WRITE32(dev_priv->mmio_map, reg, val)
+#define I830_READ16(reg)       DRM_READ16(dev_priv->mmio_map, reg)
+#define I830_WRITE16(reg, val) DRM_WRITE16(dev_priv->mmio_map, reg, val)
 
 #define I830_VERBOSE 0
 
 #define RING_LOCALS    unsigned int outring, ringmask, outcount; \
-                        volatile char *virt;
+                       volatile char *virt;
 
 #define BEGIN_LP_RING(n) do {                          \
        if (I830_VERBOSE)                               \
                printk("BEGIN_LP_RING(%d)\n", (n));     \
        if (dev_priv->ring.space < n*4)                 \
-               i830_wait_ring(dev, n*4, __func__);             \
+               i830_wait_ring(dev, n*4, __func__);     \
        outcount = 0;                                   \
        outring = dev_priv->ring.tail;                  \
        ringmask = dev_priv->ring.tail_mask;            \
@@ -166,21 +166,23 @@ extern int i830_driver_device_is_agp(struct drm_device * dev);
 } while (0)
 
 #define OUT_RING(n) do {                                       \
-       if (I830_VERBOSE) printk("   OUT_RING %x\n", (int)(n)); \
+       if (I830_VERBOSE)                                       \
+               printk("   OUT_RING %x\n", (int)(n));           \
        *(volatile unsigned int *)(virt + outring) = n;         \
-        outcount++;                                            \
+       outcount++;                                             \
        outring += 4;                                           \
        outring &= ringmask;                                    \
 } while (0)
 
-#define ADVANCE_LP_RING() do {                                         \
-       if (I830_VERBOSE) printk("ADVANCE_LP_RING %x\n", outring);      \
-       dev_priv->ring.tail = outring;                                  \
-       dev_priv->ring.space -= outcount * 4;                           \
-       I830_WRITE(LP_RING + RING_TAIL, outring);                       \
-} while(0)
+#define ADVANCE_LP_RING() do {                                 \
+       if (I830_VERBOSE)                                       \
+               printk("ADVANCE_LP_RING %x\n", outring);        \
+       dev_priv->ring.tail = outring;                          \
+       dev_priv->ring.space -= outcount * 4;                   \
+       I830_WRITE(LP_RING + RING_TAIL, outring);               \
+} while (0)
 
-extern int i830_wait_ring(struct drm_device * dev, int n, const char *caller);
+extern int i830_wait_ring(struct drm_device *dev, int n, const char *caller);
 
 #define GFX_OP_USER_INTERRUPT          ((0<<29)|(2<<23))
 #define GFX_OP_BREAKPOINT_INTERRUPT    ((0<<29)|(1<<23))
index 91ec2bb497e97d6622be7f38c048360402f4caf9..d1a6b95d631d7ea819299f5010866306111070d2 100644 (file)
@@ -53,7 +53,7 @@ irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS)
        return IRQ_HANDLED;
 }
 
-static int i830_emit_irq(struct drm_device * dev)
+static int i830_emit_irq(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = dev->dev_private;
        RING_LOCALS;
@@ -70,7 +70,7 @@ static int i830_emit_irq(struct drm_device * dev)
        return atomic_read(&dev_priv->irq_emitted);
 }
 
-static int i830_wait_irq(struct drm_device * dev, int irq_nr)
+static int i830_wait_irq(struct drm_device *dev, int irq_nr)
 {
        drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
        DECLARE_WAITQUEUE(entry, current);
@@ -156,7 +156,7 @@ int i830_irq_wait(struct drm_device *dev, void *data,
 
 /* drm_dma.h hooks
 */
-void i830_driver_irq_preinstall(struct drm_device * dev)
+void i830_driver_irq_preinstall(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
 
@@ -168,14 +168,14 @@ void i830_driver_irq_preinstall(struct drm_device * dev)
        init_waitqueue_head(&dev_priv->irq_queue);
 }
 
-void i830_driver_irq_postinstall(struct drm_device * dev)
+void i830_driver_irq_postinstall(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
 
        I830_WRITE16(I830REG_INT_ENABLE_R, 0x2);
 }
 
-void i830_driver_irq_uninstall(struct drm_device * dev)
+void i830_driver_irq_uninstall(struct drm_device *dev)
 {
        drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
        if (!dev_priv)
index ccc129c328a41941cce5e33839bad1bae62ab513..08868ac3048aec326ce203ba82d6af1f83ff3ac0 100644 (file)
@@ -52,7 +52,7 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup);
  * Engine control
  */
 
-int mga_do_wait_for_idle(drm_mga_private_t * dev_priv)
+int mga_do_wait_for_idle(drm_mga_private_t *dev_priv)
 {
        u32 status = 0;
        int i;
@@ -74,7 +74,7 @@ int mga_do_wait_for_idle(drm_mga_private_t * dev_priv)
        return -EBUSY;
 }
 
-static int mga_do_dma_reset(drm_mga_private_t * dev_priv)
+static int mga_do_dma_reset(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_mga_primary_buffer_t *primary = &dev_priv->prim;
@@ -102,7 +102,7 @@ static int mga_do_dma_reset(drm_mga_private_t * dev_priv)
  * Primary DMA stream
  */
 
-void mga_do_dma_flush(drm_mga_private_t * dev_priv)
+void mga_do_dma_flush(drm_mga_private_t *dev_priv)
 {
        drm_mga_primary_buffer_t *primary = &dev_priv->prim;
        u32 head, tail;
@@ -142,11 +142,10 @@ void mga_do_dma_flush(drm_mga_private_t * dev_priv)
 
        head = MGA_READ(MGA_PRIMADDRESS);
 
-       if (head <= tail) {
+       if (head <= tail)
                primary->space = primary->size - primary->tail;
-       } else {
+       else
                primary->space = head - tail;
-       }
 
        DRM_DEBUG("   head = 0x%06lx\n", (unsigned long)(head - dev_priv->primary->offset));
        DRM_DEBUG("   tail = 0x%06lx\n", (unsigned long)(tail - dev_priv->primary->offset));
@@ -158,7 +157,7 @@ void mga_do_dma_flush(drm_mga_private_t * dev_priv)
        DRM_DEBUG("done.\n");
 }
 
-void mga_do_dma_wrap_start(drm_mga_private_t * dev_priv)
+void mga_do_dma_wrap_start(drm_mga_private_t *dev_priv)
 {
        drm_mga_primary_buffer_t *primary = &dev_priv->prim;
        u32 head, tail;
@@ -181,11 +180,10 @@ void mga_do_dma_wrap_start(drm_mga_private_t * dev_priv)
 
        head = MGA_READ(MGA_PRIMADDRESS);
 
-       if (head == dev_priv->primary->offset) {
+       if (head == dev_priv->primary->offset)
                primary->space = primary->size;
-       } else {
+       else
                primary->space = head - dev_priv->primary->offset;
-       }
 
        DRM_DEBUG("   head = 0x%06lx\n", (unsigned long)(head - dev_priv->primary->offset));
        DRM_DEBUG("   tail = 0x%06x\n", primary->tail);
@@ -199,7 +197,7 @@ void mga_do_dma_wrap_start(drm_mga_private_t * dev_priv)
        DRM_DEBUG("done.\n");
 }
 
-void mga_do_dma_wrap_end(drm_mga_private_t * dev_priv)
+void mga_do_dma_wrap_end(drm_mga_private_t *dev_priv)
 {
        drm_mga_primary_buffer_t *primary = &dev_priv->prim;
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -220,11 +218,11 @@ void mga_do_dma_wrap_end(drm_mga_private_t * dev_priv)
  * Freelist management
  */
 
-#define MGA_BUFFER_USED                ~0
+#define MGA_BUFFER_USED                (~0)
 #define MGA_BUFFER_FREE                0
 
 #if MGA_FREELIST_DEBUG
-static void mga_freelist_print(struct drm_device * dev)
+static void mga_freelist_print(struct drm_device *dev)
 {
        drm_mga_private_t *dev_priv = dev->dev_private;
        drm_mga_freelist_t *entry;
@@ -245,7 +243,7 @@ static void mga_freelist_print(struct drm_device * dev)
 }
 #endif
 
-static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_priv)
+static int mga_freelist_init(struct drm_device *dev, drm_mga_private_t *dev_priv)
 {
        struct drm_device_dma *dma = dev->dma;
        struct drm_buf *buf;
@@ -288,7 +286,7 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr
        return 0;
 }
 
-static void mga_freelist_cleanup(struct drm_device * dev)
+static void mga_freelist_cleanup(struct drm_device *dev)
 {
        drm_mga_private_t *dev_priv = dev->dev_private;
        drm_mga_freelist_t *entry;
@@ -308,7 +306,7 @@ static void mga_freelist_cleanup(struct drm_device * dev)
 #if 0
 /* FIXME: Still needed?
  */
-static void mga_freelist_reset(struct drm_device * dev)
+static void mga_freelist_reset(struct drm_device *dev)
 {
        struct drm_device_dma *dma = dev->dma;
        struct drm_buf *buf;
@@ -356,7 +354,7 @@ static struct drm_buf *mga_freelist_get(struct drm_device * dev)
        return NULL;
 }
 
-int mga_freelist_put(struct drm_device * dev, struct drm_buf * buf)
+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;
@@ -391,7 +389,7 @@ int mga_freelist_put(struct drm_device * dev, struct drm_buf * buf)
  * DMA initialization, cleanup
  */
 
-int mga_driver_load(struct drm_device * dev, unsigned long flags)
+int mga_driver_load(struct drm_device *dev, unsigned long flags)
 {
        drm_mga_private_t *dev_priv;
        int ret;
@@ -439,8 +437,8 @@ int mga_driver_load(struct drm_device * dev, unsigned long flags)
  *
  * \sa mga_do_dma_bootstrap, mga_do_pci_dma_bootstrap
  */
-static int mga_do_agp_dma_bootstrap(struct drm_device * dev,
-                                   drm_mga_dma_bootstrap_t * dma_bs)
+static int mga_do_agp_dma_bootstrap(struct drm_device *dev,
+                                   drm_mga_dma_bootstrap_t *dma_bs)
 {
        drm_mga_private_t *const dev_priv =
            (drm_mga_private_t *) dev->dev_private;
@@ -481,11 +479,10 @@ static int mga_do_agp_dma_bootstrap(struct drm_device * dev,
         */
 
        if (dev_priv->chipset == MGA_CARD_TYPE_G200) {
-               if (mode.mode & 0x02) {
+               if (mode.mode & 0x02)
                        MGA_WRITE(MGA_AGP_PLL, MGA_AGP2XPLL_ENABLE);
-               } else {
+               else
                        MGA_WRITE(MGA_AGP_PLL, MGA_AGP2XPLL_DISABLE);
-               }
        }
 
        /* Allocate and bind AGP memory. */
@@ -593,8 +590,8 @@ static int mga_do_agp_dma_bootstrap(struct drm_device * dev,
        return 0;
 }
 #else
-static int mga_do_agp_dma_bootstrap(struct drm_device * dev,
-                                   drm_mga_dma_bootstrap_t * dma_bs)
+static int mga_do_agp_dma_bootstrap(struct drm_device *dev,
+                                   drm_mga_dma_bootstrap_t *dma_bs)
 {
        return -EINVAL;
 }
@@ -614,8 +611,8 @@ static int mga_do_agp_dma_bootstrap(struct drm_device * dev,
  *
  * \sa mga_do_dma_bootstrap, mga_do_agp_dma_bootstrap
  */
-static int mga_do_pci_dma_bootstrap(struct drm_device * dev,
-                                   drm_mga_dma_bootstrap_t * dma_bs)
+static int mga_do_pci_dma_bootstrap(struct drm_device *dev,
+                                   drm_mga_dma_bootstrap_t *dma_bs)
 {
        drm_mga_private_t *const dev_priv =
            (drm_mga_private_t *) dev->dev_private;
@@ -678,9 +675,8 @@ static int mga_do_pci_dma_bootstrap(struct drm_device * dev,
                req.size = dma_bs->secondary_bin_size;
 
                err = drm_addbufs_pci(dev, &req);
-               if (!err) {
+               if (!err)
                        break;
-               }
        }
 
        if (bin_count == 0) {
@@ -704,8 +700,8 @@ static int mga_do_pci_dma_bootstrap(struct drm_device * dev,
        return 0;
 }
 
-static int mga_do_dma_bootstrap(struct drm_device * dev,
-                               drm_mga_dma_bootstrap_t * dma_bs)
+static int mga_do_dma_bootstrap(struct drm_device *dev,
+                               drm_mga_dma_bootstrap_t *dma_bs)
 {
        const int is_agp = (dma_bs->agp_mode != 0) && drm_device_is_agp(dev);
        int err;
@@ -737,17 +733,15 @@ static int mga_do_dma_bootstrap(struct drm_device * dev,
         * carve off portions of it for internal uses.  The remaining memory
         * is returned to user-mode to be used for AGP textures.
         */
-       if (is_agp) {
+       if (is_agp)
                err = mga_do_agp_dma_bootstrap(dev, dma_bs);
-       }
 
        /* If we attempted to initialize the card for AGP DMA but failed,
         * clean-up any mess that may have been created.
         */
 
-       if (err) {
+       if (err)
                mga_do_cleanup_dma(dev, MINIMAL_CLEANUP);
-       }
 
        /* Not only do we want to try and initialized PCI cards for PCI DMA,
         * but we also try to initialized AGP cards that could not be
@@ -757,9 +751,8 @@ static int mga_do_dma_bootstrap(struct drm_device * dev,
         * AGP memory, etc.
         */
 
-       if (!is_agp || err) {
+       if (!is_agp || err)
                err = mga_do_pci_dma_bootstrap(dev, dma_bs);
-       }
 
        return err;
 }
@@ -792,7 +785,7 @@ int mga_dma_bootstrap(struct drm_device *dev, void *data,
        return err;
 }
 
-static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init)
+static int mga_do_init_dma(struct drm_device *dev, drm_mga_init_t *init)
 {
        drm_mga_private_t *dev_priv;
        int ret;
@@ -800,11 +793,10 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init)
 
        dev_priv = dev->dev_private;
 
-       if (init->sgram) {
+       if (init->sgram)
                dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_BLK;
-       } else {
+       else
                dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_RSTR;
-       }
        dev_priv->maccess = init->maccess;
 
        dev_priv->fb_cpp = init->fb_cpp;
@@ -975,9 +967,8 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)
                                dev_priv->agp_handle = 0;
                        }
 
-                       if ((dev->agp != NULL) && dev->agp->acquired) {
+                       if ((dev->agp != NULL) && dev->agp->acquired)
                                err = drm_agp_release(dev);
-                       }
 #endif
                }
 
@@ -998,9 +989,8 @@ static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)
                memset(dev_priv->warp_pipe_phys, 0,
                       sizeof(dev_priv->warp_pipe_phys));
 
-               if (dev_priv->head != NULL) {
+               if (dev_priv->head != NULL)
                        mga_freelist_cleanup(dev);
-               }
        }
 
        return err;
@@ -1017,9 +1007,8 @@ int mga_dma_init(struct drm_device *dev, void *data,
        switch (init->func) {
        case MGA_INIT_DMA:
                err = mga_do_init_dma(dev, init);
-               if (err) {
+               if (err)
                        (void)mga_do_cleanup_dma(dev, FULL_CLEANUP);
-               }
                return err;
        case MGA_CLEANUP_DMA:
                return mga_do_cleanup_dma(dev, FULL_CLEANUP);
@@ -1047,9 +1036,8 @@ int mga_dma_flush(struct drm_device *dev, void *data,
 
        WRAP_WAIT_WITH_RETURN(dev_priv);
 
-       if (lock->flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL)) {
+       if (lock->flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL))
                mga_do_dma_flush(dev_priv);
-       }
 
        if (lock->flags & _DRM_LOCK_QUIESCENT) {
 #if MGA_DMA_DEBUG
@@ -1079,8 +1067,8 @@ int mga_dma_reset(struct drm_device *dev, void *data,
  * DMA buffer management
  */
 
-static int mga_dma_get_buffers(struct drm_device * dev,
-                              struct drm_file *file_priv, struct drm_dma * d)
+static int mga_dma_get_buffers(struct drm_device *dev,
+                              struct drm_file *file_priv, struct drm_dma *d)
 {
        struct drm_buf *buf;
        int i;
@@ -1134,9 +1122,8 @@ int mga_dma_buffers(struct drm_device *dev, void *data,
 
        d->granted_count = 0;
 
-       if (d->request_count) {
+       if (d->request_count)
                ret = mga_dma_get_buffers(dev, file_priv, d);
-       }
 
        return ret;
 }
@@ -1144,7 +1131,7 @@ int mga_dma_buffers(struct drm_device *dev, void *data,
 /**
  * Called just before the module is unloaded.
  */
-int mga_driver_unload(struct drm_device * dev)
+int mga_driver_unload(struct drm_device *dev)
 {
        kfree(dev->dev_private);
        dev->dev_private = NULL;
@@ -1155,12 +1142,12 @@ int mga_driver_unload(struct drm_device * dev)
 /**
  * Called when the last opener of the device is closed.
  */
-void mga_driver_lastclose(struct drm_device * dev)
+void mga_driver_lastclose(struct drm_device *dev)
 {
        mga_do_cleanup_dma(dev, FULL_CLEANUP);
 }
 
-int mga_driver_dma_quiescent(struct drm_device * dev)
+int mga_driver_dma_quiescent(struct drm_device *dev)
 {
        drm_mga_private_t *dev_priv = dev->dev_private;
        return mga_do_wait_for_idle(dev_priv);
index ddfe16197b59336e6d9c874e9e1b855a8222c430..26d0d8ced80d4357421875b4c7344f53e21d96b4 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "drm_pciids.h"
 
-static int mga_driver_device_is_agp(struct drm_device * dev);
+static int mga_driver_device_is_agp(struct drm_device *dev);
 
 static struct pci_device_id pciidlist[] = {
        mga_PCI_IDS
@@ -119,7 +119,7 @@ MODULE_LICENSE("GPL and additional rights");
  * \returns
  * If the device is a PCI G450, zero is returned.  Otherwise 2 is returned.
  */
-static int mga_driver_device_is_agp(struct drm_device * dev)
+static int mga_driver_device_is_agp(struct drm_device *dev)
 {
        const struct pci_dev *const pdev = dev->pdev;
 
index be6c6b9b0e89a3b3d3af7c2cf134744f210571ce..1084fa4d261b7c9d6638d965a5a4c401c9949720 100644 (file)
@@ -164,59 +164,59 @@ extern int mga_dma_reset(struct drm_device *dev, void *data,
 extern int mga_dma_buffers(struct drm_device *dev, void *data,
                           struct drm_file *file_priv);
 extern int mga_driver_load(struct drm_device *dev, unsigned long flags);
-extern int mga_driver_unload(struct drm_device * dev);
-extern void mga_driver_lastclose(struct drm_device * dev);
-extern int mga_driver_dma_quiescent(struct drm_device * dev);
+extern int mga_driver_unload(struct drm_device *dev);
+extern void mga_driver_lastclose(struct drm_device *dev);
+extern int mga_driver_dma_quiescent(struct drm_device *dev);
 
-extern int mga_do_wait_for_idle(drm_mga_private_t * dev_priv);
+extern int mga_do_wait_for_idle(drm_mga_private_t *dev_priv);
 
-extern void mga_do_dma_flush(drm_mga_private_t * dev_priv);
-extern void mga_do_dma_wrap_start(drm_mga_private_t * dev_priv);
-extern void mga_do_dma_wrap_end(drm_mga_private_t * dev_priv);
+extern void mga_do_dma_flush(drm_mga_private_t *dev_priv);
+extern void mga_do_dma_wrap_start(drm_mga_private_t *dev_priv);
+extern void mga_do_dma_wrap_end(drm_mga_private_t *dev_priv);
 
-extern int mga_freelist_put(struct drm_device * dev, struct drm_buf * buf);
+extern int mga_freelist_put(struct drm_device *dev, struct drm_buf *buf);
 
                                /* mga_warp.c */
-extern int mga_warp_install_microcode(drm_mga_private_t * dev_priv);
-extern int mga_warp_init(drm_mga_private_t * dev_priv);
+extern int mga_warp_install_microcode(drm_mga_private_t *dev_priv);
+extern int mga_warp_init(drm_mga_private_t *dev_priv);
 
                                /* mga_irq.c */
 extern int mga_enable_vblank(struct drm_device *dev, int crtc);
 extern void mga_disable_vblank(struct drm_device *dev, int crtc);
 extern u32 mga_get_vblank_counter(struct drm_device *dev, int crtc);
-extern int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence);
-extern int mga_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence);
+extern int mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence);
+extern int mga_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence);
 extern irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS);
-extern void mga_driver_irq_preinstall(struct drm_device * dev);
+extern void mga_driver_irq_preinstall(struct drm_device *dev);
 extern int mga_driver_irq_postinstall(struct drm_device *dev);
-extern void mga_driver_irq_uninstall(struct drm_device * dev);
+extern void mga_driver_irq_uninstall(struct drm_device *dev);
 extern long mga_compat_ioctl(struct file *filp, unsigned int cmd,
                             unsigned long arg);
 
 #define mga_flush_write_combine()      DRM_WRITEMEMORYBARRIER()
 
 #if defined(__linux__) && defined(__alpha__)
-#define MGA_BASE( reg )                ((unsigned long)(dev_priv->mmio->handle))
-#define MGA_ADDR( reg )                (MGA_BASE(reg) + reg)
+#define MGA_BASE(reg)          ((unsigned long)(dev_priv->mmio->handle))
+#define MGA_ADDR(reg)          (MGA_BASE(reg) + reg)
 
-#define MGA_DEREF( reg )       *(volatile u32 *)MGA_ADDR( reg )
-#define MGA_DEREF8( reg )      *(volatile u8 *)MGA_ADDR( reg )
+#define MGA_DEREF(reg)         (*(volatile u32 *)MGA_ADDR(reg))
+#define MGA_DEREF8(reg)                (*(volatile u8 *)MGA_ADDR(reg))
 
-#define MGA_READ( reg )                (_MGA_READ((u32 *)MGA_ADDR(reg)))
-#define MGA_READ8( reg )       (_MGA_READ((u8 *)MGA_ADDR(reg)))
-#define MGA_WRITE( reg, val )  do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF( reg ) = val; } while (0)
-#define MGA_WRITE8( reg, val )  do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF8( reg ) = val; } while (0)
+#define MGA_READ(reg)          (_MGA_READ((u32 *)MGA_ADDR(reg)))
+#define MGA_READ8(reg)         (_MGA_READ((u8 *)MGA_ADDR(reg)))
+#define MGA_WRITE(reg, val)    do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF(reg) = val; } while (0)
+#define MGA_WRITE8(reg, val)   do { DRM_WRITEMEMORYBARRIER(); MGA_DEREF8(reg) = val; } while (0)
 
-static inline u32 _MGA_READ(u32 * addr)
+static inline u32 _MGA_READ(u32 *addr)
 {
        DRM_MEMORYBARRIER();
        return *(volatile u32 *)addr;
 }
 #else
-#define MGA_READ8( reg )       DRM_READ8(dev_priv->mmio, (reg))
-#define MGA_READ( reg )                DRM_READ32(dev_priv->mmio, (reg))
-#define MGA_WRITE8( reg, val )  DRM_WRITE8(dev_priv->mmio, (reg), (val))
-#define MGA_WRITE( reg, val )  DRM_WRITE32(dev_priv->mmio, (reg), (val))
+#define MGA_READ8(reg)         DRM_READ8(dev_priv->mmio, (reg))
+#define MGA_READ(reg)          DRM_READ32(dev_priv->mmio, (reg))
+#define MGA_WRITE8(reg, val)   DRM_WRITE8(dev_priv->mmio, (reg), (val))
+#define MGA_WRITE(reg, val)    DRM_WRITE32(dev_priv->mmio, (reg), (val))
 #endif
 
 #define DWGREG0                0x1c00
@@ -233,40 +233,39 @@ static inline u32 _MGA_READ(u32 * addr)
  * Helper macross...
  */
 
-#define MGA_EMIT_STATE( dev_priv, dirty )                              \
+#define MGA_EMIT_STATE(dev_priv, dirty)                                        \
 do {                                                                   \
-       if ( (dirty) & ~MGA_UPLOAD_CLIPRECTS ) {                        \
-               if ( dev_priv->chipset >= MGA_CARD_TYPE_G400 ) {        \
-                       mga_g400_emit_state( dev_priv );                \
-               } else {                                                \
-                       mga_g200_emit_state( dev_priv );                \
-               }                                                       \
+       if ((dirty) & ~MGA_UPLOAD_CLIPRECTS) {                          \
+               if (dev_priv->chipset >= MGA_CARD_TYPE_G400)            \
+                       mga_g400_emit_state(dev_priv);                  \
+               else                                                    \
+                       mga_g200_emit_state(dev_priv);                  \
        }                                                               \
 } while (0)
 
-#define WRAP_TEST_WITH_RETURN( dev_priv )                              \
+#define WRAP_TEST_WITH_RETURN(dev_priv)                                        \
 do {                                                                   \
-       if ( test_bit( 0, &dev_priv->prim.wrapped ) ) {                 \
-               if ( mga_is_idle( dev_priv ) ) {                        \
-                       mga_do_dma_wrap_end( dev_priv );                \
-               } else if ( dev_priv->prim.space <                      \
-                           dev_priv->prim.high_mark ) {                \
-                       if ( MGA_DMA_DEBUG )                            \
-                               DRM_INFO( "wrap...\n");         \
-                       return -EBUSY;                  \
+       if (test_bit(0, &dev_priv->prim.wrapped)) {                     \
+               if (mga_is_idle(dev_priv)) {                            \
+                       mga_do_dma_wrap_end(dev_priv);                  \
+               } else if (dev_priv->prim.space <                       \
+                          dev_priv->prim.high_mark) {                  \
+                       if (MGA_DMA_DEBUG)                              \
+                               DRM_INFO("wrap...\n");                  \
+                       return -EBUSY;                                  \
                }                                                       \
        }                                                               \
 } while (0)
 
-#define WRAP_WAIT_WITH_RETURN( dev_priv )                              \
+#define WRAP_WAIT_WITH_RETURN(dev_priv)                                        \
 do {                                                                   \
-       if ( test_bit( 0, &dev_priv->prim.wrapped ) ) {                 \
-               if ( mga_do_wait_for_idle( dev_priv ) < 0 ) {           \
-                       if ( MGA_DMA_DEBUG )                            \
-                               DRM_INFO( "wrap...\n");         \
-                       return -EBUSY;                  \
+       if (test_bit(0, &dev_priv->prim.wrapped)) {                     \
+               if (mga_do_wait_for_idle(dev_priv) < 0) {               \
+                       if (MGA_DMA_DEBUG)                              \
+                               DRM_INFO("wrap...\n");                  \
+                       return -EBUSY;                                  \
                }                                                       \
-               mga_do_dma_wrap_end( dev_priv );                        \
+               mga_do_dma_wrap_end(dev_priv);                          \
        }                                                               \
 } while (0)
 
@@ -280,12 +279,12 @@ do {                                                                      \
 
 #define DMA_BLOCK_SIZE (5 * sizeof(u32))
 
-#define BEGIN_DMA( n )                                                 \
+#define BEGIN_DMA(n)                                                   \
 do {                                                                   \
-       if ( MGA_VERBOSE ) {                                            \
-               DRM_INFO( "BEGIN_DMA( %d )\n", (n) );           \
-               DRM_INFO( "   space=0x%x req=0x%Zx\n",                  \
-                         dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \
+       if (MGA_VERBOSE) {                                              \
+               DRM_INFO("BEGIN_DMA(%d)\n", (n));                       \
+               DRM_INFO("   space=0x%x req=0x%Zx\n",                   \
+                        dev_priv->prim.space, (n) * DMA_BLOCK_SIZE);   \
        }                                                               \
        prim = dev_priv->prim.start;                                    \
        write = dev_priv->prim.tail;                                    \
@@ -293,9 +292,9 @@ do {                                                                        \
 
 #define BEGIN_DMA_WRAP()                                               \
 do {                                                                   \
-       if ( MGA_VERBOSE ) {                                            \
-               DRM_INFO( "BEGIN_DMA()\n" );                            \
-               DRM_INFO( "   space=0x%x\n", dev_priv->prim.space );    \
+       if (MGA_VERBOSE) {                                              \
+               DRM_INFO("BEGIN_DMA()\n");                              \
+               DRM_INFO("   space=0x%x\n", dev_priv->prim.space);      \
        }                                                               \
        prim = dev_priv->prim.start;                                    \
        write = dev_priv->prim.tail;                                    \
@@ -304,72 +303,68 @@ do {                                                                      \
 #define ADVANCE_DMA()                                                  \
 do {                                                                   \
        dev_priv->prim.tail = write;                                    \
-       if ( MGA_VERBOSE ) {                                            \
-               DRM_INFO( "ADVANCE_DMA() tail=0x%05x sp=0x%x\n",        \
-                         write, dev_priv->prim.space );                \
-       }                                                               \
+       if (MGA_VERBOSE)                                                \
+               DRM_INFO("ADVANCE_DMA() tail=0x%05x sp=0x%x\n",         \
+                        write, dev_priv->prim.space);                  \
 } while (0)
 
 #define FLUSH_DMA()                                                    \
 do {                                                                   \
-       if ( 0 ) {                                                      \
-               DRM_INFO( "\n" );                                       \
-               DRM_INFO( "   tail=0x%06x head=0x%06lx\n",              \
-                         dev_priv->prim.tail,                          \
-                         (unsigned long)(MGA_READ(MGA_PRIMADDRESS) -   \
-                                         dev_priv->primary->offset));  \
+       if (0) {                                                        \
+               DRM_INFO("\n");                                         \
+               DRM_INFO("   tail=0x%06x head=0x%06lx\n",               \
+                        dev_priv->prim.tail,                           \
+                        (unsigned long)(MGA_READ(MGA_PRIMADDRESS) -    \
+                                        dev_priv->primary->offset));   \
        }                                                               \
-       if ( !test_bit( 0, &dev_priv->prim.wrapped ) ) {                \
-               if ( dev_priv->prim.space <                             \
-                    dev_priv->prim.high_mark ) {                       \
-                       mga_do_dma_wrap_start( dev_priv );              \
-               } else {                                                \
-                       mga_do_dma_flush( dev_priv );                   \
-               }                                                       \
+       if (!test_bit(0, &dev_priv->prim.wrapped)) {                    \
+               if (dev_priv->prim.space < dev_priv->prim.high_mark)    \
+                       mga_do_dma_wrap_start(dev_priv);                \
+               else                                                    \
+                       mga_do_dma_flush(dev_priv);                     \
        }                                                               \
 } while (0)
 
 /* Never use this, always use DMA_BLOCK(...) for primary DMA output.
  */
-#define DMA_WRITE( offset, val )                                       \
+#define DMA_WRITE(offset, val)                                         \
 do {                                                                   \
-       if ( MGA_VERBOSE ) {                                            \
-               DRM_INFO( "   DMA_WRITE( 0x%08x ) at 0x%04Zx\n",        \
-                         (u32)(val), write + (offset) * sizeof(u32) ); \
-       }                                                               \
+       if (MGA_VERBOSE)                                                \
+               DRM_INFO("   DMA_WRITE( 0x%08x ) at 0x%04Zx\n",         \
+                        (u32)(val), write + (offset) * sizeof(u32));   \
        *(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \
 } while (0)
 
-#define DMA_BLOCK( reg0, val0, reg1, val1, reg2, val2, reg3, val3 )    \
+#define DMA_BLOCK(reg0, val0, reg1, val1, reg2, val2, reg3, val3)      \
 do {                                                                   \
-       DMA_WRITE( 0, ((DMAREG( reg0 ) << 0) |                          \
-                      (DMAREG( reg1 ) << 8) |                          \
-                      (DMAREG( reg2 ) << 16) |                         \
-                      (DMAREG( reg3 ) << 24)) );                       \
-       DMA_WRITE( 1, val0 );                                           \
-       DMA_WRITE( 2, val1 );                                           \
-       DMA_WRITE( 3, val2 );                                           \
-       DMA_WRITE( 4, val3 );                                           \
+       DMA_WRITE(0, ((DMAREG(reg0) << 0) |                             \
+                     (DMAREG(reg1) << 8) |                             \
+                     (DMAREG(reg2) << 16) |                            \
+                     (DMAREG(reg3) << 24)));                           \
+       DMA_WRITE(1, val0);                                             \
+       DMA_WRITE(2, val1);                                             \
+       DMA_WRITE(3, val2);                                             \
+       DMA_WRITE(4, val3);                                             \
        write += DMA_BLOCK_SIZE;                                        \
 } while (0)
 
 /* Buffer aging via primary DMA stream head pointer.
  */
 
-#define SET_AGE( age, h, w )                                           \
+#define SET_AGE(age, h, w)                                             \
 do {                                                                   \
        (age)->head = h;                                                \
        (age)->wrap = w;                                                \
 } while (0)
 
-#define TEST_AGE( age, h, w )          ( (age)->wrap < w ||            \
-                                         ( (age)->wrap == w &&         \
-                                           (age)->head < h ) )
+#define TEST_AGE(age, h, w)            ((age)->wrap < w ||             \
+                                        ((age)->wrap == w &&           \
+                                         (age)->head < h))
 
-#define AGE_BUFFER( buf_priv )                                         \
+#define AGE_BUFFER(buf_priv)                                           \
 do {                                                                   \
        drm_mga_freelist_t *entry = (buf_priv)->list_entry;             \
-       if ( (buf_priv)->dispatched ) {                                 \
+       if ((buf_priv)->dispatched) {                                   \
                entry->age.head = (dev_priv->prim.tail +                \
                                   dev_priv->primary->offset);          \
                entry->age.wrap = dev_priv->sarea_priv->last_wrap;      \
@@ -681,7 +676,7 @@ do {                                                                        \
 
 /* Simple idle test.
  */
-static __inline__ int mga_is_idle(drm_mga_private_t * dev_priv)
+static __inline__ int mga_is_idle(drm_mga_private_t *dev_priv)
 {
        u32 status = MGA_READ(MGA_STATUS) & MGA_ENGINE_IDLE_MASK;
        return (status == MGA_ENDPRDMASTS);
index daa6041a483ad8be9f608b72f4c3f79db7f63e01..2581202297e4e973e48d22e4c76e4997022d7eb4 100644 (file)
@@ -76,9 +76,8 @@ irqreturn_t mga_driver_irq_handler(DRM_IRQ_ARGS)
                /* In addition to clearing the interrupt-pending bit, we
                 * have to write to MGA_PRIMEND to re-start the DMA operation.
                 */
-               if ((prim_start & ~0x03) != (prim_end & ~0x03)) {
+               if ((prim_start & ~0x03) != (prim_end & ~0x03))
                        MGA_WRITE(MGA_PRIMEND, prim_end);
-               }
 
                atomic_inc(&dev_priv->last_fence_retired);
                DRM_WAKEUP(&dev_priv->fence_queue);
@@ -120,7 +119,7 @@ void mga_disable_vblank(struct drm_device *dev, int crtc)
        /* MGA_WRITE(MGA_IEN, MGA_VLINEIEN | MGA_SOFTRAPEN); */
 }
 
-int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence)
+int mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence)
 {
        drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
        unsigned int cur_fence;
@@ -139,7 +138,7 @@ int mga_driver_fence_wait(struct drm_device * dev, unsigned int *sequence)
        return ret;
 }
 
-void mga_driver_irq_preinstall(struct drm_device * dev)
+void mga_driver_irq_preinstall(struct drm_device *dev)
 {
        drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
 
@@ -162,7 +161,7 @@ int mga_driver_irq_postinstall(struct drm_device *dev)
        return 0;
 }
 
-void mga_driver_irq_uninstall(struct drm_device * dev)
+void mga_driver_irq_uninstall(struct drm_device *dev)
 {
        drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
        if (!dev_priv)
index a53b848e0f17cbbceb062d3b8ff648098deb0985..fff82045c427eec5372c6ca3747f64bd16dcabd0 100644 (file)
@@ -41,8 +41,8 @@
  * DMA hardware state programming functions
  */
 
-static void mga_emit_clip_rect(drm_mga_private_t * dev_priv,
-                              struct drm_clip_rect * box)
+static void mga_emit_clip_rect(drm_mga_private_t *dev_priv,
+                              struct drm_clip_rect *box)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
@@ -66,7 +66,7 @@ static void mga_emit_clip_rect(drm_mga_private_t * dev_priv,
        ADVANCE_DMA();
 }
 
-static __inline__ void mga_g200_emit_context(drm_mga_private_t * dev_priv)
+static __inline__ void mga_g200_emit_context(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
@@ -89,7 +89,7 @@ static __inline__ void mga_g200_emit_context(drm_mga_private_t * dev_priv)
        ADVANCE_DMA();
 }
 
-static __inline__ void mga_g400_emit_context(drm_mga_private_t * dev_priv)
+static __inline__ void mga_g400_emit_context(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
@@ -116,7 +116,7 @@ static __inline__ void mga_g400_emit_context(drm_mga_private_t * dev_priv)
        ADVANCE_DMA();
 }
 
-static __inline__ void mga_g200_emit_tex0(drm_mga_private_t * dev_priv)
+static __inline__ void mga_g200_emit_tex0(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0];
@@ -144,7 +144,7 @@ static __inline__ void mga_g200_emit_tex0(drm_mga_private_t * dev_priv)
        ADVANCE_DMA();
 }
 
-static __inline__ void mga_g400_emit_tex0(drm_mga_private_t * dev_priv)
+static __inline__ void mga_g400_emit_tex0(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0];
@@ -184,7 +184,7 @@ static __inline__ void mga_g400_emit_tex0(drm_mga_private_t * dev_priv)
        ADVANCE_DMA();
 }
 
-static __inline__ void mga_g400_emit_tex1(drm_mga_private_t * dev_priv)
+static __inline__ void mga_g400_emit_tex1(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[1];
@@ -223,7 +223,7 @@ static __inline__ void mga_g400_emit_tex1(drm_mga_private_t * dev_priv)
        ADVANCE_DMA();
 }
 
-static __inline__ void mga_g200_emit_pipe(drm_mga_private_t * dev_priv)
+static __inline__ void mga_g200_emit_pipe(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        unsigned int pipe = sarea_priv->warp_pipe;
@@ -250,7 +250,7 @@ static __inline__ void mga_g200_emit_pipe(drm_mga_private_t * dev_priv)
        ADVANCE_DMA();
 }
 
-static __inline__ void mga_g400_emit_pipe(drm_mga_private_t * dev_priv)
+static __inline__ void mga_g400_emit_pipe(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        unsigned int pipe = sarea_priv->warp_pipe;
@@ -327,7 +327,7 @@ static __inline__ void mga_g400_emit_pipe(drm_mga_private_t * dev_priv)
        ADVANCE_DMA();
 }
 
-static void mga_g200_emit_state(drm_mga_private_t * dev_priv)
+static void mga_g200_emit_state(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        unsigned int dirty = sarea_priv->dirty;
@@ -348,7 +348,7 @@ static void mga_g200_emit_state(drm_mga_private_t * dev_priv)
        }
 }
 
-static void mga_g400_emit_state(drm_mga_private_t * dev_priv)
+static void mga_g400_emit_state(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        unsigned int dirty = sarea_priv->dirty;
@@ -381,7 +381,7 @@ static void mga_g400_emit_state(drm_mga_private_t * dev_priv)
 
 /* Disallow all write destinations except the front and backbuffer.
  */
-static int mga_verify_context(drm_mga_private_t * dev_priv)
+static int mga_verify_context(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_mga_context_regs_t *ctx = &sarea_priv->context_state;
@@ -400,7 +400,7 @@ static int mga_verify_context(drm_mga_private_t * dev_priv)
 
 /* Disallow texture reads from PCI space.
  */
-static int mga_verify_tex(drm_mga_private_t * dev_priv, int unit)
+static int mga_verify_tex(drm_mga_private_t *dev_priv, int unit)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[unit];
@@ -417,7 +417,7 @@ static int mga_verify_tex(drm_mga_private_t * dev_priv, int unit)
        return 0;
 }
 
-static int mga_verify_state(drm_mga_private_t * dev_priv)
+static int mga_verify_state(drm_mga_private_t *dev_priv)
 {
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
        unsigned int dirty = sarea_priv->dirty;
@@ -446,7 +446,7 @@ static int mga_verify_state(drm_mga_private_t * dev_priv)
        return (ret == 0);
 }
 
-static int mga_verify_iload(drm_mga_private_t * dev_priv,
+static int mga_verify_iload(drm_mga_private_t *dev_priv,
                            unsigned int dstorg, unsigned int length)
 {
        if (dstorg < dev_priv->texture_offset ||
@@ -465,7 +465,7 @@ static int mga_verify_iload(drm_mga_private_t * dev_priv,
        return 0;
 }
 
-static int mga_verify_blit(drm_mga_private_t * dev_priv,
+static int mga_verify_blit(drm_mga_private_t *dev_priv,
                           unsigned int srcorg, unsigned int dstorg)
 {
        if ((srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ||
@@ -480,7 +480,7 @@ static int mga_verify_blit(drm_mga_private_t * dev_priv,
  *
  */
 
-static void mga_dma_dispatch_clear(struct drm_device * dev, drm_mga_clear_t * clear)
+static void mga_dma_dispatch_clear(struct drm_device *dev, drm_mga_clear_t *clear)
 {
        drm_mga_private_t *dev_priv = dev->dev_private;
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -568,7 +568,7 @@ static void mga_dma_dispatch_clear(struct drm_device * dev, drm_mga_clear_t * cl
        FLUSH_DMA();
 }
 
-static void mga_dma_dispatch_swap(struct drm_device * dev)
+static void mga_dma_dispatch_swap(struct drm_device *dev)
 {
        drm_mga_private_t *dev_priv = dev->dev_private;
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -622,7 +622,7 @@ static void mga_dma_dispatch_swap(struct drm_device * dev)
        DRM_DEBUG("... done.\n");
 }
 
-static void mga_dma_dispatch_vertex(struct drm_device * dev, struct drm_buf * buf)
+static void mga_dma_dispatch_vertex(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;
@@ -669,7 +669,7 @@ static void mga_dma_dispatch_vertex(struct drm_device * dev, struct drm_buf * bu
        FLUSH_DMA();
 }
 
-static void mga_dma_dispatch_indices(struct drm_device * dev, struct drm_buf * buf,
+static void mga_dma_dispatch_indices(struct drm_device *dev, struct drm_buf *buf,
                                     unsigned int start, unsigned int end)
 {
        drm_mga_private_t *dev_priv = dev->dev_private;
@@ -718,7 +718,7 @@ static void mga_dma_dispatch_indices(struct drm_device * dev, struct drm_buf * b
 /* This copies a 64 byte aligned agp region to the frambuffer with a
  * standard blit, the ioctl needs to do checking.
  */
-static void mga_dma_dispatch_iload(struct drm_device * dev, struct drm_buf * buf,
+static void mga_dma_dispatch_iload(struct drm_device *dev, struct drm_buf *buf,
                                   unsigned int dstorg, unsigned int length)
 {
        drm_mga_private_t *dev_priv = dev->dev_private;
@@ -766,7 +766,7 @@ static void mga_dma_dispatch_iload(struct drm_device * dev, struct drm_buf * buf
        FLUSH_DMA();
 }
 
-static void mga_dma_dispatch_blit(struct drm_device * dev, drm_mga_blit_t * blit)
+static void mga_dma_dispatch_blit(struct drm_device *dev, drm_mga_blit_t *blit)
 {
        drm_mga_private_t *dev_priv = dev->dev_private;
        drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -801,9 +801,8 @@ static void mga_dma_dispatch_blit(struct drm_device * dev, drm_mga_blit_t * blit
                int w = pbox[i].x2 - pbox[i].x1 - 1;
                int start;
 
-               if (blit->ydir == -1) {
+               if (blit->ydir == -1)
                        srcy = blit->height - srcy - 1;
-               }
 
                start = srcy * blit->src_pitch + srcx;
 
index 9aad4847afdf31cbd3c7c695195581d2745dafb1..f172bd5c257f48600c4ab17c991460dd99b02ea8 100644 (file)
@@ -46,7 +46,7 @@ MODULE_FIRMWARE(FIRMWARE_G400);
 
 #define WARP_UCODE_SIZE(size)          ALIGN(size, MGA_WARP_CODE_ALIGN)
 
-int mga_warp_install_microcode(drm_mga_private_t * dev_priv)
+int mga_warp_install_microcode(drm_mga_private_t *dev_priv)
 {
        unsigned char *vcbase = dev_priv->warp->handle;
        unsigned long pcbase = dev_priv->warp->offset;
@@ -133,7 +133,7 @@ out:
 
 #define WMISC_EXPECTED         (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE)
 
-int mga_warp_init(drm_mga_private_t * dev_priv)
+int mga_warp_init(drm_mga_private_t *dev_priv)
 {
        u32 wmisc;
 
index b6f5239c2efb07004d7caa084fbefd62aa1b742c..d2d28048efb23e1759c4368a2dbb2a64ac12675e 100644 (file)
@@ -41,4 +41,13 @@ config DRM_I2C_CH7006
 
          This driver is currently only useful if you're also using
          the nouveau driver.
+
+config DRM_I2C_SIL164
+       tristate "Silicon Image sil164 TMDS transmitter"
+       default m if DRM_NOUVEAU
+       help
+         Support for sil164 and similar single-link (or dual-link
+         when used in pairs) TMDS transmitters, used in some nVidia
+         video cards.
+
 endmenu
index e671d0e74d4c2c626b12d2daf0e2f7faf09b05c6..570e190710bd0cb0afa4ed36b1a5cb22f940197b 100644 (file)
@@ -44,7 +44,7 @@
 
 MODULE_FIRMWARE(FIRMWARE_NAME);
 
-static int R128_READ_PLL(struct drm_device * dev, int addr)
+static int R128_READ_PLL(struct drm_device *dev, int addr)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
 
@@ -53,7 +53,7 @@ static int R128_READ_PLL(struct drm_device * dev, int addr)
 }
 
 #if R128_FIFO_DEBUG
-static void r128_status(drm_r128_private_t * dev_priv)
+static void r128_status(drm_r128_private_t *dev_priv)
 {
        printk("GUI_STAT           = 0x%08x\n",
               (unsigned int)R128_READ(R128_GUI_STAT));
@@ -74,7 +74,7 @@ static void r128_status(drm_r128_private_t * dev_priv)
  * Engine, FIFO control
  */
 
-static int r128_do_pixcache_flush(drm_r128_private_t * dev_priv)
+static int r128_do_pixcache_flush(drm_r128_private_t *dev_priv)
 {
        u32 tmp;
        int i;
@@ -83,9 +83,8 @@ static int r128_do_pixcache_flush(drm_r128_private_t * dev_priv)
        R128_WRITE(R128_PC_NGUI_CTLSTAT, tmp);
 
        for (i = 0; i < dev_priv->usec_timeout; i++) {
-               if (!(R128_READ(R128_PC_NGUI_CTLSTAT) & R128_PC_BUSY)) {
+               if (!(R128_READ(R128_PC_NGUI_CTLSTAT) & R128_PC_BUSY))
                        return 0;
-               }
                DRM_UDELAY(1);
        }
 
@@ -95,7 +94,7 @@ static int r128_do_pixcache_flush(drm_r128_private_t * dev_priv)
        return -EBUSY;
 }
 
-static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries)
+static int r128_do_wait_for_fifo(drm_r128_private_t *dev_priv, int entries)
 {
        int i;
 
@@ -112,7 +111,7 @@ static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries)
        return -EBUSY;
 }
 
-static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv)
+static int r128_do_wait_for_idle(drm_r128_private_t *dev_priv)
 {
        int i, ret;
 
@@ -189,7 +188,7 @@ out_release:
  * prior to a wait for idle, as it informs the engine that the command
  * stream is ending.
  */
-static void r128_do_cce_flush(drm_r128_private_t * dev_priv)
+static void r128_do_cce_flush(drm_r128_private_t *dev_priv)
 {
        u32 tmp;
 
@@ -199,7 +198,7 @@ static void r128_do_cce_flush(drm_r128_private_t * dev_priv)
 
 /* Wait for the CCE to go idle.
  */
-int r128_do_cce_idle(drm_r128_private_t * dev_priv)
+int r128_do_cce_idle(drm_r128_private_t *dev_priv)
 {
        int i;
 
@@ -225,7 +224,7 @@ int r128_do_cce_idle(drm_r128_private_t * dev_priv)
 
 /* Start the Concurrent Command Engine.
  */
-static void r128_do_cce_start(drm_r128_private_t * dev_priv)
+static void r128_do_cce_start(drm_r128_private_t *dev_priv)
 {
        r128_do_wait_for_idle(dev_priv);
 
@@ -242,7 +241,7 @@ static void r128_do_cce_start(drm_r128_private_t * dev_priv)
  * commands, so you must wait for the CCE command stream to complete
  * before calling this routine.
  */
-static void r128_do_cce_reset(drm_r128_private_t * dev_priv)
+static void r128_do_cce_reset(drm_r128_private_t *dev_priv)
 {
        R128_WRITE(R128_PM4_BUFFER_DL_WPTR, 0);
        R128_WRITE(R128_PM4_BUFFER_DL_RPTR, 0);
@@ -253,7 +252,7 @@ static void r128_do_cce_reset(drm_r128_private_t * dev_priv)
  * commands, so you must flush the command stream and wait for the CCE
  * to go idle before calling this routine.
  */
-static void r128_do_cce_stop(drm_r128_private_t * dev_priv)
+static void r128_do_cce_stop(drm_r128_private_t *dev_priv)
 {
        R128_WRITE(R128_PM4_MICRO_CNTL, 0);
        R128_WRITE(R128_PM4_BUFFER_CNTL,
@@ -264,7 +263,7 @@ static void r128_do_cce_stop(drm_r128_private_t * dev_priv)
 
 /* Reset the engine.  This will stop the CCE if it is running.
  */
-static int r128_do_engine_reset(struct drm_device * dev)
+static int r128_do_engine_reset(struct drm_device *dev)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        u32 clock_cntl_index, mclk_cntl, gen_reset_cntl;
@@ -301,8 +300,8 @@ static int r128_do_engine_reset(struct drm_device * dev)
        return 0;
 }
 
-static void r128_cce_init_ring_buffer(struct drm_device * dev,
-                                     drm_r128_private_t * dev_priv)
+static void r128_cce_init_ring_buffer(struct drm_device *dev,
+                                     drm_r128_private_t *dev_priv)
 {
        u32 ring_start;
        u32 tmp;
@@ -340,7 +339,7 @@ static void r128_cce_init_ring_buffer(struct drm_device * dev,
        R128_WRITE(R128_BUS_CNTL, tmp);
 }
 
-static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
+static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init)
 {
        drm_r128_private_t *dev_priv;
        int rc;
@@ -588,7 +587,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
        return rc;
 }
 
-int r128_do_cleanup_cce(struct drm_device * dev)
+int r128_do_cleanup_cce(struct drm_device *dev)
 {
 
        /* Make sure interrupts are disabled here because the uninstall ioctl
@@ -682,9 +681,8 @@ int r128_cce_stop(struct drm_device *dev, void *data, struct drm_file *file_priv
        /* Flush any pending CCE commands.  This ensures any outstanding
         * commands are exectuted by the engine before we turn it off.
         */
-       if (stop->flush) {
+       if (stop->flush)
                r128_do_cce_flush(dev_priv);
-       }
 
        /* If we fail to make the engine go idle, we return an error
         * code so that the DRM ioctl wrapper can try again.
@@ -735,9 +733,8 @@ int r128_cce_idle(struct drm_device *dev, void *data, struct drm_file *file_priv
 
        DEV_INIT_TEST_WITH_RETURN(dev_priv);
 
-       if (dev_priv->cce_running) {
+       if (dev_priv->cce_running)
                r128_do_cce_flush(dev_priv);
-       }
 
        return r128_do_cce_idle(dev_priv);
 }
@@ -765,7 +762,7 @@ int r128_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_pr
 #define R128_BUFFER_FREE       0
 
 #if 0
-static int r128_freelist_init(struct drm_device * dev)
+static int r128_freelist_init(struct drm_device *dev)
 {
        struct drm_device_dma *dma = dev->dma;
        drm_r128_private_t *dev_priv = dev->dev_private;
@@ -848,7 +845,7 @@ static struct drm_buf *r128_freelist_get(struct drm_device * dev)
        return NULL;
 }
 
-void r128_freelist_reset(struct drm_device * dev)
+void r128_freelist_reset(struct drm_device *dev)
 {
        struct drm_device_dma *dma = dev->dma;
        int i;
@@ -864,7 +861,7 @@ void r128_freelist_reset(struct drm_device * dev)
  * CCE command submission
  */
 
-int r128_wait_ring(drm_r128_private_t * dev_priv, int n)
+int r128_wait_ring(drm_r128_private_t *dev_priv, int n)
 {
        drm_r128_ring_buffer_t *ring = &dev_priv->ring;
        int i;
@@ -881,9 +878,9 @@ int r128_wait_ring(drm_r128_private_t * dev_priv, int n)
        return -EBUSY;
 }
 
-static int r128_cce_get_buffers(struct drm_device * dev,
+static int r128_cce_get_buffers(struct drm_device *dev,
                                struct drm_file *file_priv,
-                               struct drm_dma * d)
+                               struct drm_dma *d)
 {
        int i;
        struct drm_buf *buf;
@@ -933,9 +930,8 @@ int r128_cce_buffers(struct drm_device *dev, void *data, struct drm_file *file_p
 
        d->granted_count = 0;
 
-       if (d->request_count) {
+       if (d->request_count)
                ret = r128_cce_get_buffers(dev, file_priv, d);
-       }
 
        return ret;
 }
index b806fdcc717037fcbc8352be15cf3e08fd92908e..1e2971f13aa1f5775f518db92967c5c5a6c83ddf 100644 (file)
@@ -85,7 +85,7 @@ static struct drm_driver driver = {
        .patchlevel = DRIVER_PATCHLEVEL,
 };
 
-int r128_driver_load(struct drm_device * dev, unsigned long flags)
+int r128_driver_load(struct drm_device *dev, unsigned long flags)
 {
        return drm_vblank_init(dev, 1);
 }
index 3c60829d82e9627394a2b6f946d710f5ffe4c2b6..930c71b2fb5e3b5dae831ab388b93721622181da 100644 (file)
@@ -53,7 +53,7 @@
 #define DRIVER_MINOR           5
 #define DRIVER_PATCHLEVEL      0
 
-#define GET_RING_HEAD(dev_priv)                R128_READ( R128_PM4_BUFFER_DL_RPTR )
+#define GET_RING_HEAD(dev_priv)                R128_READ(R128_PM4_BUFFER_DL_RPTR)
 
 typedef struct drm_r128_freelist {
        unsigned int age;
@@ -144,23 +144,23 @@ extern int r128_engine_reset(struct drm_device *dev, void *data, struct drm_file
 extern int r128_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv);
 extern int r128_cce_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv);
 
-extern void r128_freelist_reset(struct drm_device * dev);
+extern void r128_freelist_reset(struct drm_device *dev);
 
-extern int r128_wait_ring(drm_r128_private_t * dev_priv, int n);
+extern int r128_wait_ring(drm_r128_private_t *dev_priv, int n);
 
-extern int r128_do_cce_idle(drm_r128_private_t * dev_priv);
-extern int r128_do_cleanup_cce(struct drm_device * dev);
+extern int r128_do_cce_idle(drm_r128_private_t *dev_priv);
+extern int r128_do_cleanup_cce(struct drm_device *dev);
 
 extern int r128_enable_vblank(struct drm_device *dev, int crtc);
 extern void r128_disable_vblank(struct drm_device *dev, int crtc);
 extern u32 r128_get_vblank_counter(struct drm_device *dev, int crtc);
 extern irqreturn_t r128_driver_irq_handler(DRM_IRQ_ARGS);
-extern void r128_driver_irq_preinstall(struct drm_device * dev);
+extern void r128_driver_irq_preinstall(struct drm_device *dev);
 extern int r128_driver_irq_postinstall(struct drm_device *dev);
-extern void r128_driver_irq_uninstall(struct drm_device * dev);
-extern void r128_driver_lastclose(struct drm_device * dev);
-extern int r128_driver_load(struct drm_device * dev, unsigned long flags);
-extern void r128_driver_preclose(struct drm_device * dev,
+extern void r128_driver_irq_uninstall(struct drm_device *dev);
+extern void r128_driver_lastclose(struct drm_device *dev);
+extern int r128_driver_load(struct drm_device *dev, unsigned long flags);
+extern void r128_driver_preclose(struct drm_device *dev,
                                 struct drm_file *file_priv);
 
 extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
@@ -390,27 +390,27 @@ extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
 
 #define R128_PCIGART_TABLE_SIZE         32768
 
-#define R128_READ(reg)         DRM_READ32(  dev_priv->mmio, (reg) )
-#define R128_WRITE(reg,val)    DRM_WRITE32( dev_priv->mmio, (reg), (val) )
-#define R128_READ8(reg)                DRM_READ8(   dev_priv->mmio, (reg) )
-#define R128_WRITE8(reg,val)   DRM_WRITE8(  dev_priv->mmio, (reg), (val) )
+#define R128_READ(reg)         DRM_READ32(dev_priv->mmio, (reg))
+#define R128_WRITE(reg, val)   DRM_WRITE32(dev_priv->mmio, (reg), (val))
+#define R128_READ8(reg)                DRM_READ8(dev_priv->mmio, (reg))
+#define R128_WRITE8(reg, val)  DRM_WRITE8(dev_priv->mmio, (reg), (val))
 
-#define R128_WRITE_PLL(addr,val)                                       \
+#define R128_WRITE_PLL(addr, val)                                      \
 do {                                                                   \
        R128_WRITE8(R128_CLOCK_CNTL_INDEX,                              \
                    ((addr) & 0x1f) | R128_PLL_WR_EN);                  \
        R128_WRITE(R128_CLOCK_CNTL_DATA, (val));                        \
 } while (0)
 
-#define CCE_PACKET0( reg, n )          (R128_CCE_PACKET0 |             \
+#define CCE_PACKET0(reg, n)            (R128_CCE_PACKET0 |             \
                                         ((n) << 16) | ((reg) >> 2))
-#define CCE_PACKET1( reg0, reg1 )      (R128_CCE_PACKET1 |             \
+#define CCE_PACKET1(reg0, reg1)                (R128_CCE_PACKET1 |             \
                                         (((reg1) >> 2) << 11) | ((reg0) >> 2))
 #define CCE_PACKET2()                  (R128_CCE_PACKET2)
-#define CCE_PACKET3( pkt, n )          (R128_CCE_PACKET3 |             \
+#define CCE_PACKET3(pkt, n)            (R128_CCE_PACKET3 |             \
                                         (pkt) | ((n) << 16))
 
-static __inline__ void r128_update_ring_snapshot(drm_r128_private_t * dev_priv)
+static __inline__ void r128_update_ring_snapshot(drm_r128_private_t *dev_priv)
 {
        drm_r128_ring_buffer_t *ring = &dev_priv->ring;
        ring->space = (GET_RING_HEAD(dev_priv) - ring->tail) * sizeof(u32);
@@ -430,37 +430,38 @@ do {                                                                      \
        }                                                               \
 } while (0)
 
-#define RING_SPACE_TEST_WITH_RETURN( dev_priv )                                \
+#define RING_SPACE_TEST_WITH_RETURN(dev_priv)                          \
 do {                                                                   \
        drm_r128_ring_buffer_t *ring = &dev_priv->ring; int i;          \
-       if ( ring->space < ring->high_mark ) {                          \
-               for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {      \
-                       r128_update_ring_snapshot( dev_priv );          \
-                       if ( ring->space >= ring->high_mark )           \
+       if (ring->space < ring->high_mark) {                            \
+               for (i = 0 ; i < dev_priv->usec_timeout ; i++) {        \
+                       r128_update_ring_snapshot(dev_priv);            \
+                       if (ring->space >= ring->high_mark)             \
                                goto __ring_space_done;                 \
-                       DRM_UDELAY(1);                          \
+                       DRM_UDELAY(1);                                  \
                }                                                       \
-               DRM_ERROR( "ring space check failed!\n" );              \
-               return -EBUSY;                          \
+               DRM_ERROR("ring space check failed!\n");                \
+               return -EBUSY;                                          \
        }                                                               \
  __ring_space_done:                                                    \
        ;                                                               \
 } while (0)
 
-#define VB_AGE_TEST_WITH_RETURN( dev_priv )                            \
+#define VB_AGE_TEST_WITH_RETURN(dev_priv)                              \
 do {                                                                   \
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;            \
-       if ( sarea_priv->last_dispatch >= R128_MAX_VB_AGE ) {           \
-               int __ret = r128_do_cce_idle( dev_priv );               \
-               if ( __ret ) return __ret;                              \
+       if (sarea_priv->last_dispatch >= R128_MAX_VB_AGE) {             \
+               int __ret = r128_do_cce_idle(dev_priv);                 \
+               if (__ret)                                              \
+                       return __ret;                                   \
                sarea_priv->last_dispatch = 0;                          \
-               r128_freelist_reset( dev );                             \
+               r128_freelist_reset(dev);                               \
        }                                                               \
 } while (0)
 
 #define R128_WAIT_UNTIL_PAGE_FLIPPED() do {                            \
-       OUT_RING( CCE_PACKET0( R128_WAIT_UNTIL, 0 ) );                  \
-       OUT_RING( R128_EVENT_CRTC_OFFSET );                             \
+       OUT_RING(CCE_PACKET0(R128_WAIT_UNTIL, 0));                      \
+       OUT_RING(R128_EVENT_CRTC_OFFSET);                               \
 } while (0)
 
 /* ================================================================
@@ -472,13 +473,12 @@ do {                                                                      \
 #define RING_LOCALS                                                    \
        int write, _nr; unsigned int tail_mask; volatile u32 *ring;
 
-#define BEGIN_RING( n ) do {                                           \
-       if ( R128_VERBOSE ) {                                           \
-               DRM_INFO( "BEGIN_RING( %d )\n", (n));                   \
-       }                                                               \
-       if ( dev_priv->ring.space <= (n) * sizeof(u32) ) {              \
+#define BEGIN_RING(n) do {                                             \
+       if (R128_VERBOSE)                                               \
+               DRM_INFO("BEGIN_RING(%d)\n", (n));                      \
+       if (dev_priv->ring.space <= (n) * sizeof(u32)) {                \
                COMMIT_RING();                                          \
-               r128_wait_ring( dev_priv, (n) * sizeof(u32) );          \
+               r128_wait_ring(dev_priv, (n) * sizeof(u32));            \
        }                                                               \
        _nr = n; dev_priv->ring.space -= (n) * sizeof(u32);             \
        ring = dev_priv->ring.start;                                    \
@@ -494,40 +494,36 @@ do {                                                                      \
 #define R128_BROKEN_CCE        1
 
 #define ADVANCE_RING() do {                                            \
-       if ( R128_VERBOSE ) {                                           \
-               DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n",     \
-                         write, dev_priv->ring.tail );                 \
-       }                                                               \
-       if ( R128_BROKEN_CCE && write < 32 ) {                          \
-               memcpy( dev_priv->ring.end,                             \
-                       dev_priv->ring.start,                           \
-                       write * sizeof(u32) );                          \
-       }                                                               \
-       if (((dev_priv->ring.tail + _nr) & tail_mask) != write) {       \
+       if (R128_VERBOSE)                                               \
+               DRM_INFO("ADVANCE_RING() wr=0x%06x tail=0x%06x\n",      \
+                        write, dev_priv->ring.tail);                   \
+       if (R128_BROKEN_CCE && write < 32)                              \
+               memcpy(dev_priv->ring.end,                              \
+                      dev_priv->ring.start,                            \
+                      write * sizeof(u32));                            \
+       if (((dev_priv->ring.tail + _nr) & tail_mask) != write)         \
                DRM_ERROR(                                              \
                        "ADVANCE_RING(): mismatch: nr: %x write: %x line: %d\n",        \
                        ((dev_priv->ring.tail + _nr) & tail_mask),      \
                        write, __LINE__);                               \
-       } else                                                          \
+       else                                                            \
                dev_priv->ring.tail = write;                            \
 } while (0)
 
 #define COMMIT_RING() do {                                             \
-       if ( R128_VERBOSE ) {                                           \
-               DRM_INFO( "COMMIT_RING() tail=0x%06x\n",                \
-                       dev_priv->ring.tail );                          \
-       }                                                               \
+       if (R128_VERBOSE)                                               \
+               DRM_INFO("COMMIT_RING() tail=0x%06x\n",                 \
+                        dev_priv->ring.tail);                          \
        DRM_MEMORYBARRIER();                                            \
-       R128_WRITE( R128_PM4_BUFFER_DL_WPTR, dev_priv->ring.tail );     \
-       R128_READ( R128_PM4_BUFFER_DL_WPTR );                           \
+       R128_WRITE(R128_PM4_BUFFER_DL_WPTR, dev_priv->ring.tail);       \
+       R128_READ(R128_PM4_BUFFER_DL_WPTR);                             \
 } while (0)
 
-#define OUT_RING( x ) do {                                             \
-       if ( R128_VERBOSE ) {                                           \
-               DRM_INFO( "   OUT_RING( 0x%08x ) at 0x%x\n",            \
-                          (unsigned int)(x), write );                  \
-       }                                                               \
-       ring[write++] = cpu_to_le32( x );                               \
+#define OUT_RING(x) do {                                               \
+       if (R128_VERBOSE)                                               \
+               DRM_INFO("   OUT_RING( 0x%08x ) at 0x%x\n",             \
+                        (unsigned int)(x), write);                     \
+       ring[write++] = cpu_to_le32(x);                                 \
        write &= tail_mask;                                             \
 } while (0)
 
index 69810fb8ac49101a36645061adc93ca265e19cd8..429d5a02695f7e203fdec455637e92d8aa58225b 100644 (file)
@@ -90,7 +90,7 @@ void r128_disable_vblank(struct drm_device *dev, int crtc)
         */
 }
 
-void r128_driver_irq_preinstall(struct drm_device * dev)
+void r128_driver_irq_preinstall(struct drm_device *dev)
 {
        drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
 
@@ -105,7 +105,7 @@ int r128_driver_irq_postinstall(struct drm_device *dev)
        return 0;
 }
 
-void r128_driver_irq_uninstall(struct drm_device * dev)
+void r128_driver_irq_uninstall(struct drm_device *dev)
 {
        drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
        if (!dev_priv)
index af2665cf4718ca8b92c56130e9a5aec0f80845a6..077af1f2f9b4faee1f3e840f8e4a52813cb05108 100644 (file)
@@ -37,8 +37,8 @@
  * CCE hardware state programming functions
  */
 
-static void r128_emit_clip_rects(drm_r128_private_t * dev_priv,
-                                struct drm_clip_rect * boxes, int count)
+static void r128_emit_clip_rects(drm_r128_private_t *dev_priv,
+                                struct drm_clip_rect *boxes, int count)
 {
        u32 aux_sc_cntl = 0x00000000;
        RING_LOCALS;
@@ -80,7 +80,7 @@ static void r128_emit_clip_rects(drm_r128_private_t * dev_priv,
        ADVANCE_RING();
 }
 
-static __inline__ void r128_emit_core(drm_r128_private_t * dev_priv)
+static __inline__ void r128_emit_core(drm_r128_private_t *dev_priv)
 {
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
@@ -95,7 +95,7 @@ static __inline__ void r128_emit_core(drm_r128_private_t * dev_priv)
        ADVANCE_RING();
 }
 
-static __inline__ void r128_emit_context(drm_r128_private_t * dev_priv)
+static __inline__ void r128_emit_context(drm_r128_private_t *dev_priv)
 {
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
@@ -121,7 +121,7 @@ static __inline__ void r128_emit_context(drm_r128_private_t * dev_priv)
        ADVANCE_RING();
 }
 
-static __inline__ void r128_emit_setup(drm_r128_private_t * dev_priv)
+static __inline__ void r128_emit_setup(drm_r128_private_t *dev_priv)
 {
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
@@ -137,7 +137,7 @@ static __inline__ void r128_emit_setup(drm_r128_private_t * dev_priv)
        ADVANCE_RING();
 }
 
-static __inline__ void r128_emit_masks(drm_r128_private_t * dev_priv)
+static __inline__ void r128_emit_masks(drm_r128_private_t *dev_priv)
 {
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
@@ -156,7 +156,7 @@ static __inline__ void r128_emit_masks(drm_r128_private_t * dev_priv)
        ADVANCE_RING();
 }
 
-static __inline__ void r128_emit_window(drm_r128_private_t * dev_priv)
+static __inline__ void r128_emit_window(drm_r128_private_t *dev_priv)
 {
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
@@ -171,7 +171,7 @@ static __inline__ void r128_emit_window(drm_r128_private_t * dev_priv)
        ADVANCE_RING();
 }
 
-static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv)
+static __inline__ void r128_emit_tex0(drm_r128_private_t *dev_priv)
 {
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_r128_context_regs_t *ctx = &sarea_priv->context_state;
@@ -187,9 +187,8 @@ static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv)
        OUT_RING(tex->tex_cntl);
        OUT_RING(tex->tex_combine_cntl);
        OUT_RING(ctx->tex_size_pitch_c);
-       for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++) {
+       for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++)
                OUT_RING(tex->tex_offset[i]);
-       }
 
        OUT_RING(CCE_PACKET0(R128_CONSTANT_COLOR_C, 1));
        OUT_RING(ctx->constant_color_c);
@@ -198,7 +197,7 @@ static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv)
        ADVANCE_RING();
 }
 
-static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv)
+static __inline__ void r128_emit_tex1(drm_r128_private_t *dev_priv)
 {
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
        drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1];
@@ -211,9 +210,8 @@ static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv)
        OUT_RING(CCE_PACKET0(R128_SEC_TEX_CNTL_C, 1 + R128_MAX_TEXTURE_LEVELS));
        OUT_RING(tex->tex_cntl);
        OUT_RING(tex->tex_combine_cntl);
-       for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++) {
+       for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++)
                OUT_RING(tex->tex_offset[i]);
-       }
 
        OUT_RING(CCE_PACKET0(R128_SEC_TEXTURE_BORDER_COLOR_C, 0));
        OUT_RING(tex->tex_border_color);
@@ -221,7 +219,7 @@ static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv)
        ADVANCE_RING();
 }
 
-static void r128_emit_state(drm_r128_private_t * dev_priv)
+static void r128_emit_state(drm_r128_private_t *dev_priv)
 {
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
        unsigned int dirty = sarea_priv->dirty;
@@ -274,7 +272,7 @@ static void r128_emit_state(drm_r128_private_t * dev_priv)
  * Performance monitoring functions
  */
 
-static void r128_clear_box(drm_r128_private_t * dev_priv,
+static void r128_clear_box(drm_r128_private_t *dev_priv,
                           int x, int y, int w, int h, int r, int g, int b)
 {
        u32 pitch, offset;
@@ -321,13 +319,12 @@ static void r128_clear_box(drm_r128_private_t * dev_priv,
        ADVANCE_RING();
 }
 
-static void r128_cce_performance_boxes(drm_r128_private_t * dev_priv)
+static void r128_cce_performance_boxes(drm_r128_private_t *dev_priv)
 {
-       if (atomic_read(&dev_priv->idle_count) == 0) {
+       if (atomic_read(&dev_priv->idle_count) == 0)
                r128_clear_box(dev_priv, 64, 4, 8, 8, 0, 255, 0);
-       } else {
+       else
                atomic_set(&dev_priv->idle_count, 0);
-       }
 }
 
 #endif
@@ -352,8 +349,8 @@ static void r128_print_dirty(const char *msg, unsigned int flags)
                 (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "");
 }
 
-static void r128_cce_dispatch_clear(struct drm_device * dev,
-                                   drm_r128_clear_t * clear)
+static void r128_cce_dispatch_clear(struct drm_device *dev,
+                                   drm_r128_clear_t *clear)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -458,7 +455,7 @@ static void r128_cce_dispatch_clear(struct drm_device * dev,
        }
 }
 
-static void r128_cce_dispatch_swap(struct drm_device * dev)
+static void r128_cce_dispatch_swap(struct drm_device *dev)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;
@@ -524,7 +521,7 @@ static void r128_cce_dispatch_swap(struct drm_device * dev)
        ADVANCE_RING();
 }
 
-static void r128_cce_dispatch_flip(struct drm_device * dev)
+static void r128_cce_dispatch_flip(struct drm_device *dev)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        RING_LOCALS;
@@ -542,11 +539,10 @@ static void r128_cce_dispatch_flip(struct drm_device * dev)
        R128_WAIT_UNTIL_PAGE_FLIPPED();
        OUT_RING(CCE_PACKET0(R128_CRTC_OFFSET, 0));
 
-       if (dev_priv->current_page == 0) {
+       if (dev_priv->current_page == 0)
                OUT_RING(dev_priv->back_offset);
-       } else {
+       else
                OUT_RING(dev_priv->front_offset);
-       }
 
        ADVANCE_RING();
 
@@ -566,7 +562,7 @@ static void r128_cce_dispatch_flip(struct drm_device * dev)
        ADVANCE_RING();
 }
 
-static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * buf)
+static void r128_cce_dispatch_vertex(struct drm_device *dev, struct drm_buf *buf)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        drm_r128_buf_priv_t *buf_priv = buf->dev_private;
@@ -585,9 +581,8 @@ static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * b
        if (buf->used) {
                buf_priv->dispatched = 1;
 
-               if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS) {
+               if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS)
                        r128_emit_state(dev_priv);
-               }
 
                do {
                        /* Emit the next set of up to three cliprects */
@@ -636,8 +631,8 @@ static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * b
        sarea_priv->nbox = 0;
 }
 
-static void r128_cce_dispatch_indirect(struct drm_device * dev,
-                                      struct drm_buf * buf, int start, int end)
+static void r128_cce_dispatch_indirect(struct drm_device *dev,
+                                      struct drm_buf *buf, int start, int end)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        drm_r128_buf_priv_t *buf_priv = buf->dev_private;
@@ -691,8 +686,8 @@ static void r128_cce_dispatch_indirect(struct drm_device * dev,
        dev_priv->sarea_priv->last_dispatch++;
 }
 
-static void r128_cce_dispatch_indices(struct drm_device * dev,
-                                     struct drm_buf * buf,
+static void r128_cce_dispatch_indices(struct drm_device *dev,
+                                     struct drm_buf *buf,
                                      int start, int end, int count)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
@@ -713,9 +708,8 @@ static void r128_cce_dispatch_indices(struct drm_device * dev,
        if (start != end) {
                buf_priv->dispatched = 1;
 
-               if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS) {
+               if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS)
                        r128_emit_state(dev_priv);
-               }
 
                dwords = (end - start + 3) / sizeof(u32);
 
@@ -775,9 +769,9 @@ static void r128_cce_dispatch_indices(struct drm_device * dev,
        sarea_priv->nbox = 0;
 }
 
-static int r128_cce_dispatch_blit(struct drm_device * dev,
+static int r128_cce_dispatch_blit(struct drm_device *dev,
                                  struct drm_file *file_priv,
-                                 drm_r128_blit_t * blit)
+                                 drm_r128_blit_t *blit)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        struct drm_device_dma *dma = dev->dma;
@@ -887,8 +881,8 @@ static int r128_cce_dispatch_blit(struct drm_device * dev,
  * have hardware stencil support.
  */
 
-static int r128_cce_dispatch_write_span(struct drm_device * dev,
-                                       drm_r128_depth_t * depth)
+static int r128_cce_dispatch_write_span(struct drm_device *dev,
+                                       drm_r128_depth_t *depth)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        int count, x, y;
@@ -902,12 +896,10 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev,
        if (count > 4096 || count <= 0)
                return -EMSGSIZE;
 
-       if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) {
+       if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x)))
                return -EFAULT;
-       }
-       if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) {
+       if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y)))
                return -EFAULT;
-       }
 
        buffer_size = depth->n * sizeof(u32);
        buffer = kmalloc(buffer_size, GFP_KERNEL);
@@ -983,8 +975,8 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev,
        return 0;
 }
 
-static int r128_cce_dispatch_write_pixels(struct drm_device * dev,
-                                         drm_r128_depth_t * depth)
+static int r128_cce_dispatch_write_pixels(struct drm_device *dev,
+                                         drm_r128_depth_t *depth)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        int count, *x, *y;
@@ -1001,9 +993,8 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev,
        xbuf_size = count * sizeof(*x);
        ybuf_size = count * sizeof(*y);
        x = kmalloc(xbuf_size, GFP_KERNEL);
-       if (x == NULL) {
+       if (x == NULL)
                return -ENOMEM;
-       }
        y = kmalloc(ybuf_size, GFP_KERNEL);
        if (y == NULL) {
                kfree(x);
@@ -1105,8 +1096,8 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev,
        return 0;
 }
 
-static int r128_cce_dispatch_read_span(struct drm_device * dev,
-                                      drm_r128_depth_t * depth)
+static int r128_cce_dispatch_read_span(struct drm_device *dev,
+                                      drm_r128_depth_t *depth)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        int count, x, y;
@@ -1117,12 +1108,10 @@ static int r128_cce_dispatch_read_span(struct drm_device * dev,
        if (count > 4096 || count <= 0)
                return -EMSGSIZE;
 
-       if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) {
+       if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x)))
                return -EFAULT;
-       }
-       if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) {
+       if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y)))
                return -EFAULT;
-       }
 
        BEGIN_RING(7);
 
@@ -1148,8 +1137,8 @@ static int r128_cce_dispatch_read_span(struct drm_device * dev,
        return 0;
 }
 
-static int r128_cce_dispatch_read_pixels(struct drm_device * dev,
-                                        drm_r128_depth_t * depth)
+static int r128_cce_dispatch_read_pixels(struct drm_device *dev,
+                                        drm_r128_depth_t *depth)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        int count, *x, *y;
@@ -1161,16 +1150,14 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev,
        if (count > 4096 || count <= 0)
                return -EMSGSIZE;
 
-       if (count > dev_priv->depth_pitch) {
+       if (count > dev_priv->depth_pitch)
                count = dev_priv->depth_pitch;
-       }
 
        xbuf_size = count * sizeof(*x);
        ybuf_size = count * sizeof(*y);
        x = kmalloc(xbuf_size, GFP_KERNEL);
-       if (x == NULL) {
+       if (x == NULL)
                return -ENOMEM;
-       }
        y = kmalloc(ybuf_size, GFP_KERNEL);
        if (y == NULL) {
                kfree(x);
@@ -1220,7 +1207,7 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev,
  * Polygon stipple
  */
 
-static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple)
+static void r128_cce_dispatch_stipple(struct drm_device *dev, u32 *stipple)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        int i;
@@ -1230,9 +1217,8 @@ static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple)
        BEGIN_RING(33);
 
        OUT_RING(CCE_PACKET0(R128_BRUSH_DATA0, 31));
-       for (i = 0; i < 32; i++) {
+       for (i = 0; i < 32; i++)
                OUT_RING(stipple[i]);
-       }
 
        ADVANCE_RING();
 }
@@ -1269,7 +1255,7 @@ static int r128_cce_clear(struct drm_device *dev, void *data, struct drm_file *f
        return 0;
 }
 
-static int r128_do_init_pageflip(struct drm_device * dev)
+static int r128_do_init_pageflip(struct drm_device *dev)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        DRM_DEBUG("\n");
@@ -1288,7 +1274,7 @@ static int r128_do_init_pageflip(struct drm_device * dev)
        return 0;
 }
 
-static int r128_do_cleanup_pageflip(struct drm_device * dev)
+static int r128_do_cleanup_pageflip(struct drm_device *dev)
 {
        drm_r128_private_t *dev_priv = dev->dev_private;
        DRM_DEBUG("\n");
@@ -1645,17 +1631,16 @@ static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *fi
        return 0;
 }
 
-void r128_driver_preclose(struct drm_device * dev, struct drm_file *file_priv)
+void r128_driver_preclose(struct drm_device *dev, struct drm_file *file_priv)
 {
        if (dev->dev_private) {
                drm_r128_private_t *dev_priv = dev->dev_private;
-               if (dev_priv->page_flipping) {
+               if (dev_priv->page_flipping)
                        r128_do_cleanup_pageflip(dev);
-               }
        }
 }
 
-void r128_driver_lastclose(struct drm_device * dev)
+void r128_driver_lastclose(struct drm_device *dev)
 {
        r128_do_cleanup_cce(dev);
 }
index 4fd1f067d380779302c59e1f6bb4c5d574b202ae..776bf9e9ea1adfec718e6b5a4c7906eedaf72348 100644 (file)
@@ -47,9 +47,8 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset)
        dev->dev_private = (void *)dev_priv;
        dev_priv->chipset = chipset;
        ret = drm_sman_init(&dev_priv->sman, 2, 12, 8);
-       if (ret) {
+       if (ret)
                kfree(dev_priv);
-       }
 
        return ret;
 }
index af22111397d8cad6822cfa1b659c291ec885fa45..07d0f2979cac1158f4db86a90e28bf4184d2b1fa 100644 (file)
@@ -78,7 +78,7 @@ static unsigned long sis_sman_mm_offset(void *private, void *ref)
 #else /* CONFIG_FB_SIS[_MODULE] */
 
 #define SIS_MM_ALIGN_SHIFT 4
-#define SIS_MM_ALIGN_MASK ( (1 << SIS_MM_ALIGN_SHIFT) - 1)
+#define SIS_MM_ALIGN_MASK ((1 << SIS_MM_ALIGN_SHIFT) - 1)
 
 #endif /* CONFIG_FB_SIS[_MODULE] */
 
@@ -225,9 +225,8 @@ static drm_local_map_t *sis_reg_init(struct drm_device *dev)
                map = entry->map;
                if (!map)
                        continue;
-               if (map->type == _DRM_REGISTERS) {
+               if (map->type == _DRM_REGISTERS)
                        return map;
-               }
        }
        return NULL;
 }
@@ -264,10 +263,10 @@ int sis_idle(struct drm_device *dev)
 
        end = jiffies + (DRM_HZ * 3);
 
-       for (i=0; i<4; ++i) {
+       for (i = 0; i < 4; ++i) {
                do {
                        idle_reg = SIS_READ(0x85cc);
-               } while ( !time_after_eq(jiffies, end) &&
+               } while (!time_after_eq(jiffies, end) &&
                          ((idle_reg & 0x80000000) != 0x80000000));
        }
 
@@ -301,7 +300,7 @@ void sis_lastclose(struct drm_device *dev)
        mutex_unlock(&dev->struct_mutex);
 }
 
-void sis_reclaim_buffers_locked(struct drm_device * dev,
+void sis_reclaim_buffers_locked(struct drm_device *dev,
                                struct drm_file *file_priv)
 {
        drm_sis_private_t *dev_priv = dev->dev_private;
@@ -312,9 +311,8 @@ void sis_reclaim_buffers_locked(struct drm_device * dev,
                return;
        }
 
-       if (dev->driver->dma_quiescent) {
+       if (dev->driver->dma_quiescent)
                dev->driver->dma_quiescent(dev);
-       }
 
        drm_sman_owner_cleanup(&dev_priv->sman, (unsigned long)file_priv);
        mutex_unlock(&dev->struct_mutex);
index bfb92d2832606945bbddc08a15047b1b09ae2881..68dda74a50ae54c8273eb0e076d7ff151f9f7231 100644 (file)
        *((uint32_t *)(vb)) = ((nReg) >> 2) | HALCYON_HEADER1;  \
        *((uint32_t *)(vb) + 1) = (nData);                      \
        vb = ((uint32_t *)vb) + 2;                              \
-       dev_priv->dma_low +=8;                                  \
+       dev_priv->dma_low += 8;                                 \
 }
 
 #define via_flush_write_combine() DRM_MEMORYBARRIER()
 
-#define VIA_OUT_RING_QW(w1,w2)                 \
+#define VIA_OUT_RING_QW(w1, w2)        do {            \
        *vb++ = (w1);                           \
        *vb++ = (w2);                           \
-       dev_priv->dma_low += 8;
+       dev_priv->dma_low += 8;                 \
+} while (0)
 
-static void via_cmdbuf_start(drm_via_private_t * dev_priv);
-static void via_cmdbuf_pause(drm_via_private_t * dev_priv);
-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);
-static void via_pad_cache(drm_via_private_t * dev_priv, int qwords);
+static void via_cmdbuf_start(drm_via_private_t *dev_priv);
+static void via_cmdbuf_pause(drm_via_private_t *dev_priv);
+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);
+static void via_pad_cache(drm_via_private_t *dev_priv, int qwords);
 
 /*
  * Free space in command buffer.
  */
 
-static uint32_t via_cmdbuf_space(drm_via_private_t * dev_priv)
+static uint32_t via_cmdbuf_space(drm_via_private_t *dev_priv)
 {
        uint32_t agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr;
        uint32_t hw_addr = *(dev_priv->hw_addr_ptr) - agp_base;
@@ -93,7 +94,7 @@ static uint32_t via_cmdbuf_space(drm_via_private_t * dev_priv)
  * How much does the command regulator lag behind?
  */
 
-static uint32_t via_cmdbuf_lag(drm_via_private_t * dev_priv)
+static uint32_t via_cmdbuf_lag(drm_via_private_t *dev_priv)
 {
        uint32_t agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr;
        uint32_t hw_addr = *(dev_priv->hw_addr_ptr) - agp_base;
@@ -108,7 +109,7 @@ static uint32_t via_cmdbuf_lag(drm_via_private_t * dev_priv)
  */
 
 static inline int
-via_cmdbuf_wait(drm_via_private_t * dev_priv, unsigned int size)
+via_cmdbuf_wait(drm_via_private_t *dev_priv, unsigned int size)
 {
        uint32_t agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr;
        uint32_t cur_addr, hw_addr, next_addr;
@@ -146,14 +147,13 @@ static inline uint32_t *via_check_dma(drm_via_private_t * dev_priv,
            dev_priv->dma_high) {
                via_cmdbuf_rewind(dev_priv);
        }
-       if (via_cmdbuf_wait(dev_priv, size) != 0) {
+       if (via_cmdbuf_wait(dev_priv, size) != 0)
                return NULL;
-       }
 
        return (uint32_t *) (dev_priv->dma_ptr + dev_priv->dma_low);
 }
 
-int via_dma_cleanup(struct drm_device * dev)
+int via_dma_cleanup(struct drm_device *dev)
 {
        if (dev->dev_private) {
                drm_via_private_t *dev_priv =
@@ -171,9 +171,9 @@ int via_dma_cleanup(struct drm_device * dev)
        return 0;
 }
 
-static int via_initialize(struct drm_device * dev,
-                         drm_via_private_t * dev_priv,
-                         drm_via_dma_init_t * init)
+static int via_initialize(struct drm_device *dev,
+                         drm_via_private_t *dev_priv,
+                         drm_via_dma_init_t *init)
 {
        if (!dev_priv || !dev_priv->mmio) {
                DRM_ERROR("via_dma_init called before via_map_init\n");
@@ -258,7 +258,7 @@ static int via_dma_init(struct drm_device *dev, void *data, struct drm_file *fil
        return retcode;
 }
 
-static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t * cmd)
+static int via_dispatch_cmdbuffer(struct drm_device *dev, drm_via_cmdbuffer_t *cmd)
 {
        drm_via_private_t *dev_priv;
        uint32_t *vb;
@@ -271,9 +271,8 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t *
                return -EFAULT;
        }
 
-       if (cmd->size > VIA_PCI_BUF_SIZE) {
+       if (cmd->size > VIA_PCI_BUF_SIZE)
                return -ENOMEM;
-       }
 
        if (DRM_COPY_FROM_USER(dev_priv->pci_buf, cmd->buf, cmd->size))
                return -EFAULT;
@@ -291,9 +290,8 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t *
        }
 
        vb = via_check_dma(dev_priv, (cmd->size < 0x100) ? 0x102 : cmd->size);
-       if (vb == NULL) {
+       if (vb == NULL)
                return -EAGAIN;
-       }
 
        memcpy(vb, dev_priv->pci_buf, cmd->size);
 
@@ -311,13 +309,12 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t *
        return 0;
 }
 
-int via_driver_dma_quiescent(struct drm_device * dev)
+int via_driver_dma_quiescent(struct drm_device *dev)
 {
        drm_via_private_t *dev_priv = dev->dev_private;
 
-       if (!via_wait_idle(dev_priv)) {
+       if (!via_wait_idle(dev_priv))
                return -EBUSY;
-       }
        return 0;
 }
 
@@ -339,22 +336,17 @@ static int via_cmdbuffer(struct drm_device *dev, void *data, struct drm_file *fi
        DRM_DEBUG("buf %p size %lu\n", cmdbuf->buf, cmdbuf->size);
 
        ret = via_dispatch_cmdbuffer(dev, cmdbuf);
-       if (ret) {
-               return ret;
-       }
-
-       return 0;
+       return ret;
 }
 
-static int via_dispatch_pci_cmdbuffer(struct drm_device * dev,
-                                     drm_via_cmdbuffer_t * cmd)
+static int via_dispatch_pci_cmdbuffer(struct drm_device *dev,
+                                     drm_via_cmdbuffer_t *cmd)
 {
        drm_via_private_t *dev_priv = dev->dev_private;
        int ret;
 
-       if (cmd->size > VIA_PCI_BUF_SIZE) {
+       if (cmd->size > VIA_PCI_BUF_SIZE)
                return -ENOMEM;
-       }
        if (DRM_COPY_FROM_USER(dev_priv->pci_buf, cmd->buf, cmd->size))
                return -EFAULT;
 
@@ -380,19 +372,14 @@ static int via_pci_cmdbuffer(struct drm_device *dev, void *data, struct drm_file
        DRM_DEBUG("buf %p size %lu\n", cmdbuf->buf, cmdbuf->size);
 
        ret = via_dispatch_pci_cmdbuffer(dev, cmdbuf);
-       if (ret) {
-               return ret;
-       }
-
-       return 0;
+       return ret;
 }
 
-static inline uint32_t *via_align_buffer(drm_via_private_t * dev_priv,
+static inline uint32_t *via_align_buffer(drm_via_private_t *dev_priv,
                                         uint32_t * vb, int qw_count)
 {
-       for (; qw_count > 0; --qw_count) {
+       for (; qw_count > 0; --qw_count)
                VIA_OUT_RING_QW(HC_DUMMY, HC_DUMMY);
-       }
        return vb;
 }
 
@@ -401,7 +388,7 @@ static inline uint32_t *via_align_buffer(drm_via_private_t * dev_priv,
  *
  * Returns virtual pointer to ring buffer.
  */
-static inline uint32_t *via_get_dma(drm_via_private_t * dev_priv)
+static inline uint32_t *via_get_dma(drm_via_private_t *dev_priv)
 {
        return (uint32_t *) (dev_priv->dma_ptr + dev_priv->dma_low);
 }
@@ -411,18 +398,18 @@ static inline uint32_t *via_get_dma(drm_via_private_t * dev_priv)
  * modifying the pause address stored in the buffer itself. If
  * the regulator has already paused, restart it.
  */
-static int via_hook_segment(drm_via_private_t * dev_priv,
+static int via_hook_segment(drm_via_private_t *dev_priv,
                            uint32_t pause_addr_hi, uint32_t pause_addr_lo,
                            int no_pci_fire)
 {
        int paused, count;
        volatile uint32_t *paused_at = dev_priv->last_pause_ptr;
-       uint32_t reader,ptr;
+       uint32_t reader, ptr;
        uint32_t diff;
 
        paused = 0;
        via_flush_write_combine();
-       (void) *(volatile uint32_t *)(via_get_dma(dev_priv) -1);
+       (void) *(volatile uint32_t *)(via_get_dma(dev_priv) - 1);
 
        *paused_at = pause_addr_lo;
        via_flush_write_combine();
@@ -435,7 +422,7 @@ static int via_hook_segment(drm_via_private_t * dev_priv,
        dev_priv->last_pause_ptr = via_get_dma(dev_priv) - 1;
 
        /*
-        * If there is a possibility that the command reader will 
+        * If there is a possibility that the command reader will
         * miss the new pause address and pause on the old one,
         * In that case we need to program the new start address
         * using PCI.
@@ -443,9 +430,9 @@ static int via_hook_segment(drm_via_private_t * dev_priv,
 
        diff = (uint32_t) (ptr - reader) - dev_priv->dma_diff;
        count = 10000000;
-       while(diff == 0 && count--) {
+       while (diff == 0 && count--) {
                paused = (VIA_READ(0x41c) & 0x80000000);
-               if (paused) 
+               if (paused)
                        break;
                reader = *(dev_priv->hw_addr_ptr);
                diff = (uint32_t) (ptr - reader) - dev_priv->dma_diff;
@@ -477,7 +464,7 @@ static int via_hook_segment(drm_via_private_t * dev_priv,
        return paused;
 }
 
-static int via_wait_idle(drm_via_private_t * dev_priv)
+static int via_wait_idle(drm_via_private_t *dev_priv)
 {
        int count = 10000000;
 
@@ -491,9 +478,9 @@ static int via_wait_idle(drm_via_private_t * dev_priv)
        return count;
 }
 
-static uint32_t *via_align_cmd(drm_via_private_t * dev_priv, uint32_t cmd_type,
-                              uint32_t addr, uint32_t * cmd_addr_hi,
-                              uint32_t * cmd_addr_lo, int skip_wait)
+static uint32_t *via_align_cmd(drm_via_private_t *dev_priv, uint32_t cmd_type,
+                              uint32_t addr, uint32_t *cmd_addr_hi,
+                              uint32_t *cmd_addr_lo, int skip_wait)
 {
        uint32_t agp_base;
        uint32_t cmd_addr, addr_lo, addr_hi;
@@ -521,7 +508,7 @@ static uint32_t *via_align_cmd(drm_via_private_t * dev_priv, uint32_t cmd_type,
        return vb;
 }
 
-static void via_cmdbuf_start(drm_via_private_t * dev_priv)
+static void via_cmdbuf_start(drm_via_private_t *dev_priv)
 {
        uint32_t pause_addr_lo, pause_addr_hi;
        uint32_t start_addr, start_addr_lo;
@@ -580,7 +567,7 @@ static void via_cmdbuf_start(drm_via_private_t * dev_priv)
        dev_priv->dma_diff = ptr - reader;
 }
 
-static void via_pad_cache(drm_via_private_t * dev_priv, int qwords)
+static void via_pad_cache(drm_via_private_t *dev_priv, int qwords)
 {
        uint32_t *vb;
 
@@ -590,7 +577,7 @@ static void via_pad_cache(drm_via_private_t * dev_priv, int qwords)
        via_align_buffer(dev_priv, vb, qwords);
 }
 
-static inline void via_dummy_bitblt(drm_via_private_t * dev_priv)
+static inline void via_dummy_bitblt(drm_via_private_t *dev_priv)
 {
        uint32_t *vb = via_get_dma(dev_priv);
        SetReg2DAGP(0x0C, (0 | (0 << 16)));
@@ -598,7 +585,7 @@ static inline void via_dummy_bitblt(drm_via_private_t * dev_priv)
        SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xAA000000);
 }
 
-static void via_cmdbuf_jump(drm_via_private_t * dev_priv)
+static void via_cmdbuf_jump(drm_via_private_t *dev_priv)
 {
        uint32_t agp_base;
        uint32_t pause_addr_lo, pause_addr_hi;
@@ -617,9 +604,8 @@ static void via_cmdbuf_jump(drm_via_private_t * dev_priv)
         */
 
        dev_priv->dma_low = 0;
-       if (via_cmdbuf_wait(dev_priv, CMDBUF_ALIGNMENT_SIZE) != 0) {
+       if (via_cmdbuf_wait(dev_priv, CMDBUF_ALIGNMENT_SIZE) != 0)
                DRM_ERROR("via_cmdbuf_jump failed\n");
-       }
 
        via_dummy_bitblt(dev_priv);
        via_dummy_bitblt(dev_priv);
@@ -657,12 +643,12 @@ static void via_cmdbuf_jump(drm_via_private_t * dev_priv)
 }
 
 
-static void via_cmdbuf_rewind(drm_via_private_t * dev_priv)
+static void via_cmdbuf_rewind(drm_via_private_t *dev_priv)
 {
        via_cmdbuf_jump(dev_priv);
 }
 
-static void via_cmdbuf_flush(drm_via_private_t * dev_priv, uint32_t cmd_type)
+static void via_cmdbuf_flush(drm_via_private_t *dev_priv, uint32_t cmd_type)
 {
        uint32_t pause_addr_lo, pause_addr_hi;
 
@@ -670,12 +656,12 @@ static void via_cmdbuf_flush(drm_via_private_t * dev_priv, uint32_t cmd_type)
        via_hook_segment(dev_priv, pause_addr_hi, pause_addr_lo, 0);
 }
 
-static void via_cmdbuf_pause(drm_via_private_t * dev_priv)
+static void via_cmdbuf_pause(drm_via_private_t *dev_priv)
 {
        via_cmdbuf_flush(dev_priv, HC_HAGPBpID_PAUSE);
 }
 
-static void via_cmdbuf_reset(drm_via_private_t * dev_priv)
+static void via_cmdbuf_reset(drm_via_private_t *dev_priv)
 {
        via_cmdbuf_flush(dev_priv, HC_HAGPBpID_STOP);
        via_wait_idle(dev_priv);
@@ -708,9 +694,8 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file *
        case VIA_CMDBUF_SPACE:
                while (((tmp_size = via_cmdbuf_space(dev_priv)) < d_siz->size)
                       && --count) {
-                       if (!d_siz->wait) {
+                       if (!d_siz->wait)
                                break;
-                       }
                }
                if (!count) {
                        DRM_ERROR("VIA_CMDBUF_SPACE timed out.\n");
@@ -720,9 +705,8 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file *
        case VIA_CMDBUF_LAG:
                while (((tmp_size = via_cmdbuf_lag(dev_priv)) > d_siz->size)
                       && --count) {
-                       if (!d_siz->wait) {
+                       if (!d_siz->wait)
                                break;
-                       }
                }
                if (!count) {
                        DRM_ERROR("VIA_CMDBUF_LAG timed out.\n");
index 4c54f043068ed3195595863f563a6c19c01bf7fc..9b5b4d9dd62c9fceffe9c5fa0dd218ff7119d5a7 100644 (file)
@@ -70,7 +70,7 @@ via_unmap_blit_from_device(struct pci_dev *pdev, drm_via_sg_info_t *vsg)
                descriptor_this_page;
        dma_addr_t next = vsg->chain_start;
 
-       while(num_desc--) {
+       while (num_desc--) {
                if (descriptor_this_page-- == 0) {
                        cur_descriptor_page--;
                        descriptor_this_page = vsg->descriptors_per_page - 1;
@@ -174,19 +174,19 @@ via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg)
        struct page *page;
        int i;
 
-       switch(vsg->state) {
+       switch (vsg->state) {
        case dr_via_device_mapped:
                via_unmap_blit_from_device(pdev, vsg);
        case dr_via_desc_pages_alloc:
-               for (i=0; i<vsg->num_desc_pages; ++i) {
+               for (i = 0; i < vsg->num_desc_pages; ++i) {
                        if (vsg->desc_pages[i] != NULL)
-                         free_page((unsigned long)vsg->desc_pages[i]);
+                               free_page((unsigned long)vsg->desc_pages[i]);
                }
                kfree(vsg->desc_pages);
        case dr_via_pages_locked:
-               for (i=0; i<vsg->num_pages; ++i) {
-                       if ( NULL != (page = vsg->pages[i])) {
-                               if (! PageReserved(page) && (DMA_FROM_DEVICE == vsg->direction))
+               for (i = 0; i < vsg->num_pages; ++i) {
+                       if (NULL != (page = vsg->pages[i])) {
+                               if (!PageReserved(page) && (DMA_FROM_DEVICE == vsg->direction))
                                        SetPageDirty(page);
                                page_cache_release(page);
                        }
@@ -232,7 +232,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg,  drm_via_dmablit_t *xfer)
 {
        int ret;
        unsigned long first_pfn = VIA_PFN(xfer->mem_addr);
-       vsg->num_pages = VIA_PFN(xfer->mem_addr + (xfer->num_lines * xfer->mem_stride -1)) -
+       vsg->num_pages = VIA_PFN(xfer->mem_addr + (xfer->num_lines * xfer->mem_stride - 1)) -
                first_pfn + 1;
 
        if (NULL == (vsg->pages = vmalloc(sizeof(struct page *) * vsg->num_pages)))
@@ -268,7 +268,7 @@ via_alloc_desc_pages(drm_via_sg_info_t *vsg)
 {
        int i;
 
-       vsg->descriptors_per_page = PAGE_SIZE / sizeof( drm_via_descriptor_t);
+       vsg->descriptors_per_page = PAGE_SIZE / sizeof(drm_via_descriptor_t);
        vsg->num_desc_pages = (vsg->num_desc + vsg->descriptors_per_page - 1) /
                vsg->descriptors_per_page;
 
@@ -276,7 +276,7 @@ via_alloc_desc_pages(drm_via_sg_info_t *vsg)
                return -ENOMEM;
 
        vsg->state = dr_via_desc_pages_alloc;
-       for (i=0; i<vsg->num_desc_pages; ++i) {
+       for (i = 0; i < vsg->num_desc_pages; ++i) {
                if (NULL == (vsg->desc_pages[i] =
                             (drm_via_descriptor_t *) __get_free_page(GFP_KERNEL)))
                        return -ENOMEM;
@@ -318,21 +318,20 @@ via_dmablit_handler(struct drm_device *dev, int engine, int from_irq)
        drm_via_blitq_t *blitq = dev_priv->blit_queues + engine;
        int cur;
        int done_transfer;
-       unsigned long irqsave=0;
+       unsigned long irqsave = 0;
        uint32_t status = 0;
 
        DRM_DEBUG("DMA blit handler called. engine = %d, from_irq = %d, blitq = 0x%lx\n",
                  engine, from_irq, (unsigned long) blitq);
 
-       if (from_irq) {
+       if (from_irq)
                spin_lock(&blitq->blit_lock);
-       } else {
+       else
                spin_lock_irqsave(&blitq->blit_lock, irqsave);
-       }
 
        done_transfer = blitq->is_active &&
-         (( status = VIA_READ(VIA_PCI_DMA_CSR0 + engine*0x04)) & VIA_DMA_CSR_TD);
-       done_transfer = done_transfer || ( blitq->aborting && !(status & VIA_DMA_CSR_DE));
+         ((status = VIA_READ(VIA_PCI_DMA_CSR0 + engine*0x04)) & VIA_DMA_CSR_TD);
+       done_transfer = done_transfer || (blitq->aborting && !(status & VIA_DMA_CSR_DE));
 
        cur = blitq->cur;
        if (done_transfer) {
@@ -377,18 +376,16 @@ via_dmablit_handler(struct drm_device *dev, int engine, int from_irq)
                        if (!timer_pending(&blitq->poll_timer))
                                mod_timer(&blitq->poll_timer, jiffies + 1);
                } else {
-                       if (timer_pending(&blitq->poll_timer)) {
+                       if (timer_pending(&blitq->poll_timer))
                                del_timer(&blitq->poll_timer);
-                       }
                        via_dmablit_engine_off(dev, engine);
                }
        }
 
-       if (from_irq) {
+       if (from_irq)
                spin_unlock(&blitq->blit_lock);
-       } else {
+       else
                spin_unlock_irqrestore(&blitq->blit_lock, irqsave);
-       }
 }
 
 
@@ -414,10 +411,9 @@ via_dmablit_active(drm_via_blitq_t *blitq, int engine, uint32_t handle, wait_que
                ((blitq->cur_blit_handle - handle) <= (1 << 23));
 
        if (queue && active) {
-               slot = handle - blitq->done_blit_handle + blitq->cur -1;
-               if (slot >= VIA_NUM_BLIT_SLOTS) {
+               slot = handle - blitq->done_blit_handle + blitq->cur - 1;
+               if (slot >= VIA_NUM_BLIT_SLOTS)
                        slot -= VIA_NUM_BLIT_SLOTS;
-               }
                *queue = blitq->blit_queue + slot;
        }
 
@@ -506,12 +502,12 @@ via_dmablit_workqueue(struct work_struct *work)
        int cur_released;
 
 
-       DRM_DEBUG("Workqueue task called for blit engine %ld\n",(unsigned long)
+       DRM_DEBUG("Workqueue task called for blit engine %ld\n", (unsigned long)
                  (blitq - ((drm_via_private_t *)dev->dev_private)->blit_queues));
 
        spin_lock_irqsave(&blitq->blit_lock, irqsave);
 
-       while(blitq->serviced != blitq->cur) {
+       while (blitq->serviced != blitq->cur) {
 
                cur_released = blitq->serviced++;
 
@@ -545,13 +541,13 @@ via_dmablit_workqueue(struct work_struct *work)
 void
 via_init_dmablit(struct drm_device *dev)
 {
-       int i,j;
+       int i, j;
        drm_via_private_t *dev_priv = (drm_via_private_t *)dev->dev_private;
        drm_via_blitq_t *blitq;
 
        pci_set_master(dev->pdev);
 
-       for (i=0; i< VIA_NUM_BLIT_ENGINES; ++i) {
+       for (i = 0; i < VIA_NUM_BLIT_ENGINES; ++i) {
                blitq = dev_priv->blit_queues + i;
                blitq->dev = dev;
                blitq->cur_blit_handle = 0;
@@ -564,9 +560,8 @@ via_init_dmablit(struct drm_device *dev)
                blitq->is_active = 0;
                blitq->aborting = 0;
                spin_lock_init(&blitq->blit_lock);
-               for (j=0; j<VIA_NUM_BLIT_SLOTS; ++j) {
+               for (j = 0; j < VIA_NUM_BLIT_SLOTS; ++j)
                        DRM_INIT_WAITQUEUE(blitq->blit_queue + j);
-               }
                DRM_INIT_WAITQUEUE(&blitq->busy_queue);
                INIT_WORK(&blitq->wq, via_dmablit_workqueue);
                setup_timer(&blitq->poll_timer, via_dmablit_timer,
@@ -685,18 +680,17 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli
 static int
 via_dmablit_grab_slot(drm_via_blitq_t *blitq, int engine)
 {
-       int ret=0;
+       int ret = 0;
        unsigned long irqsave;
 
        DRM_DEBUG("Num free is %d\n", blitq->num_free);
        spin_lock_irqsave(&blitq->blit_lock, irqsave);
-       while(blitq->num_free == 0) {
+       while (blitq->num_free == 0) {
                spin_unlock_irqrestore(&blitq->blit_lock, irqsave);
 
                DRM_WAIT_ON(ret, blitq->busy_queue, DRM_HZ, blitq->num_free > 0);
-               if (ret) {
+               if (ret)
                        return (-EINTR == ret) ? -EAGAIN : ret;
-               }
 
                spin_lock_irqsave(&blitq->blit_lock, irqsave);
        }
@@ -719,7 +713,7 @@ via_dmablit_release_slot(drm_via_blitq_t *blitq)
        spin_lock_irqsave(&blitq->blit_lock, irqsave);
        blitq->num_free++;
        spin_unlock_irqrestore(&blitq->blit_lock, irqsave);
-       DRM_WAKEUP( &blitq->busy_queue );
+       DRM_WAKEUP(&blitq->busy_queue);
 }
 
 /*
@@ -744,9 +738,8 @@ via_dmablit(struct drm_device *dev, drm_via_dmablit_t *xfer)
 
        engine = (xfer->to_fb) ? 0 : 1;
        blitq = dev_priv->blit_queues + engine;
-       if (0 != (ret = via_dmablit_grab_slot(blitq, engine))) {
+       if (0 != (ret = via_dmablit_grab_slot(blitq, engine)))
                return ret;
-       }
        if (NULL == (vsg = kmalloc(sizeof(*vsg), GFP_KERNEL))) {
                via_dmablit_release_slot(blitq);
                return -ENOMEM;
@@ -780,7 +773,7 @@ via_dmablit(struct drm_device *dev, drm_via_dmablit_t *xfer)
  */
 
 int
-via_dma_blit_sync( struct drm_device *dev, void *data, struct drm_file *file_priv )
+via_dma_blit_sync(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
        drm_via_blitsync_t *sync = data;
        int err;
@@ -804,7 +797,7 @@ via_dma_blit_sync( struct drm_device *dev, void *data, struct drm_file *file_pri
  */
 
 int
-via_dma_blit( struct drm_device *dev, void *data, struct drm_file *file_priv )
+via_dma_blit(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
        drm_via_dmablit_t *xfer = data;
        int err;
index 7408a547a036937af9bccc52ee77ab2e5a0e3fb2..9b662a327cef3e225765a6685b3893e73da1ec43 100644 (file)
@@ -45,12 +45,12 @@ typedef struct _drm_via_sg_info {
        int num_desc;
        enum dma_data_direction direction;
        unsigned char *bounce_buffer;
-        dma_addr_t chain_start;
+       dma_addr_t chain_start;
        uint32_t free_on_sequence;
-        unsigned int descriptors_per_page;
+       unsigned int descriptors_per_page;
        int aborted;
        enum {
-               dr_via_device_mapped,
+               dr_via_device_mapped,
                dr_via_desc_pages_alloc,
                dr_via_pages_locked,
                dr_via_pages_alloc,
@@ -68,7 +68,7 @@ typedef struct _drm_via_blitq {
        unsigned num_free;
        unsigned num_outstanding;
        unsigned long end;
-        int aborting;
+       int aborting;
        int is_active;
        drm_via_sg_info_t *blits[VIA_NUM_BLIT_SLOTS];
        spinlock_t blit_lock;
index cafcb844a2233879da8d8fb110658e963982b780..9cf87d9123252c49c00c79a396cbe9a1b836c0a0 100644 (file)
@@ -107,9 +107,9 @@ enum via_family {
 #define VIA_BASE ((dev_priv->mmio))
 
 #define VIA_READ(reg)          DRM_READ32(VIA_BASE, reg)
-#define VIA_WRITE(reg,val)     DRM_WRITE32(VIA_BASE, reg, val)
+#define VIA_WRITE(reg, val)    DRM_WRITE32(VIA_BASE, reg, val)
 #define VIA_READ8(reg)         DRM_READ8(VIA_BASE, reg)
-#define VIA_WRITE8(reg,val)    DRM_WRITE8(VIA_BASE, reg, val)
+#define VIA_WRITE8(reg, val)   DRM_WRITE8(VIA_BASE, reg, val)
 
 extern struct drm_ioctl_desc via_ioctls[];
 extern int via_max_ioctl;
@@ -121,28 +121,28 @@ extern int via_agp_init(struct drm_device *dev, void *data, struct drm_file *fil
 extern int via_map_init(struct drm_device *dev, void *data, struct drm_file *file_priv);
 extern int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_priv);
 extern int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv);
-extern int via_dma_blit_sync( struct drm_device *dev, void *data, struct drm_file *file_priv );
-extern int via_dma_blit( struct drm_device *dev, void *data, struct drm_file *file_priv );
+extern int via_dma_blit_sync(struct drm_device *dev, void *data, struct drm_file *file_priv);
+extern int via_dma_blit(struct drm_device *dev, void *data, struct drm_file *file_priv);
 
 extern int via_driver_load(struct drm_device *dev, unsigned long chipset);
 extern int via_driver_unload(struct drm_device *dev);
 
-extern int via_init_context(struct drm_device * dev, int context);
-extern int via_final_context(struct drm_device * dev, int context);
+extern int via_init_context(struct drm_device *dev, int context);
+extern int via_final_context(struct drm_device *dev, int context);
 
-extern int via_do_cleanup_map(struct drm_device * dev);
+extern int via_do_cleanup_map(struct drm_device *dev);
 extern u32 via_get_vblank_counter(struct drm_device *dev, int crtc);
 extern int via_enable_vblank(struct drm_device *dev, int crtc);
 extern void via_disable_vblank(struct drm_device *dev, int crtc);
 
 extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS);
-extern void via_driver_irq_preinstall(struct drm_device * dev);
+extern void via_driver_irq_preinstall(struct drm_device *dev);
 extern int via_driver_irq_postinstall(struct drm_device *dev);
-extern void via_driver_irq_uninstall(struct drm_device * dev);
+extern void via_driver_irq_uninstall(struct drm_device *dev);
 
-extern int via_dma_cleanup(struct drm_device * dev);
+extern int via_dma_cleanup(struct drm_device *dev);
 extern void via_init_command_verifier(void);
-extern int via_driver_dma_quiescent(struct drm_device * dev);
+extern int via_driver_dma_quiescent(struct drm_device *dev);
 extern void via_init_futex(drm_via_private_t *dev_priv);
 extern void via_cleanup_futex(drm_via_private_t *dev_priv);
 extern void via_release_futex(drm_via_private_t *dev_priv, int context);
index 34079f251cd4d9c5960b19388c9dce9efd943e79..d391f48ef87ad586c0295b51233e7d01356de5c7 100644 (file)
@@ -141,11 +141,10 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
                        atomic_inc(&cur_irq->irq_received);
                        DRM_WAKEUP(&cur_irq->irq_queue);
                        handled = 1;
-                       if (dev_priv->irq_map[drm_via_irq_dma0_td] == i) {
+                       if (dev_priv->irq_map[drm_via_irq_dma0_td] == i)
                                via_dmablit_handler(dev, 0, 1);
-                       } else if (dev_priv->irq_map[drm_via_irq_dma1_td] == i) {
+                       else if (dev_priv->irq_map[drm_via_irq_dma1_td] == i)
                                via_dmablit_handler(dev, 1, 1);
-                       }
                }
                cur_irq++;
        }
@@ -160,7 +159,7 @@ irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
                return IRQ_NONE;
 }
 
-static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t * dev_priv)
+static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t *dev_priv)
 {
        u32 status;
 
@@ -207,7 +206,7 @@ void via_disable_vblank(struct drm_device *dev, int crtc)
 }
 
 static int
-via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequence,
+via_driver_irq_wait(struct drm_device *dev, unsigned int irq, int force_sequence,
                    unsigned int *sequence)
 {
        drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
@@ -260,7 +259,7 @@ via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequenc
  * drm_dma.h hooks
  */
 
-void via_driver_irq_preinstall(struct drm_device * dev)
+void via_driver_irq_preinstall(struct drm_device *dev)
 {
        drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
        u32 status;
@@ -329,7 +328,7 @@ int via_driver_irq_postinstall(struct drm_device *dev)
        return 0;
 }
 
-void via_driver_irq_uninstall(struct drm_device * dev)
+void via_driver_irq_uninstall(struct drm_device *dev)
 {
        drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
        u32 status;
index 6e6f915916395fc6f47d82943d976ae3e796ead4..6cca9a709f7a25dfc3ba890f070023196450d7b1 100644 (file)
@@ -25,7 +25,7 @@
 #include "via_drm.h"
 #include "via_drv.h"
 
-static int via_do_init_map(struct drm_device * dev, drm_via_init_t * init)
+static int via_do_init_map(struct drm_device *dev, drm_via_init_t *init)
 {
        drm_via_private_t *dev_priv = dev->dev_private;
 
@@ -68,7 +68,7 @@ static int via_do_init_map(struct drm_device * dev, drm_via_init_t * init)
        return 0;
 }
 
-int via_do_cleanup_map(struct drm_device * dev)
+int via_do_cleanup_map(struct drm_device *dev)
 {
        via_dma_cleanup(dev);
 
index f694cb5ededca2ccfc74bd712b60a0cd06248bce..6cc2dadae3ef06acb3e94ff60da0d968470ac431 100644 (file)
@@ -31,7 +31,7 @@
 #include "drm_sman.h"
 
 #define VIA_MM_ALIGN_SHIFT 4
-#define VIA_MM_ALIGN_MASK ( (1 << VIA_MM_ALIGN_SHIFT) - 1)
+#define VIA_MM_ALIGN_MASK ((1 << VIA_MM_ALIGN_SHIFT) - 1)
 
 int via_agp_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
@@ -172,7 +172,7 @@ int via_mem_free(struct drm_device *dev, void *data, struct drm_file *file_priv)
 }
 
 
-void via_reclaim_buffers_locked(struct drm_device * dev,
+void via_reclaim_buffers_locked(struct drm_device *dev,
                                struct drm_file *file_priv)
 {
        drm_via_private_t *dev_priv = dev->dev_private;
@@ -183,9 +183,8 @@ void via_reclaim_buffers_locked(struct drm_device * dev,
                return;
        }
 
-       if (dev->driver->dma_quiescent) {
+       if (dev->driver->dma_quiescent)
                dev->driver->dma_quiescent(dev);
-       }
 
        drm_sman_owner_cleanup(&dev_priv->sman, (unsigned long)file_priv);
        mutex_unlock(&dev->struct_mutex);
index 46a57919874797b3b41d694b1ab70159a6f3e13e..48957b856d41d89695a2e91158ae1a4e8ec1f6cb 100644 (file)
@@ -235,7 +235,7 @@ static hazard_t table2[256];
 static hazard_t table3[256];
 
 static __inline__ int
-eat_words(const uint32_t ** buf, const uint32_t * buf_end, unsigned num_words)
+eat_words(const uint32_t **buf, const uint32_t *buf_end, unsigned num_words)
 {
        if ((buf_end - *buf) >= num_words) {
                *buf += num_words;
@@ -252,7 +252,7 @@ eat_words(const uint32_t ** buf, const uint32_t * buf_end, unsigned num_words)
 static __inline__ drm_local_map_t *via_drm_lookup_agp_map(drm_via_state_t *seq,
                                                    unsigned long offset,
                                                    unsigned long size,
-                                                   struct drm_device * dev)
+                                                   struct drm_device *dev)
 {
        struct drm_map_list *r_list;
        drm_local_map_t *map = seq->map_cache;
@@ -344,7 +344,7 @@ static __inline__ int finish_current_sequence(drm_via_state_t * cur_seq)
 }
 
 static __inline__ int
-investigate_hazard(uint32_t cmd, hazard_t hz, drm_via_state_t * cur_seq)
+investigate_hazard(uint32_t cmd, hazard_t hz, drm_via_state_t *cur_seq)
 {
        register uint32_t tmp, *tmp_addr;
 
@@ -518,7 +518,7 @@ investigate_hazard(uint32_t cmd, hazard_t hz, drm_via_state_t * cur_seq)
 
 static __inline__ int
 via_check_prim_list(uint32_t const **buffer, const uint32_t * buf_end,
-                   drm_via_state_t * cur_seq)
+                   drm_via_state_t *cur_seq)
 {
        drm_via_private_t *dev_priv =
            (drm_via_private_t *) cur_seq->dev->dev_private;
@@ -621,8 +621,8 @@ via_check_prim_list(uint32_t const **buffer, const uint32_t * buf_end,
 }
 
 static __inline__ verifier_state_t
-via_check_header2(uint32_t const **buffer, const uint32_t * buf_end,
-                 drm_via_state_t * hc_state)
+via_check_header2(uint32_t const **buffer, const uint32_t *buf_end,
+                 drm_via_state_t *hc_state)
 {
        uint32_t cmd;
        int hz_mode;
@@ -706,16 +706,15 @@ via_check_header2(uint32_t const **buffer, const uint32_t * buf_end,
                        return state_error;
                }
        }
-       if (hc_state->unfinished && finish_current_sequence(hc_state)) {
+       if (hc_state->unfinished && finish_current_sequence(hc_state))
                return state_error;
-       }
        *buffer = buf;
        return state_command;
 }
 
 static __inline__ verifier_state_t
-via_parse_header2(drm_via_private_t * dev_priv, uint32_t const **buffer,
-                 const uint32_t * buf_end, int *fire_count)
+via_parse_header2(drm_via_private_t *dev_priv, uint32_t const **buffer,
+                 const uint32_t *buf_end, int *fire_count)
 {
        uint32_t cmd;
        const uint32_t *buf = *buffer;
@@ -833,8 +832,8 @@ via_check_header1(uint32_t const **buffer, const uint32_t * buf_end)
 }
 
 static __inline__ verifier_state_t
-via_parse_header1(drm_via_private_t * dev_priv, uint32_t const **buffer,
-                 const uint32_t * buf_end)
+via_parse_header1(drm_via_private_t *dev_priv, uint32_t const **buffer,
+                 const uint32_t *buf_end)
 {
        register uint32_t cmd;
        const uint32_t *buf = *buffer;
@@ -851,7 +850,7 @@ via_parse_header1(drm_via_private_t * dev_priv, uint32_t const **buffer,
 }
 
 static __inline__ verifier_state_t
-via_check_vheader5(uint32_t const **buffer, const uint32_t * buf_end)
+via_check_vheader5(uint32_t const **buffer, const uint32_t *buf_end)
 {
        uint32_t data;
        const uint32_t *buf = *buffer;
@@ -884,8 +883,8 @@ via_check_vheader5(uint32_t const **buffer, const uint32_t * buf_end)
 }
 
 static __inline__ verifier_state_t
-via_parse_vheader5(drm_via_private_t * dev_priv, uint32_t const **buffer,
-                  const uint32_t * buf_end)
+via_parse_vheader5(drm_via_private_t *dev_priv, uint32_t const **buffer,
+                  const uint32_t *buf_end)
 {
        uint32_t addr, count, i;
        const uint32_t *buf = *buffer;
@@ -893,9 +892,8 @@ via_parse_vheader5(drm_via_private_t * dev_priv, uint32_t const **buffer,
        addr = *buf++ & ~VIA_VIDEOMASK;
        i = count = *buf;
        buf += 3;
-       while (i--) {
+       while (i--)
                VIA_WRITE(addr, *buf++);
-       }
        if (count & 3)
                buf += 4 - (count & 3);
        *buffer = buf;
@@ -940,8 +938,8 @@ via_check_vheader6(uint32_t const **buffer, const uint32_t * buf_end)
 }
 
 static __inline__ verifier_state_t
-via_parse_vheader6(drm_via_private_t * dev_priv, uint32_t const **buffer,
-                  const uint32_t * buf_end)
+via_parse_vheader6(drm_via_private_t *dev_priv, uint32_t const **buffer,
+                  const uint32_t *buf_end)
 {
 
        uint32_t addr, count, i;
@@ -1037,7 +1035,7 @@ via_verify_command_stream(const uint32_t * buf, unsigned int size,
 }
 
 int
-via_parse_command_stream(struct drm_device * dev, const uint32_t * buf,
+via_parse_command_stream(struct drm_device *dev, const uint32_t *buf,
                         unsigned int size)
 {
 
@@ -1085,9 +1083,8 @@ via_parse_command_stream(struct drm_device * dev, const uint32_t * buf,
                        return -EINVAL;
                }
        }
-       if (state == state_error) {
+       if (state == state_error)
                return -EINVAL;
-       }
        return 0;
 }
 
@@ -1096,13 +1093,11 @@ setup_hazard_table(hz_init_t init_table[], hazard_t table[], int size)
 {
        int i;
 
-       for (i = 0; i < 256; ++i) {
+       for (i = 0; i < 256; ++i)
                table[i] = forbidden_command;
-       }
 
-       for (i = 0; i < size; ++i) {
+       for (i = 0; i < size; ++i)
                table[init_table[i].code] = init_table[i].hz;
-       }
 }
 
 void via_init_command_verifier(void)
index d6f8214b69f59ab3e2934a810205b81e699a7956..26b6d361ab95bc9983fd4795a60c02143524aafb 100644 (file)
@@ -54,8 +54,8 @@ typedef struct {
        const uint32_t *buf_start;
 } drm_via_state_t;
 
-extern int via_verify_command_stream(const uint32_t * buf, unsigned int size,
-                                    struct drm_device * dev, int agp);
+extern int via_verify_command_stream(const uint32_t *buf, unsigned int size,
+                                    struct drm_device *dev, int agp);
 extern int via_parse_command_stream(struct drm_device *dev, const uint32_t *buf,
                                    unsigned int size);
 
index 6efac8117c93c77a20eb7079bbdbb6c4440e58b3..675d311f038ff7fad036767c1ccdb880372c6ad9 100644 (file)
@@ -29,7 +29,7 @@
 #include "via_drm.h"
 #include "via_drv.h"
 
-void via_init_futex(drm_via_private_t * dev_priv)
+void via_init_futex(drm_via_private_t *dev_priv)
 {
        unsigned int i;
 
@@ -41,11 +41,11 @@ void via_init_futex(drm_via_private_t * dev_priv)
        }
 }
 
-void via_cleanup_futex(drm_via_private_t * dev_priv)
+void via_cleanup_futex(drm_via_private_t *dev_priv)
 {
 }
 
-void via_release_futex(drm_via_private_t * dev_priv, int context)
+void via_release_futex(drm_via_private_t *dev_priv, int context)
 {
        unsigned int i;
        volatile int *lock;
index b0866f04ec7613133a6e4ebc7ab3546906af8258..870967a97c15d52eb3f380323e6038d32ed6e76f 100644 (file)
@@ -528,7 +528,7 @@ int vmw_fb_init(struct vmw_private *vmw_priv)
         * Dirty & Deferred IO
         */
        par->dirty.x1 = par->dirty.x2 = 0;
-       par->dirty.y1 = par->dirty.y1 = 0;
+       par->dirty.y1 = par->dirty.y2 = 0;
        par->dirty.active = true;
        spin_lock_init(&par->dirty.lock);
        info->fbdefio = &vmw_defio;
diff --git a/include/drm/i2c/sil164.h b/include/drm/i2c/sil164.h
new file mode 100644 (file)
index 0000000..205e273
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010 Francisco Jerez.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef __DRM_I2C_SIL164_H__
+#define __DRM_I2C_SIL164_H__
+
+/**
+ * struct sil164_encoder_params
+ *
+ * Describes how the sil164 is connected to the GPU. It should be used
+ * as the @params parameter of its @set_config method.
+ *
+ * See "http://www.siliconimage.com/docs/SiI-DS-0021-E-164.pdf".
+ */
+struct sil164_encoder_params {
+       enum {
+               SIL164_INPUT_EDGE_FALLING = 0,
+               SIL164_INPUT_EDGE_RISING
+       } input_edge;
+
+       enum {
+               SIL164_INPUT_WIDTH_12BIT = 0,
+               SIL164_INPUT_WIDTH_24BIT
+       } input_width;
+
+       enum {
+               SIL164_INPUT_SINGLE_EDGE = 0,
+               SIL164_INPUT_DUAL_EDGE
+       } input_dual;
+
+       enum {
+               SIL164_PLL_FILTER_ON = 0,
+               SIL164_PLL_FILTER_OFF,
+       } pll_filter;
+
+       int input_skew; /** < Allowed range [-4, 3], use 0 for no de-skew. */
+       int duallink_skew; /** < Allowed range [-4, 3]. */
+};
+
+#endif