diff options
author | Jonathan Corbet <corbet@lwn.net> | 2009-12-28 10:22:53 -0700 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2010-05-07 17:17:38 -0600 |
commit | 6b841edf572ad757f11013326b796e126f05a719 (patch) | |
tree | 434ee85be4b30be8a7abdecb5694432169793f1e | |
parent | b8f7e5d846387e3bcda35f3809856cf085740a24 (diff) | |
download | linux-stable-6b841edf572ad757f11013326b796e126f05a719.tar.gz linux-stable-6b841edf572ad757f11013326b796e126f05a719.tar.bz2 linux-stable-6b841edf572ad757f11013326b796e126f05a719.zip |
via: Rationalize vt1636 detection
The code was ugly and didn't check whether i2c operations were succeeding;
make it a little better.
Cc: ScottFang@viatech.com.cn
Cc: JosephChan@via.com.tw
Cc: Harald Welte <laforge@gnumonks.org>
Acked-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rw-r--r-- | drivers/video/via/vt1636.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/video/via/vt1636.c b/drivers/video/via/vt1636.c index e9f3661d6b3f..e5f802472883 100644 --- a/drivers/video/via/vt1636.c +++ b/drivers/video/via/vt1636.c @@ -167,26 +167,20 @@ bool viafb_lvds_identify_vt1636(u8 i2c_adapter) /* Sense VT1636 LVDS Transmiter */ viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr = - VT1636_LVDS_I2C_ADDR; + VT1636_LVDS_I2C_ADDR; /* Check vendor ID first: */ - viafb_i2c_readbyte(i2c_adapter, - (u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr, - 0x00, &Buffer[0]); - viafb_i2c_readbyte(i2c_adapter, - (u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr, - 0x01, &Buffer[1]); + if (viafb_i2c_readbyte(i2c_adapter, VT1636_LVDS_I2C_ADDR, + 0x00, &Buffer[0])) + return false; + viafb_i2c_readbyte(i2c_adapter, VT1636_LVDS_I2C_ADDR, 0x01, &Buffer[1]); if (!((Buffer[0] == 0x06) && (Buffer[1] == 0x11))) return false; /* Check Chip ID: */ - viafb_i2c_readbyte(i2c_adapter, - (u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr, - 0x02, &Buffer[0]); - viafb_i2c_readbyte(i2c_adapter, - (u8) viaparinfo->chip_info->lvds_chip_info.lvds_chip_slave_addr, - 0x03, &Buffer[1]); + viafb_i2c_readbyte(i2c_adapter, VT1636_LVDS_I2C_ADDR, 0x02, &Buffer[0]); + viafb_i2c_readbyte(i2c_adapter, VT1636_LVDS_I2C_ADDR, 0x03, &Buffer[1]); if ((Buffer[0] == 0x45) && (Buffer[1] == 0x33)) { viaparinfo->chip_info->lvds_chip_info.lvds_chip_name = VT1636_LVDS; |