diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-08-08 09:10:08 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 11:53:24 -0300 |
commit | d995506062c974133ba66d0822e58a923d4d74d9 (patch) | |
tree | 160bfd17a7c96276f3543960c66b9d46b559d98d /drivers/media/dvb/dvb-core/dvbdev.h | |
parent | c10d14d62d7b7596fd5c7bb8aad3f2b56f8640e6 (diff) | |
download | kernel_goldelico_gta04-d995506062c974133ba66d0822e58a923d4d74d9.zip kernel_goldelico_gta04-d995506062c974133ba66d0822e58a923d4d74d9.tar.gz kernel_goldelico_gta04-d995506062c974133ba66d0822e58a923d4d74d9.tar.bz2 |
V4L/DVB (4385): Add dvb_attach() macro and supporting routines
Add dvb_attach() macro and supporting routines
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: Michael Krufky <mkrufky@linuxtv.org>
Acked-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-core/dvbdev.h')
-rw-r--r-- | drivers/media/dvb/dvb-core/dvbdev.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h index 7a7f75f..66d91e5 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.h +++ b/drivers/media/dvb/dvb-core/dvbdev.h @@ -102,4 +102,44 @@ 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...) ({ \ + void *__r = NULL; \ + typeof(&FUNCTION) __a = symbol_request(FUNCTION); \ + if (__a) { \ + __r = (void *) __a(ARGS); \ + if (__r == NULL) \ + symbol_put(FUNCTION); \ + } else { \ + printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \ + } \ + __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_ */ |