diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-05-08 11:38:20 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 22:15:28 +0400 |
commit | a65ff76ac8b24df49bbf4acc38918fb52d1033b0 (patch) | |
tree | 4bd323a77da9e709267d1712e4424a2db155aab9 /drivers/video/riva/rivafb-i2c.c | |
parent | 5b358fe12f03a7822db6f376b608f996c664a952 (diff) | |
download | linux-a65ff76ac8b24df49bbf4acc38918fb52d1033b0.tar.xz |
rivafb/nvidiafb: Various cleanups
Various cleanups to rivafb/nvidiafb's I2C code:
* Drop useless par->bus.
* Refactor I2C bus deletion code.
* Drop useless variable initialization.
* Remove unneeded include of <linux/i2c-id.h>.
* Simplify +1/-1.
* Add __devinit tags where possible.
[adaplas]
The varible initialization are not useless. However, rivafb must
check if i2c bus are created properly before reading the EDID
block.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/riva/rivafb-i2c.c')
-rw-r--r-- | drivers/video/riva/rivafb-i2c.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c index ca9e7e81a9c5..bcb209670a18 100644 --- a/drivers/video/riva/rivafb-i2c.c +++ b/drivers/video/riva/rivafb-i2c.c @@ -88,8 +88,9 @@ static int riva_gpio_getsda(void* data) return val; } -static int riva_setup_i2c_bus(struct riva_i2c_chan *chan, const char *name, - unsigned int i2c_class) +static int __devinit riva_setup_i2c_bus(struct riva_i2c_chan *chan, + const char *name, + unsigned int i2c_class) { int rc; @@ -126,10 +127,8 @@ static int riva_setup_i2c_bus(struct riva_i2c_chan *chan, const char *name, return rc; } -void riva_create_i2c_busses(struct riva_par *par) +void __devinit riva_create_i2c_busses(struct riva_par *par) { - par->bus = 3; - par->chan[0].par = par; par->chan[1].par = par; par->chan[2].par = par; @@ -144,24 +143,22 @@ void riva_create_i2c_busses(struct riva_par *par) void riva_delete_i2c_busses(struct riva_par *par) { - if (par->chan[0].par) - i2c_del_adapter(&par->chan[0].adapter); - par->chan[0].par = NULL; - - if (par->chan[1].par) - i2c_del_adapter(&par->chan[1].adapter); - par->chan[1].par = NULL; + int i; - if (par->chan[2].par) - i2c_del_adapter(&par->chan[2].adapter); - par->chan[2].par = NULL; + for (i = 0; i < 3; i++) { + if (!par->chan[i].par) + continue; + i2c_del_adapter(&par->chan[i].adapter); + par->chan[i].par = NULL; + } } -int riva_probe_i2c_connector(struct riva_par *par, int conn, u8 **out_edid) +int __devinit riva_probe_i2c_connector(struct riva_par *par, int conn, u8 **out_edid) { u8 *edid = NULL; - edid = fb_ddc_read(&par->chan[conn-1].adapter); + if (par->chan[conn].par) + edid = fb_ddc_read(&par->chan[conn].adapter); if (out_edid) *out_edid = edid; |