diff options
author | Jean Delvare <khali@linux-fr.org> | 2008-04-25 19:42:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-26 08:29:58 -0400 |
commit | 37c45df740f79c58bb0fc0de151fd2504234032b (patch) | |
tree | fa67e740835ab5600f078189e4d5e5519eecf059 /drivers/media/video/ir-kbd-i2c.c | |
parent | b33d24c4cc14ee40d83a7e1ea0bfb9567d6059aa (diff) |
V4L/DVB (7751): ir-kbd-i2c: Save a temporary memory allocation in ir_probe
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 'drivers/media/video/ir-kbd-i2c.c')
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 11c5fdedc23b..7b65f5e537f8 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -509,8 +509,11 @@ static int ir_probe(struct i2c_adapter *adap) | |||
509 | static const int probe_cx88[] = { 0x18, 0x6b, 0x71, -1 }; | 509 | static const int probe_cx88[] = { 0x18, 0x6b, 0x71, -1 }; |
510 | static const int probe_cx23885[] = { 0x6b, -1 }; | 510 | static const int probe_cx23885[] = { 0x6b, -1 }; |
511 | const int *probe; | 511 | const int *probe; |
512 | struct i2c_client *c; | 512 | struct i2c_msg msg = { |
513 | unsigned char buf; | 513 | .flags = I2C_M_RD, |
514 | .len = 0, | ||
515 | .buf = NULL, | ||
516 | }; | ||
514 | int i, rc; | 517 | int i, rc; |
515 | 518 | ||
516 | switch (adap->id) { | 519 | switch (adap->id) { |
@@ -536,23 +539,17 @@ static int ir_probe(struct i2c_adapter *adap) | |||
536 | return 0; | 539 | return 0; |
537 | } | 540 | } |
538 | 541 | ||
539 | c = kzalloc(sizeof(*c), GFP_KERNEL); | ||
540 | if (!c) | ||
541 | return -ENOMEM; | ||
542 | |||
543 | c->adapter = adap; | ||
544 | for (i = 0; -1 != probe[i]; i++) { | 542 | for (i = 0; -1 != probe[i]; i++) { |
545 | c->addr = probe[i]; | 543 | msg.addr = probe[i]; |
546 | rc = i2c_master_recv(c, &buf, 0); | 544 | rc = i2c_transfer(adap, &msg, 1); |
547 | dprintk(1,"probe 0x%02x @ %s: %s\n", | 545 | dprintk(1,"probe 0x%02x @ %s: %s\n", |
548 | probe[i], adap->name, | 546 | probe[i], adap->name, |
549 | (0 == rc) ? "yes" : "no"); | 547 | (1 == rc) ? "yes" : "no"); |
550 | if (0 == rc) { | 548 | if (1 == rc) { |
551 | ir_attach(adap, probe[i], 0, 0); | 549 | ir_attach(adap, probe[i], 0, 0); |
552 | break; | 550 | break; |
553 | } | 551 | } |
554 | } | 552 | } |
555 | kfree(c); | ||
556 | return 0; | 553 | return 0; |
557 | } | 554 | } |
558 | 555 | ||