Commit 967d8e8f authored by Max Kellermann's avatar Max Kellermann Committed by Mauro Carvalho Chehab

[media] dvb_frontend: merge the two dvb_frontend_detach() versions

This code duplication is confusing and error prone.  Let's merge them
by moving the release/dvb_detach call into one function with one
Signed-off-by: default avatarMax Kellermann <max.kellermann@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 194ced7a
...@@ -2740,40 +2740,22 @@ int dvb_unregister_frontend(struct dvb_frontend* fe) ...@@ -2740,40 +2740,22 @@ int dvb_unregister_frontend(struct dvb_frontend* fe)
} }
EXPORT_SYMBOL(dvb_unregister_frontend); EXPORT_SYMBOL(dvb_unregister_frontend);
#ifdef CONFIG_MEDIA_ATTACH static void dvb_frontend_invoke_release(struct dvb_frontend *fe,
void dvb_frontend_detach(struct dvb_frontend* fe) void (*release)(struct dvb_frontend *fe))
{ {
void *ptr; if (release) {
release(fe);
if (fe->ops.release_sec) { #ifdef CONFIG_MEDIA_ATTACH
fe->ops.release_sec(fe); dvb_detach(release);
dvb_detach(fe->ops.release_sec); #endif
}
if (fe->ops.tuner_ops.release) {
fe->ops.tuner_ops.release(fe);
dvb_detach(fe->ops.tuner_ops.release);
}
if (fe->ops.analog_ops.release) {
fe->ops.analog_ops.release(fe);
dvb_detach(fe->ops.analog_ops.release);
}
ptr = (void*)fe->ops.release;
if (ptr) {
fe->ops.release(fe);
dvb_detach(ptr);
} }
} }
#else
void dvb_frontend_detach(struct dvb_frontend* fe) void dvb_frontend_detach(struct dvb_frontend* fe)
{ {
if (fe->ops.release_sec) dvb_frontend_invoke_release(fe, fe->ops.release_sec);
fe->ops.release_sec(fe); dvb_frontend_invoke_release(fe, fe->ops.tuner_ops.release);
if (fe->ops.tuner_ops.release) dvb_frontend_invoke_release(fe, fe->ops.analog_ops.release);
fe->ops.tuner_ops.release(fe); dvb_frontend_invoke_release(fe, fe->ops.release);
if (fe->ops.analog_ops.release)
fe->ops.analog_ops.release(fe);
if (fe->ops.release)
fe->ops.release(fe);
} }
#endif
EXPORT_SYMBOL(dvb_frontend_detach); EXPORT_SYMBOL(dvb_frontend_detach);
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