From bb405e67fb21e8fcb183d942f7978fabd5d4a8cf Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 30 Jan 2011 09:03:24 -0300 Subject: [PATCH] --- yaml --- r: 241839 b: refs/heads/master c: 3f25ffa2cd946333d29a668993f5aa78e9b56a02 h: refs/heads/master i: 241837: 42f9f900f266c1aec924602cb03106cbc67b07c8 241835: dc8e0e7ba425eda34ea48125ab4a7f91c9adc22c 241831: e7145cd0303d575c4d8d0ca8a0ffde73f4167dcd 241823: 1616877fe6762760289224328275e5a5d38ddf69 v: v3 --- [refs] | 2 +- .../drivers/media/video/cx231xx/cx231xx-i2c.c | 31 ++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index dede5f061479..29201ce17fd2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8bb84227d1ba41d6c1ec9350a4424ece5fe00e33 +refs/heads/master: 3f25ffa2cd946333d29a668993f5aa78e9b56a02 diff --git a/trunk/drivers/media/video/cx231xx/cx231xx-i2c.c b/trunk/drivers/media/video/cx231xx/cx231xx-i2c.c index 835670623dfb..925f3a04e53c 100644 --- a/trunk/drivers/media/video/cx231xx/cx231xx-i2c.c +++ b/trunk/drivers/media/video/cx231xx/cx231xx-i2c.c @@ -54,6 +54,21 @@ do { \ } \ } while (0) +static inline bool is_tuner(struct cx231xx *dev, struct cx231xx_i2c *bus, + const struct i2c_msg *msg, int tuner_type) +{ + if (bus->nr != dev->board.tuner_i2c_master) + return false; + + if (msg->addr != dev->board.tuner_addr) + return false; + + if (dev->tuner_type != tuner_type) + return false; + + return true; +} + /* * cx231xx_i2c_send_bytes() */ @@ -71,9 +86,7 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, u16 saddr = 0; u8 need_gpio = 0; - if ((bus->nr == 1) && (msg->addr == 0x61) - && (dev->tuner_type == TUNER_XC5000)) { - + if (is_tuner(dev, bus, msg, TUNER_XC5000)) { size = msg->len; if (size == 2) { /* register write sub addr */ @@ -180,9 +193,7 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap, u16 saddr = 0; u8 need_gpio = 0; - if ((bus->nr == 1) && (msg->addr == 0x61) - && dev->tuner_type == TUNER_XC5000) { - + if (is_tuner(dev, bus, msg, TUNER_XC5000)) { if (msg->len == 2) saddr = msg->buf[0] << 8 | msg->buf[1]; else if (msg->len == 1) @@ -274,9 +285,7 @@ static int cx231xx_i2c_recv_bytes_with_saddr(struct i2c_adapter *i2c_adap, else if (msg1->len == 1) saddr = msg1->buf[0]; - if ((bus->nr == 1) && (msg2->addr == 0x61) - && dev->tuner_type == TUNER_XC5000) { - + if (is_tuner(dev, bus, msg2, TUNER_XC5000)) { if ((msg2->len < 16)) { dprintk1(1, @@ -454,8 +463,8 @@ static char *i2c_devs[128] = { [0x32 >> 1] = "GeminiIII", [0x02 >> 1] = "Aquarius", [0xa0 >> 1] = "eeprom", - [0xc0 >> 1] = "tuner/XC3028", - [0xc2 >> 1] = "tuner/XC5000", + [0xc0 >> 1] = "tuner", + [0xc2 >> 1] = "tuner", }; /*