diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-07-28 23:10:41 +0100 |
---|---|---|
committer | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-07-28 23:10:41 +0100 |
commit | 401232ba8026e33a71183d3c80a83b53b3ef6ee4 (patch) | |
tree | 597575847989714d163281f4cdab33ad36ad42c3 /linux/drivers/media/dvb/dvb-core | |
parent | 9fdfcc1df7ba94e30044857638249b0194003335 (diff) | |
download | mediapointer-dvb-s2-401232ba8026e33a71183d3c80a83b53b3ef6ee4.tar.gz mediapointer-dvb-s2-401232ba8026e33a71183d3c80a83b53b3ef6ee4.tar.bz2 |
Refactor dvb_detach calls into a single dvb_frontend_detach function.
From: Andrew de Quincey <adq_dvb@lidskialf.net>
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>
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 32 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_frontend.h | 2 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvbdev.h | 32 |
3 files changed, 34 insertions, 32 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index 35bebb267..ba5ffa981 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -1118,3 +1118,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/linux/drivers/media/dvb/dvb-core/dvb_frontend.h b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h index 6bea01af4..e5d5028b3 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h +++ b/linux/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/linux/drivers/media/dvb/dvb-core/dvbdev.h b/linux/drivers/media/dvb/dvb-core/dvbdev.h index 1375d3a8e..26e4a9135 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.h +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.h @@ -103,8 +103,6 @@ extern int dvb_usercopy(struct inode *inode, struct file *file, int (*func)(struct inode *inode, struct file *file, unsigned int cmd, void *arg)); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)) - /** generic DVB attach function. */ #ifdef CONFIG_DVB_CORE_ATTACH #define dvb_attach(FUNCTION, ARGS...) ({ \ @@ -120,41 +118,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 - -#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_ */ |