summaryrefslogtreecommitdiff
path: root/drivers/media/video/tegra/sh532u.c
diff options
context:
space:
mode:
authorQinggang Zhou <qzhou@nvidia.com>2011-03-18 14:27:19 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:42:53 -0800
commitadb4aa27ceccc518630c8a76c8fecebc7b948b35 (patch)
tree5bd26cdc10c35c2f0c80ec329c19557f176b8c07 /drivers/media/video/tegra/sh532u.c
parentabdaae0c2ad2c05c80abd0c7b2e06c49335d2b81 (diff)
media: video: tegra: SH532U: fix formatting errors
- fix an incorrect i2c address and a function return check. - add checks for function returns. - remove the developer name in the beginning comment. - fix an uninitialized variable.. Original-Change-Id: I2d42025b7ff47eb6228e626e65990f4da04b94ac Reviewed-on: http://git-master/r/23594 Reviewed-by: Jonathan Mayo <jmayo@nvidia.com> Tested-by: Qinggang Zhou <qzhou@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com> Rebase-Id: R2fcab8b5c5b997791861629c230bbd25e5f42c90
Diffstat (limited to 'drivers/media/video/tegra/sh532u.c')
-rw-r--r--drivers/media/video/tegra/sh532u.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/media/video/tegra/sh532u.c b/drivers/media/video/tegra/sh532u.c
index bc9fa43a8d30..0b81cac3d8e2 100644
--- a/drivers/media/video/tegra/sh532u.c
+++ b/drivers/media/video/tegra/sh532u.c
@@ -3,9 +3,6 @@
*
* Copyright (C) 2011 NVIDIA Corporation.
*
- * Contributors:
- * Qinggang Zhou <qzhou@nvidia.com>
- *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
@@ -61,7 +58,10 @@ static int sh532u_read_u8(u8 dev, u8 addr, u8 *val)
data[0] = (u8)addr;
- msg[1].addr = client->addr;
+ if (dev)
+ msg[1].addr = dev;
+ else
+ msg[1].addr = client->addr;
msg[1].flags = I2C_M_RD;
msg[1].len = 1;
msg[1].buf = data + 2;
@@ -330,7 +330,7 @@ static unsigned int a2buf[] = {
/* Write 1 byte data to the HVCA Drive IC by data type */
static void sh532u_hvca_wr1(u8 ep_type, u8 ep_data1, u8 ep_addr)
{
- int err;
+ int err = 0;
u8 us_data;
switch (ep_type & 0xF0) {
@@ -360,13 +360,15 @@ static void sh532u_hvca_wr1(u8 ep_type, u8 ep_data1, u8 ep_addr)
err = 1;
}
if (!err)
- sh532u_write_u8((u16)ep_addr, us_data);
+ err = sh532u_write_u8((u16)ep_addr, us_data);
+ if (err)
+ pr_err("Focuser: Failed to init!\n");
}
/* Write 2 byte data to the HVCA Drive IC by data type */
static void sh532u_hvca_wr2(u8 ep_type, u8 ep_data1, u8 ep_data2, u8 ep_addr)
{
- int err;
+ int err = 0;
u8 uc_data1;
u8 uc_data2;
u16 us_data;
@@ -407,7 +409,9 @@ static void sh532u_hvca_wr2(u8 ep_type, u8 ep_data1, u8 ep_data2, u8 ep_addr)
err = 1;
}
if (!err)
- sh532u_write_u16((u16)ep_addr, us_data);
+ err = sh532u_write_u16((u16)ep_addr, us_data);
+ if (err)
+ pr_err("Focuser: Failed to init!\n");
}
static void init_driver(void)
@@ -421,7 +425,7 @@ static void init_driver(void)
/* use hardcoded data instead */
eeprom_data = a2buf[(eeprom_addr & 0xFF) / 4];
} else {
- if (!eeprom_read_u32(eeprom_addr & 0xFF, &eeprom_data))
+ if (eeprom_read_u32(eeprom_addr & 0xFF, &eeprom_data))
pr_info("sh532u: cannot read eeprom\n");
}