summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-11-13 17:22:53 -0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-11-13 17:22:53 -0200
commita08c59762c341f4247d52bedd399077fcaac38d2 (patch)
tree24abf0b8e2f30dad590373822b160f633878c636
parentb137313916dc95b292637c22d1ad517add1b5a9b (diff)
downloadmediapointer-dvb-s2-a08c59762c341f4247d52bedd399077fcaac38d2.tar.gz
mediapointer-dvb-s2-a08c59762c341f4247d52bedd399077fcaac38d2.tar.bz2
tvaudio: use a direct reference for chip description
From: Mauro Carvalho Chehab <mchehab@redhat.com> 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. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--linux/drivers/media/video/tvaudio.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/linux/drivers/media/video/tvaudio.c b/linux/drivers/media/video/tvaudio.c
index 9fc2dfe75..1575e6f9d 100644
--- a/linux/drivers/media/video/tvaudio.c
+++ b/linux/drivers/media/video/tvaudio.c
@@ -115,8 +115,9 @@ static struct CHIPDESC chiplist[];
struct CHIPSTATE {
struct i2c_client *c;
- /* index into CHIPDESC array */
- int type;
+ /* chip-specific description - should point to
+ an entry at CHIPDESC table */
+ struct CHIPDESC *desc;
/* shadow register set */
audiocmd shadow;
@@ -267,7 +268,7 @@ static void chip_thread_wake(unsigned long data)
static int chip_thread(void *data)
{
struct CHIPSTATE *chip = data;
- struct CHIPDESC *desc = chiplist + chip->type;
+ struct CHIPDESC *desc = chip->desc;
int mode;
v4l_dbg(1, debug, chip->c, "%s: thread started\n", chip->c->name);
@@ -1095,7 +1096,7 @@ static int tda8425_shift12(int val) { return (val >> 12) | 0xf0; }
static int tda8425_initialize(struct CHIPSTATE *chip)
{
- struct CHIPDESC *desc = chiplist + chip->type;
+ struct CHIPDESC *desc = chip->desc;
int inputmap[4] = { /* tuner */ TDA8425_S1_CH2, /* radio */ TDA8425_S1_CH1,
/* extern */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF};
@@ -1515,7 +1516,7 @@ static int chip_probe(struct i2c_client *client, const struct i2c_device_id *id)
if (!id)
strlcpy(client->name, desc->name, I2C_NAME_SIZE);
#endif
- chip->type = desc-chiplist;
+ chip->desc = desc;
chip->shadow.count = desc->registers+1;
chip->prevmode = -1;
chip->audmode = V4L2_TUNER_MODE_LANG1;
@@ -1602,7 +1603,7 @@ static int chip_remove(struct i2c_client *client)
static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
struct v4l2_control *ctrl)
{
- struct CHIPDESC *desc = chiplist + chip->type;
+ struct CHIPDESC *desc = chip->desc;
switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
@@ -1642,7 +1643,7 @@ static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
static int tvaudio_set_ctrl(struct CHIPSTATE *chip,
struct v4l2_control *ctrl)
{
- struct CHIPDESC *desc = chiplist + chip->type;
+ struct CHIPDESC *desc = chip->desc;
switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
@@ -1718,7 +1719,7 @@ static int chip_command(struct i2c_client *client,
unsigned int cmd, void *arg)
{
struct CHIPSTATE *chip = i2c_get_clientdata(client);
- struct CHIPDESC *desc = chiplist + chip->type;
+ struct CHIPDESC *desc = chip->desc;
v4l_dbg(1, debug, chip->c, "%s: chip_command 0x%x\n", chip->c->name, cmd);