diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-08-08 08:10:08 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 10:53:24 -0400 |
commit | d995506062c974133ba66d0822e58a923d4d74d9 (patch) | |
tree | 160bfd17a7c96276f3543960c66b9d46b559d98d | |
parent | c10d14d62d7b7596fd5c7bb8aad3f2b56f8640e6 (diff) |
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>
-rw-r--r-- | drivers/media/dvb/b2c2/flexcop-fe-tuner.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 12 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvbdev.h | 40 |
3 files changed, 42 insertions, 12 deletions
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index 3be87c72e37b..816e700ae14b 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c | |||
@@ -527,7 +527,7 @@ int flexcop_frontend_init(struct flexcop_device *fc) | |||
527 | /* try the air atsc 2nd generation (nxt2002) */ | 527 | /* try the air atsc 2nd generation (nxt2002) */ |
528 | if ((fc->fe = nxt200x_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) { | 528 | if ((fc->fe = nxt200x_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) { |
529 | fc->dev_type = FC_AIR_ATSC2; | 529 | fc->dev_type = FC_AIR_ATSC2; |
530 | dvb_pll_attach(fc->fe, 0x61, &fc->i2c_adap, &dvb_pll_samsung_tbmv); | 530 | dvb_attach(dvb_pll_attach, fc->fe, 0x61, &fc->i2c_adap, &dvb_pll_samsung_tbmv); |
531 | info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); | 531 | info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); |
532 | } else | 532 | } else |
533 | /* try the air atsc 3nd generation (lgdt3303) */ | 533 | /* try the air atsc 3nd generation (lgdt3303) */ |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 832116d09256..d544731bed7d 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -1105,17 +1105,7 @@ int dvb_unregister_frontend(struct dvb_frontend* fe) | |||
1105 | mutex_lock(&frontend_mutex); | 1105 | mutex_lock(&frontend_mutex); |
1106 | dvb_unregister_device (fepriv->dvbdev); | 1106 | dvb_unregister_device (fepriv->dvbdev); |
1107 | dvb_frontend_stop (fe); | 1107 | dvb_frontend_stop (fe); |
1108 | if (fe->ops.release_sec) | 1108 | |
1109 | fe->ops.release_sec(fe); | ||
1110 | if (fe->ops.tuner_ops.release) { | ||
1111 | fe->ops.tuner_ops.release(fe); | ||
1112 | if (fe->ops.i2c_gate_ctrl) | ||
1113 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
1114 | } | ||
1115 | if (fe->ops.release) | ||
1116 | fe->ops.release(fe); | ||
1117 | else | ||
1118 | printk("dvb_frontend: Demodulator (%s) does not have a release callback!\n", fe->ops.info.name); | ||
1119 | /* fe is invalid now */ | 1109 | /* fe is invalid now */ |
1120 | kfree(fepriv); | 1110 | kfree(fepriv); |
1121 | mutex_unlock(&frontend_mutex); | 1111 | mutex_unlock(&frontend_mutex); |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h index 7a7f75fd168c..66d91e530f85 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, | |||
102 | int (*func)(struct inode *inode, struct file *file, | 102 | int (*func)(struct inode *inode, struct file *file, |
103 | unsigned int cmd, void *arg)); | 103 | unsigned int cmd, void *arg)); |
104 | 104 | ||
105 | |||
106 | /** generic DVB attach function. */ | ||
107 | #ifdef CONFIG_DVB_CORE_ATTACH | ||
108 | #define dvb_attach(FUNCTION, ARGS...) ({ \ | ||
109 | void *__r = NULL; \ | ||
110 | typeof(&FUNCTION) __a = symbol_request(FUNCTION); \ | ||
111 | if (__a) { \ | ||
112 | __r = (void *) __a(ARGS); \ | ||
113 | if (__r == NULL) \ | ||
114 | symbol_put(FUNCTION); \ | ||
115 | } else { \ | ||
116 | printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \ | ||
117 | } \ | ||
118 | __r; \ | ||
119 | }) | ||
120 | |||
121 | #define dvb_detach(FUNCPTR, ARGS...) ({ \ | ||
122 | typeof((FUNCPTR)) __funcptrtmp = FUNCPTR; \ | ||
123 | if (__funcptrtmp) { \ | ||
124 | __funcptrtmp(ARGS); \ | ||
125 | symbol_put_addr(__funcptrtmp); \ | ||
126 | } \ | ||
127 | FUNCPTR = NULL; \ | ||
128 | }) | ||
129 | |||
130 | #else | ||
131 | #define dvb_attach(FUNCTION, ARGS...) ({ \ | ||
132 | FUNCTION(ARGS); \ | ||
133 | }) | ||
134 | |||
135 | #define dvb_detach(FUNCPTR, ARGS...) \ | ||
136 | do { \ | ||
137 | if (FUNCPTR) \ | ||
138 | FUNCPTR(ARGS); \ | ||
139 | FUNCPTR = NULL; \ | ||
140 | } while(0) | ||
141 | |||
142 | #endif | ||
143 | |||
144 | |||
105 | #endif /* #ifndef _DVBDEV_H_ */ | 145 | #endif /* #ifndef _DVBDEV_H_ */ |