V4L/DVB (7127): tuner: remove dependency of tuner-core on tuner-types

This patch fully removes the dependency of tuner-core on
tuner-types.

There is no longer any need to pass struct tunertype in attach-time
config structure - instead pass the tuner type ID.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
Michael Krufky 2008-04-22 14:41:51 -03:00 committed by Mauro Carvalho Chehab
parent 65e8d29f7a
commit 060a5bd764
3 changed files with 10 additions and 22 deletions

View File

@ -313,18 +313,13 @@ static void tuner_i2c_address_check(struct tuner *t)
tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n"); tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n");
tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n"); tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n");
tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n", tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n",
t->i2c->adapter->name, t->i2c->addr, t->type, t->i2c->adapter->name, t->i2c->addr, t->type, t->i2c->name);
tuners[t->type].name);
tuner_warn("====================== WARNING! ======================\n"); tuner_warn("====================== WARNING! ======================\n");
} }
static void attach_simple_tuner(struct tuner *t) static inline void attach_simple_tuner(struct tuner *t)
{ {
struct simple_tuner_config cfg = { simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, t->type);
.type = t->type,
.tun = &tuners[t->type]
};
simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, &cfg);
} }
static void attach_tda829x(struct tuner *t) static void attach_tda829x(struct tuner *t)

View File

@ -684,7 +684,7 @@ static struct dvb_tuner_ops simple_tuner_ops = {
struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe, struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c_adap, struct i2c_adapter *i2c_adap,
u8 i2c_addr, u8 i2c_addr,
struct simple_tuner_config *cfg) unsigned int type)
{ {
struct tuner_simple_priv *priv = NULL; struct tuner_simple_priv *priv = NULL;
@ -701,15 +701,15 @@ struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe,
priv->i2c_props.addr = i2c_addr; priv->i2c_props.addr = i2c_addr;
priv->i2c_props.adap = i2c_adap; priv->i2c_props.adap = i2c_adap;
priv->type = cfg->type; priv->type = type;
priv->tun = cfg->tun; priv->tun = &tuners[type];
memcpy(&fe->ops.tuner_ops, &simple_tuner_ops, memcpy(&fe->ops.tuner_ops, &simple_tuner_ops,
sizeof(struct dvb_tuner_ops)); sizeof(struct dvb_tuner_ops));
tuner_info("type set to %d (%s)\n", cfg->type, cfg->tun->name); tuner_info("type set to %d (%s)\n", priv->type, priv->tun->name);
strlcpy(fe->ops.tuner_ops.info.name, cfg->tun->name, strlcpy(fe->ops.tuner_ops.info.name, priv->tun->name,
sizeof(fe->ops.tuner_ops.info.name)); sizeof(fe->ops.tuner_ops.info.name));
return fe; return fe;

View File

@ -20,23 +20,16 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include "dvb_frontend.h" #include "dvb_frontend.h"
struct simple_tuner_config
{
/* chip type */
unsigned int type;
struct tunertype *tun;
};
#if defined(CONFIG_TUNER_SIMPLE) || (defined(CONFIG_TUNER_SIMPLE_MODULE) && defined(MODULE)) #if defined(CONFIG_TUNER_SIMPLE) || (defined(CONFIG_TUNER_SIMPLE_MODULE) && defined(MODULE))
extern struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe, extern struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c_adap, struct i2c_adapter *i2c_adap,
u8 i2c_addr, u8 i2c_addr,
struct simple_tuner_config *cfg); unsigned int type);
#else #else
static inline struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe, static inline struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c_adap, struct i2c_adapter *i2c_adap,
u8 i2c_addr, u8 i2c_addr,
struct simple_tuner_config *cfg) unsigned int type)
{ {
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
return NULL; return NULL;