aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/cx231xx
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2014-10-02 01:20:53 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-10-30 15:10:07 -0400
commit7c894a3b34abd6f8695fc68ff2b009172fb0fab2 (patch)
treea5282f50df0086bd3e6430c52e8f7dbbb03872b9 /drivers/media/usb/cx231xx
parent37fa8716e2d4c4155205aa4a904835de09edbb88 (diff)
[media] cx231xx: let i2c bus scanning use its own i2c_client
This is a preparation for deleting the otherwise useless i2c_clients that are allocated for all the i2c master adapters. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/cx231xx')
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-i2c.c17
-rw-r--r--drivers/media/usb/cx231xx/cx231xx.h2
2 files changed, 12 insertions, 7 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index 7c0f797f1057..67a13912fbe8 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -480,22 +480,27 @@ static char *i2c_devs[128] = {
480 * cx231xx_do_i2c_scan() 480 * cx231xx_do_i2c_scan()
481 * check i2c address range for devices 481 * check i2c address range for devices
482 */ 482 */
483void cx231xx_do_i2c_scan(struct cx231xx *dev, struct i2c_client *c) 483void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)
484{ 484{
485 unsigned char buf; 485 unsigned char buf;
486 int i, rc; 486 int i, rc;
487 struct i2c_client client;
487 488
488 cx231xx_info(": Checking for I2C devices ..\n"); 489 memset(&client, 0, sizeof(client));
490 client.adapter = &dev->i2c_bus[i2c_port].i2c_adap;
491
492 cx231xx_info(": Checking for I2C devices on port=%d ..\n", i2c_port);
489 for (i = 0; i < 128; i++) { 493 for (i = 0; i < 128; i++) {
490 c->addr = i; 494 client.addr = i;
491 rc = i2c_master_recv(c, &buf, 0); 495 rc = i2c_master_recv(&client, &buf, 0);
492 if (rc < 0) 496 if (rc < 0)
493 continue; 497 continue;
494 cx231xx_info("%s: i2c scan: found device @ 0x%x [%s]\n", 498 cx231xx_info("%s: i2c scan: found device @ 0x%x [%s]\n",
495 dev->name, i << 1, 499 dev->name, i << 1,
496 i2c_devs[i] ? i2c_devs[i] : "???"); 500 i2c_devs[i] ? i2c_devs[i] : "???");
497 } 501 }
498 cx231xx_info(": Completed Checking for I2C devices.\n"); 502 cx231xx_info(": Completed Checking for I2C devices on port=%d.\n",
503 i2c_port);
499} 504}
500 505
501/* 506/*
@@ -522,7 +527,7 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)
522 527
523 if (0 == bus->i2c_rc) { 528 if (0 == bus->i2c_rc) {
524 if (i2c_scan) 529 if (i2c_scan)
525 cx231xx_do_i2c_scan(dev, &bus->i2c_client); 530 cx231xx_do_i2c_scan(dev, bus->nr);
526 } else 531 } else
527 cx231xx_warn("%s: i2c bus %d register FAILED\n", 532 cx231xx_warn("%s: i2c bus %d register FAILED\n",
528 dev->name, bus->nr); 533 dev->name, bus->nr);
diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h
index aeb1bf42b88d..5efc93efe96d 100644
--- a/drivers/media/usb/cx231xx/cx231xx.h
+++ b/drivers/media/usb/cx231xx/cx231xx.h
@@ -751,7 +751,7 @@ int cx231xx_set_analog_freq(struct cx231xx *dev, u32 freq);
751int cx231xx_reset_analog_tuner(struct cx231xx *dev); 751int cx231xx_reset_analog_tuner(struct cx231xx *dev);
752 752
753/* Provided by cx231xx-i2c.c */ 753/* Provided by cx231xx-i2c.c */
754void cx231xx_do_i2c_scan(struct cx231xx *dev, struct i2c_client *c); 754void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port);
755int cx231xx_i2c_register(struct cx231xx_i2c *bus); 755int cx231xx_i2c_register(struct cx231xx_i2c *bus);
756int cx231xx_i2c_unregister(struct cx231xx_i2c *bus); 756int cx231xx_i2c_unregister(struct cx231xx_i2c *bus);
757 757