aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-11-13 14:22:53 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-11-14 11:24:45 -0500
commit81cb5c4f7fbe6971d9c61401bc47193290fd59b7 (patch)
treeb30b928f43124a8d5205a16ad7371127893583e4 /drivers
parentb4ab114cf750a49d91fc292439f8ef69a35a0fab (diff)
V4L/DVB (9620): tvaudio: use a direct reference for chip description
Instead of storing the pointer for the proper entry at chip description table, the driver were storing an indirect reference, by using an index. Better to reference directly the data. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/tvaudio.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index ee6aca4ccd9f..5ec369d54e6e 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -112,8 +112,9 @@ static struct CHIPDESC chiplist[];
112struct CHIPSTATE { 112struct CHIPSTATE {
113 struct i2c_client *c; 113 struct i2c_client *c;
114 114
115 /* index into CHIPDESC array */ 115 /* chip-specific description - should point to
116 int type; 116 an entry at CHIPDESC table */
117 struct CHIPDESC *desc;
117 118
118 /* shadow register set */ 119 /* shadow register set */
119 audiocmd shadow; 120 audiocmd shadow;
@@ -264,7 +265,7 @@ static void chip_thread_wake(unsigned long data)
264static int chip_thread(void *data) 265static int chip_thread(void *data)
265{ 266{
266 struct CHIPSTATE *chip = data; 267 struct CHIPSTATE *chip = data;
267 struct CHIPDESC *desc = chiplist + chip->type; 268 struct CHIPDESC *desc = chip->desc;
268 int mode; 269 int mode;
269 270
270 v4l_dbg(1, debug, chip->c, "%s: thread started\n", chip->c->name); 271 v4l_dbg(1, debug, chip->c, "%s: thread started\n", chip->c->name);
@@ -1087,7 +1088,7 @@ static int tda8425_shift12(int val) { return (val >> 12) | 0xf0; }
1087 1088
1088static int tda8425_initialize(struct CHIPSTATE *chip) 1089static int tda8425_initialize(struct CHIPSTATE *chip)
1089{ 1090{
1090 struct CHIPDESC *desc = chiplist + chip->type; 1091 struct CHIPDESC *desc = chip->desc;
1091 int inputmap[4] = { /* tuner */ TDA8425_S1_CH2, /* radio */ TDA8425_S1_CH1, 1092 int inputmap[4] = { /* tuner */ TDA8425_S1_CH2, /* radio */ TDA8425_S1_CH1,
1092 /* extern */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF}; 1093 /* extern */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF};
1093 1094
@@ -1503,7 +1504,7 @@ static int chip_probe(struct i2c_client *client, const struct i2c_device_id *id)
1503 /* fill required data structures */ 1504 /* fill required data structures */
1504 if (!id) 1505 if (!id)
1505 strlcpy(client->name, desc->name, I2C_NAME_SIZE); 1506 strlcpy(client->name, desc->name, I2C_NAME_SIZE);
1506 chip->type = desc-chiplist; 1507 chip->desc = desc;
1507 chip->shadow.count = desc->registers+1; 1508 chip->shadow.count = desc->registers+1;
1508 chip->prevmode = -1; 1509 chip->prevmode = -1;
1509 chip->audmode = V4L2_TUNER_MODE_LANG1; 1510 chip->audmode = V4L2_TUNER_MODE_LANG1;
@@ -1590,7 +1591,7 @@ static int chip_remove(struct i2c_client *client)
1590static int tvaudio_get_ctrl(struct CHIPSTATE *chip, 1591static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
1591 struct v4l2_control *ctrl) 1592 struct v4l2_control *ctrl)
1592{ 1593{
1593 struct CHIPDESC *desc = chiplist + chip->type; 1594 struct CHIPDESC *desc = chip->desc;
1594 1595
1595 switch (ctrl->id) { 1596 switch (ctrl->id) {
1596 case V4L2_CID_AUDIO_MUTE: 1597 case V4L2_CID_AUDIO_MUTE:
@@ -1630,7 +1631,7 @@ static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
1630static int tvaudio_set_ctrl(struct CHIPSTATE *chip, 1631static int tvaudio_set_ctrl(struct CHIPSTATE *chip,
1631 struct v4l2_control *ctrl) 1632 struct v4l2_control *ctrl)
1632{ 1633{
1633 struct CHIPDESC *desc = chiplist + chip->type; 1634 struct CHIPDESC *desc = chip->desc;
1634 1635
1635 switch (ctrl->id) { 1636 switch (ctrl->id) {
1636 case V4L2_CID_AUDIO_MUTE: 1637 case V4L2_CID_AUDIO_MUTE:
@@ -1706,7 +1707,7 @@ static int chip_command(struct i2c_client *client,
1706 unsigned int cmd, void *arg) 1707 unsigned int cmd, void *arg)
1707{ 1708{
1708 struct CHIPSTATE *chip = i2c_get_clientdata(client); 1709 struct CHIPSTATE *chip = i2c_get_clientdata(client);
1709 struct CHIPDESC *desc = chiplist + chip->type; 1710 struct CHIPDESC *desc = chip->desc;
1710 1711
1711 v4l_dbg(1, debug, chip->c, "%s: chip_command 0x%x\n", chip->c->name, cmd); 1712 v4l_dbg(1, debug, chip->c, "%s: chip_command 0x%x\n", chip->c->name, cmd);
1712 1713