diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-25 20:42:45 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-25 20:42:45 +0000 |
commit | f5a6918d9c65cfd2cc5a735d3e2f546a7675e918 (patch) | |
tree | d2b189b815d98a4fbb057ef247018b57ff853bfc /linux/drivers/media/video | |
parent | 6f27a5778d71d98848ab2e69d46b3a8b82679d8b (diff) | |
download | mediapointer-dvb-s2-f5a6918d9c65cfd2cc5a735d3e2f546a7675e918.tar.gz mediapointer-dvb-s2-f5a6918d9c65cfd2cc5a735d3e2f546a7675e918.tar.bz2 |
ir-kbd-i2c: Save a temporary memory allocation in ir_probe
From: Jean Delvare <khali@linux-fr.org>
Using i2c_transfer instead of i2c_master_recv in ir_probe saves a
temporary memory allocation.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video')
-rw-r--r-- | linux/drivers/media/video/ir-kbd-i2c.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c index afe23f323..ed25f6409 100644 --- a/linux/drivers/media/video/ir-kbd-i2c.c +++ b/linux/drivers/media/video/ir-kbd-i2c.c @@ -531,8 +531,11 @@ static int ir_probe(struct i2c_adapter *adap) static const int probe_cx88[] = { 0x18, 0x6b, 0x71, -1 }; static const int probe_cx23885[] = { 0x6b, -1 }; const int *probe; - struct i2c_client *c; - unsigned char buf; + struct i2c_msg msg = { + .flags = I2C_M_RD, + .len = 0, + .buf = NULL, + }; int i, rc; switch (adap->id) { @@ -558,23 +561,17 @@ static int ir_probe(struct i2c_adapter *adap) return 0; } - c = kzalloc(sizeof(*c), GFP_KERNEL); - if (!c) - return -ENOMEM; - - c->adapter = adap; for (i = 0; -1 != probe[i]; i++) { - c->addr = probe[i]; - rc = i2c_master_recv(c, &buf, 0); + msg.addr = probe[i]; + rc = i2c_transfer(adap, &msg, 1); dprintk(1,"probe 0x%02x @ %s: %s\n", probe[i], adap->name, - (0 == rc) ? "yes" : "no"); - if (0 == rc) { + (1 == rc) ? "yes" : "no"); + if (1 == rc) { ir_attach(adap, probe[i], 0, 0); break; } } - kfree(c); return 0; } |