]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
V4L/DVB (7126): tuner: move tuner type ID check to simple_tuner_attach
authorMichael Krufky <mkrufky@linuxtv.org>
Tue, 22 Apr 2008 17:41:50 +0000 (14:41 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 16:42:23 +0000 (13:42 -0300)
Move tuner type ID check from tuner-core::set_type to simple_tuner_attach.

Since tuner-core forwards all attach requests to tuner-simple as the
default case, unless a specific attach function is specified in
set_type, this change is an appropriate cleanup.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/tuner-core.c
drivers/media/video/tuner-simple.c

index 770dbcbecb63309afb5edb784c0fb6469deace48..4d791766ce11feb93e5f4019c150c98e5f682d4f 100644 (file)
@@ -352,11 +352,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
                return;
        }
 
-       if (type >= tuner_count) {
-               tuner_warn ("tuner 0x%02x: Tuner count greater than %d\n",c->addr,tuner_count);
-               return;
-       }
-
        t->type = type;
        t->config = new_config;
        if (tuner_callback != NULL) {
index 85556d44c8abbb3087a78e713e766f433fa2e7ac..d3362703e2582a7515e7d0f93bd0f0bf04e1fea4 100644 (file)
@@ -688,6 +688,12 @@ struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe,
 {
        struct tuner_simple_priv *priv = NULL;
 
+       if (type >= tuner_count) {
+               printk(KERN_WARNING "%s: invalid tuner type: %d (max: %d)\n",
+                      __FUNCTION__, type, tuner_count-1);
+               return NULL;
+       }
+
        priv = kzalloc(sizeof(struct tuner_simple_priv), GFP_KERNEL);
        if (priv == NULL)
                return NULL;