From 775f85f9f968985c9b5c9e6df137575a118fdf76 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Mon, 4 Jun 2007 13:40:27 -0400 Subject: tuner: add release callback From: Michael Krufky 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 --- linux/drivers/media/video/tuner-core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media/video') diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 969890f90..d2c946e2a 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -204,11 +204,12 @@ static void set_type(struct i2c_client *c, unsigned int type, } #endif -#if 1 /* discard private data, in case set_type() was previously called */ + if (t->release) + t->release(c); kfree(t->priv); t->priv = NULL; -#endif + switch (t->type) { case TUNER_MT2032: microtune_init(c); @@ -620,6 +621,8 @@ static int tuner_detach(struct i2c_client *client) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) MOD_DEC_USE_COUNT; #endif + if (t->release) + t->release(client); kfree(t->priv); #if 0 t->priv = NULL; -- cgit v1.2.3