V4L/DVB (5741): Tuner: add release callback
authorMichael Krufky <mkrufky@linuxtv.org>
Mon, 4 Jun 2007 17:40:27 +0000 (14:40 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 18 Jul 2007 17:23:54 +0000 (14:23 -0300)
Individual tuner drivers are now allocating memory themselves for
their own private data structures.  This changeset adds a release
callback to the tuner operations, so that newer drivers that may
require more complex data structures may release this private data
themselves.

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

index 4369f6d1249961d09f13facd04900feec6358c62..0e71a22f1d4f6cff2f265e796fa1ad454fb002ac 100644 (file)
@@ -178,8 +178,11 @@ static void set_type(struct i2c_client *c, unsigned int type,
        }
 
        /* discard private data, in case set_type() was previously called */
+       if (t->release)
+               t->release(c);
        kfree(t->priv);
        t->priv = NULL;
+
        switch (t->type) {
        case TUNER_MT2032:
                microtune_init(c);
@@ -561,6 +564,8 @@ static int tuner_detach(struct i2c_client *client)
                return err;
        }
 
+       if (t->release)
+               t->release(client);
        kfree(t->priv);
        kfree(t);
        return 0;
index b901373c6e109eb06206f9c42f7e85d9aefddc47..da821a027e76001e34020eb4ec0af40c87ee354b 100644 (file)
@@ -215,6 +215,7 @@ struct tuner {
        int  (*get_afc)(struct i2c_client *c);
        void (*tuner_status)(struct i2c_client *c);
        void (*standby)(struct i2c_client *c);
+       void (*release)(struct i2c_client *c);
 };
 
 extern unsigned const int tuner_count;