drm/nouveau/i2c: fix a bit of a thinko in nv_wri2cr helper functions
authorBen Skeggs <bskeggs@redhat.com>
Fri, 15 Feb 2013 00:54:42 +0000 (19:54 -0500)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 20 Feb 2013 06:00:58 +0000 (16:00 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/subdev/i2c/base.c

index 1ee53d3cbd0192eabe9a839cf6b7dc6c064763c1..e09af329120e01963caea1c57bfcaae1ed0cdcc3 100644 (file)
@@ -46,13 +46,13 @@ nv_rdi2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg)
 int
 nv_wri2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg, u8 val)
 {
+       u8 buf[2] = { reg, val };
        struct i2c_msg msgs[] = {
-               { .addr = addr, .flags = 0, .len = 1, .buf = &reg },
-               { .addr = addr, .flags = 0, .len = 1, .buf = &val },
+               { .addr = addr, .flags = 0, .len = 2, .buf = buf },
        };
 
-       int ret = i2c_transfer(&port->adapter, msgs, 2);
-       if (ret != 2)
+       int ret = i2c_transfer(&port->adapter, msgs, 1);
+       if (ret != 1)
                return -EIO;
 
        return 0;