summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-07-28 23:10:17 +0100
committerAndrew de Quincey <adq_dvb@lidskialf.net>2006-07-28 23:10:17 +0100
commit52eaaa8dff6907aae78b53fc2944769bf03cddc8 (patch)
tree62125344254ad6c8d4879a83281f13e47e739aac /linux/drivers/media/dvb
parent830851182365a2c7ecd43f52d45ad5afe98f73c1 (diff)
downloadmediapointer-dvb-s2-52eaaa8dff6907aae78b53fc2944769bf03cddc8.tar.gz
mediapointer-dvb-s2-52eaaa8dff6907aae78b53fc2944769bf03cddc8.tar.bz2
Add dvb_attach() macro and supporting routines
From: Andrew de Quincey <adq_dvb@lidskialf.net> 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>
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r--linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c2
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c12
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvbdev.h54
3 files changed, 56 insertions, 12 deletions
diff --git a/linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
index 150e75082..0647973a6 100644
--- a/linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
+++ b/linux/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
@@ -538,7 +538,7 @@ int flexcop_frontend_init(struct flexcop_device *fc)
/* try the air atsc 2nd generation (nxt2002) */
if ((fc->fe = nxt200x_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) {
fc->dev_type = FC_AIR_ATSC2;
- dvb_pll_attach(fc->fe, 0x61, &fc->i2c_adap, &dvb_pll_samsung_tbmv);
+ dvb_attach(dvb_pll_attach, fc->fe, 0x61, &fc->i2c_adap, &dvb_pll_samsung_tbmv);
info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address);
} else
/* try the air atsc 3nd generation (lgdt3303) */
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
index 46e16f8b3..35bebb267 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1111,17 +1111,7 @@ int dvb_unregister_frontend(struct dvb_frontend* fe)
mutex_lock(&frontend_mutex);
dvb_unregister_device (fepriv->dvbdev);
dvb_frontend_stop (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.i2c_gate_ctrl)
- fe->ops.i2c_gate_ctrl(fe, 0);
- }
- if (fe->ops.release)
- fe->ops.release(fe);
- else
- printk("dvb_frontend: Demodulator (%s) does not have a release callback!\n", fe->ops.info.name);
+
/* fe is invalid now */
kfree(fepriv);
mutex_unlock(&frontend_mutex);
diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.h b/linux/drivers/media/dvb/dvb-core/dvbdev.h
index 1e7c036d5..1375d3a8e 100644
--- a/linux/drivers/media/dvb/dvb-core/dvbdev.h
+++ b/linux/drivers/media/dvb/dvb-core/dvbdev.h
@@ -103,4 +103,58 @@ 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...) ({ \
+ 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
+
+#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_ */