Commit be2b85a1 authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (5741): Tuner: add release callback

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: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 9ee476a5
...@@ -178,8 +178,11 @@ static void set_type(struct i2c_client *c, unsigned int type, ...@@ -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 */ /* discard private data, in case set_type() was previously called */
if (t->release)
t->release(c);
kfree(t->priv); kfree(t->priv);
t->priv = NULL; t->priv = NULL;
switch (t->type) { switch (t->type) {
case TUNER_MT2032: case TUNER_MT2032:
microtune_init(c); microtune_init(c);
...@@ -561,6 +564,8 @@ static int tuner_detach(struct i2c_client *client) ...@@ -561,6 +564,8 @@ static int tuner_detach(struct i2c_client *client)
return err; return err;
} }
if (t->release)
t->release(client);
kfree(t->priv); kfree(t->priv);
kfree(t); kfree(t);
return 0; return 0;
......
...@@ -215,6 +215,7 @@ struct tuner { ...@@ -215,6 +215,7 @@ struct tuner {
int (*get_afc)(struct i2c_client *c); int (*get_afc)(struct i2c_client *c);
void (*tuner_status)(struct i2c_client *c); void (*tuner_status)(struct i2c_client *c);
void (*standby)(struct i2c_client *c); void (*standby)(struct i2c_client *c);
void (*release)(struct i2c_client *c);
}; };
extern unsigned const int tuner_count; extern unsigned const int tuner_count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment