diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-08-08 09:10:09 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 11:53:29 -0300 |
commit | f52a838b74be70b4054ab27e435e9acb92d8c50a (patch) | |
tree | 81b9b3dff85a069781244636c0a4cf29f0220d86 /drivers/media/dvb/dvb-core | |
parent | 2a514dea5fda67958c79f5137d4dcb272f8561e8 (diff) |
V4L/DVB (4391): Refactor dvb_detach calls into a single dvb_frontend_detach function.
Remove buggy dvb_detach() macro and replace with unified
dvb_frontend_detach() call.
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-core')
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 32 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.h | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvbdev.h | 18 |
3 files changed, 34 insertions, 18 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index d544731bed7..86dadc71cd6 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -1112,3 +1112,35 @@ int dvb_unregister_frontend(struct dvb_frontend* fe) return 0; } EXPORT_SYMBOL(dvb_unregister_frontend); + +#ifdef CONFIG_DVB_DETACH +void dvb_frontend_detach(struct dvb_frontend* fe) +{ + void *ptr; + + if (fe->ops.release_sec) { + fe->ops.release_sec(fe); + symbol_put_addr(fe->ops.release_sec); + } + if (fe->ops.tuner_ops.release) { + fe->ops.tuner_ops.release(fe); + symbol_put_addr(fe->ops.tuner_ops.release); + } + ptr = (void*)fe->ops.release; + if (ptr) { + fe->ops.release(fe); + symbol_put_addr(ptr); + } +} +#else +void dvb_frontend_detach(struct dvb_frontend* fe) +{ + if (fe->ops.release_sec) + fe->ops.release_sec(fe); + if (fe->ops.tuner_ops.release) + fe->ops.tuner_ops.release(fe); + if (fe->ops.release) + fe->ops.release(fe); +} +#endif +EXPORT_SYMBOL(dvb_frontend_detach); diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h index 6bea01af440..e5d5028b369 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.h +++ b/drivers/media/dvb/dvb-core/dvb_frontend.h @@ -158,6 +158,8 @@ extern int dvb_register_frontend(struct dvb_adapter* dvb, extern int dvb_unregister_frontend(struct dvb_frontend* fe); +extern void dvb_frontend_detach(struct dvb_frontend* fe); + extern void dvb_frontend_reinitialise(struct dvb_frontend *fe); extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec); diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h index 66d91e530f8..620e7887b3d 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.h +++ b/drivers/media/dvb/dvb-core/dvbdev.h @@ -102,7 +102,6 @@ extern int dvb_usercopy(struct inode *inode, struct file *file, int (*func)(struct inode *inode, struct file *file, unsigned int cmd, void *arg)); - /** generic DVB attach function. */ #ifdef CONFIG_DVB_CORE_ATTACH #define dvb_attach(FUNCTION, ARGS...) ({ \ @@ -118,28 +117,11 @@ extern int dvb_usercopy(struct inode *inode, struct file *file, __r; \ }) -#define dvb_detach(FUNCPTR, ARGS...) ({ \ - typeof((FUNCPTR)) __funcptrtmp = FUNCPTR; \ - if (__funcptrtmp) { \ - __funcptrtmp(ARGS); \ - symbol_put_addr(__funcptrtmp); \ - } \ - FUNCPTR = NULL; \ -}) - #else #define dvb_attach(FUNCTION, ARGS...) ({ \ FUNCTION(ARGS); \ }) -#define dvb_detach(FUNCPTR, ARGS...) \ -do { \ - if (FUNCPTR) \ - FUNCPTR(ARGS); \ - FUNCPTR = NULL; \ -} while(0) - #endif - #endif /* #ifndef _DVBDEV_H_ */ |