diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-05-29 21:54:06 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-18 13:23:48 -0400 |
commit | b208319993ceff7ebfcc6bb914fe94d29e48a891 (patch) | |
tree | 0a0697806b221c7711914dbdfe2bd3972c206b23 /drivers/media/video/tda9887.c | |
parent | 56584c9ea9a6dcd672f97ebfeebc4903e8b903bc (diff) |
V4L/DVB (5719): Tuner: Move device-specific private data out of tuner struct
Create private data struct for device specific private data.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tda9887.c')
-rw-r--r-- | drivers/media/video/tda9887.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index fde576f1101..01f18b07d01 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -29,6 +29,9 @@ | |||
29 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.name, \ | 29 | printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.name, \ |
30 | i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) | 30 | i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0) |
31 | 31 | ||
32 | struct tda9887_priv { | ||
33 | unsigned char data[4]; | ||
34 | }; | ||
32 | 35 | ||
33 | /* ---------------------------------------------------------------------- */ | 36 | /* ---------------------------------------------------------------------- */ |
34 | 37 | ||
@@ -508,10 +511,11 @@ static int tda9887_status(struct tuner *t) | |||
508 | static void tda9887_configure(struct i2c_client *client) | 511 | static void tda9887_configure(struct i2c_client *client) |
509 | { | 512 | { |
510 | struct tuner *t = i2c_get_clientdata(client); | 513 | struct tuner *t = i2c_get_clientdata(client); |
514 | struct tda9887_priv *priv = t->priv; | ||
511 | int rc; | 515 | int rc; |
512 | 516 | ||
513 | memset(t->tda9887_data,0,sizeof(t->tda9887_data)); | 517 | memset(priv->data,0,sizeof(priv->data)); |
514 | tda9887_set_tvnorm(t,t->tda9887_data); | 518 | tda9887_set_tvnorm(t,priv->data); |
515 | 519 | ||
516 | /* A note on the port settings: | 520 | /* A note on the port settings: |
517 | These settings tend to depend on the specifics of the board. | 521 | These settings tend to depend on the specifics of the board. |
@@ -526,22 +530,22 @@ static void tda9887_configure(struct i2c_client *client) | |||
526 | the ports should be set to active (0), but, again, that may | 530 | the ports should be set to active (0), but, again, that may |
527 | differ depending on the precise hardware configuration. | 531 | differ depending on the precise hardware configuration. |
528 | */ | 532 | */ |
529 | t->tda9887_data[1] |= cOutputPort1Inactive; | 533 | priv->data[1] |= cOutputPort1Inactive; |
530 | t->tda9887_data[1] |= cOutputPort2Inactive; | 534 | priv->data[1] |= cOutputPort2Inactive; |
531 | 535 | ||
532 | tda9887_set_config(t,t->tda9887_data); | 536 | tda9887_set_config(t,priv->data); |
533 | tda9887_set_insmod(t,t->tda9887_data); | 537 | tda9887_set_insmod(t,priv->data); |
534 | 538 | ||
535 | if (t->mode == T_STANDBY) { | 539 | if (t->mode == T_STANDBY) { |
536 | t->tda9887_data[1] |= cForcedMuteAudioON; | 540 | priv->data[1] |= cForcedMuteAudioON; |
537 | } | 541 | } |
538 | 542 | ||
539 | tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", | 543 | tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", |
540 | t->tda9887_data[1],t->tda9887_data[2],t->tda9887_data[3]); | 544 | priv->data[1],priv->data[2],priv->data[3]); |
541 | if (tuner_debug > 1) | 545 | if (tuner_debug > 1) |
542 | dump_write_message(t, t->tda9887_data); | 546 | dump_write_message(t, priv->data); |
543 | 547 | ||
544 | if (4 != (rc = i2c_master_send(&t->i2c,t->tda9887_data,4))) | 548 | if (4 != (rc = i2c_master_send(&t->i2c,priv->data,4))) |
545 | tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc); | 549 | tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc); |
546 | 550 | ||
547 | if (tuner_debug > 2) { | 551 | if (tuner_debug > 2) { |
@@ -555,7 +559,8 @@ static void tda9887_configure(struct i2c_client *client) | |||
555 | static void tda9887_tuner_status(struct i2c_client *client) | 559 | static void tda9887_tuner_status(struct i2c_client *client) |
556 | { | 560 | { |
557 | struct tuner *t = i2c_get_clientdata(client); | 561 | struct tuner *t = i2c_get_clientdata(client); |
558 | tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", t->tda9887_data[1], t->tda9887_data[2], t->tda9887_data[3]); | 562 | struct tda9887_priv *priv = t->priv; |
563 | tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", priv->data[1], priv->data[2], priv->data[3]); | ||
559 | } | 564 | } |
560 | 565 | ||
561 | static int tda9887_get_afc(struct i2c_client *client) | 566 | static int tda9887_get_afc(struct i2c_client *client) |
@@ -588,8 +593,14 @@ static void tda9887_set_freq(struct i2c_client *client, unsigned int freq) | |||
588 | 593 | ||
589 | int tda9887_tuner_init(struct i2c_client *c) | 594 | int tda9887_tuner_init(struct i2c_client *c) |
590 | { | 595 | { |
596 | struct tda9887_priv *priv = NULL; | ||
591 | struct tuner *t = i2c_get_clientdata(c); | 597 | struct tuner *t = i2c_get_clientdata(c); |
592 | 598 | ||
599 | priv = kzalloc(sizeof(struct tda9887_priv), GFP_KERNEL); | ||
600 | if (priv == NULL) | ||
601 | return -ENOMEM; | ||
602 | t->priv = priv; | ||
603 | |||
593 | strlcpy(c->name, "tda9887", sizeof(c->name)); | 604 | strlcpy(c->name, "tda9887", sizeof(c->name)); |
594 | 605 | ||
595 | tda9887_info("tda988[5/6/7] found @ 0x%x (%s)\n", t->i2c.addr, | 606 | tda9887_info("tda988[5/6/7] found @ 0x%x (%s)\n", t->i2c.addr, |