} else {
if (dvb_register_frontend(&fc->dvb_adapter, fc->fe)) {
err("frontend registration failed!");
- dvb_detach(fc->fe->ops.release_sec, fc->fe);
- dvb_detach(fc->fe->ops.tuner_ops.release, fc->fe);
- dvb_detach(fc->fe->ops.release, fc->fe);
+ dvb_frontend_detach(fc->fe);
fc->fe = NULL;
return -EINVAL;
}
{
if (fc->init_state & FC_STATE_FE_INIT) {
dvb_unregister_frontend(fc->fe);
- dvb_detach(fc->fe->ops.release_sec, fc->fe);
- dvb_detach(fc->fe->ops.tuner_ops.release, fc->fe);
- dvb_detach(fc->fe->ops.release, fc->fe);
+ dvb_frontend_detach(fc->fe);
}
fc->init_state &= ~FC_STATE_FE_INIT;
else
if (dvb_register_frontend(&card->dvb_adapter, card->fe)) {
printk("dvb-bt8xx: Frontend registration failed!\n");
- dvb_detach(card->fe->ops.release_sec, card->fe);
- dvb_detach(card->fe->ops.tuner_ops.release, card->fe);
- dvb_detach(card->fe->ops.release, card->fe);
+ dvb_frontend_detach(card->fe);
card->fe = NULL;
}
}
dvb_dmx_release(&card->demux);
if (card->fe) {
dvb_unregister_frontend(card->fe);
- dvb_detach(card->fe->ops.release_sec, card->fe);
- dvb_detach(card->fe->ops.tuner_ops.release, card->fe);
- dvb_detach(card->fe->ops.release, card->fe);
+ dvb_frontend_detach(card->fe);
}
dvb_unregister_adapter(&card->dvb_adapter);
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);
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);
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...) ({ \
__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_ */
if (dvb_register_frontend(&d->dvb_adap, d->fe)) {
err("Frontend registration failed.");
- dvb_detach(d->fe->ops.release_sec, d->fe);
- dvb_detach(d->fe->ops.tuner_ops.release, d->fe);
- dvb_detach(d->fe->ops.release, d->fe);
+ dvb_frontend_detach(d->fe);
d->fe = NULL;
return -ENODEV;
}
{
if (d->fe != NULL) {
dvb_unregister_frontend(d->fe);
- dvb_detach(d->fe->ops.release_sec, d->fe);
- dvb_detach(d->fe->ops.tuner_ops.release, d->fe);
- dvb_detach(d->fe->ops.release, d->fe);
+ dvb_frontend_detach(d->fe);
}
return 0;
}
if (av7110->fe != NULL) {
dvb_unregister_frontend(av7110->fe);
- dvb_detach(av7110->fe->ops.release_sec, av7110->fe);
- dvb_detach(av7110->fe->ops.tuner_ops.release, av7110->fe);
- dvb_detach(av7110->fe->ops.release, av7110->fe);
+ dvb_frontend_detach(av7110->fe);
}
dvb_unregister_device(av7110->osd_dev);
av7110_av_unregister(av7110);
ret = dvb_register_frontend(&av7110->dvb_adapter, av7110->fe);
if (ret < 0) {
printk("av7110: Frontend registration failed!\n");
- dvb_detach(av7110->fe->ops.release_sec, av7110->fe);
- dvb_detach(av7110->fe->ops.tuner_ops.release, av7110->fe);
- dvb_detach(av7110->fe->ops.release, av7110->fe);
+ dvb_frontend_detach(av7110->fe);
av7110->fe = NULL;
}
}
if (dvb_register_frontend(&budget_av->budget.dvb_adapter,
budget_av->budget.dvb_frontend)) {
printk(KERN_ERR "budget-av: Frontend registration failed!\n");
- dvb_detach(budget_av->budget.dvb_frontend->ops.release_sec, budget_av->budget.dvb_frontend);
- dvb_detach(budget_av->budget.dvb_frontend->ops.tuner_ops.release, budget_av->budget.dvb_frontend);
- dvb_detach(budget_av->budget.dvb_frontend->ops.release, budget_av->budget.dvb_frontend);
+ dvb_frontend_detach(budget_av->budget.dvb_frontend);
budget_av->budget.dvb_frontend = NULL;
}
}
if (budget_av->budget.dvb_frontend != NULL) {
dvb_unregister_frontend(budget_av->budget.dvb_frontend);
- dvb_detach(budget_av->budget.dvb_frontend->ops.release_sec, budget_av->budget.dvb_frontend);
- dvb_detach(budget_av->budget.dvb_frontend->ops.tuner_ops.release, budget_av->budget.dvb_frontend);
- dvb_detach(budget_av->budget.dvb_frontend->ops.release, budget_av->budget.dvb_frontend);
+ dvb_frontend_detach(budget_av->budget.dvb_frontend);
}
err = ttpci_budget_deinit(&budget_av->budget);
if (dvb_register_frontend
(&budget_ci->budget.dvb_adapter, budget_ci->budget.dvb_frontend)) {
printk("budget-ci: Frontend registration failed!\n");
- dvb_detach(budget_ci->budget.dvb_frontend->ops.release_sec, budget_ci->budget.dvb_frontend);
- dvb_detach(budget_ci->budget.dvb_frontend->ops.tuner_ops.release, budget_ci->budget.dvb_frontend);
- dvb_detach(budget_ci->budget.dvb_frontend->ops.release, budget_ci->budget.dvb_frontend);
+ dvb_frontend_detach(budget_ci->budget.dvb_frontend);
budget_ci->budget.dvb_frontend = NULL;
}
}
ciintf_deinit(budget_ci);
if (budget_ci->budget.dvb_frontend) {
dvb_unregister_frontend(budget_ci->budget.dvb_frontend);
- dvb_detach(budget_ci->budget.dvb_frontend->ops.release_sec, budget_ci->budget.dvb_frontend);
- dvb_detach(budget_ci->budget.dvb_frontend->ops.tuner_ops.release, budget_ci->budget.dvb_frontend);
- dvb_detach(budget_ci->budget.dvb_frontend->ops.release, budget_ci->budget.dvb_frontend);
+ dvb_frontend_detach(budget_ci->budget.dvb_frontend);
}
err = ttpci_budget_deinit(&budget_ci->budget);
} else {
if (dvb_register_frontend(&budget->dvb_adapter, budget->dvb_frontend)) {
printk("budget-av: Frontend registration failed!\n");
- dvb_detach(budget->dvb_frontend->ops.release_sec, budget->dvb_frontend);
- dvb_detach(budget->dvb_frontend->ops.tuner_ops.release, budget->dvb_frontend);
- dvb_detach(budget->dvb_frontend->ops.release, budget->dvb_frontend);
+ dvb_frontend_detach(budget->dvb_frontend);
budget->dvb_frontend = NULL;
}
}
if (budget->dvb_frontend) {
dvb_unregister_frontend(budget->dvb_frontend);
- dvb_detach(budget->dvb_frontend->ops.release_sec, budget->dvb_frontend);
- dvb_detach(budget->dvb_frontend->ops.tuner_ops.release, budget->dvb_frontend);
- dvb_detach(budget->dvb_frontend->ops.release, budget->dvb_frontend);
+ dvb_frontend_detach(budget->dvb_frontend);
}
err = ttpci_budget_deinit (budget);
error_out:
printk("budget: Frontend registration failed!\n");
- dvb_detach(budget->dvb_frontend->ops.release_sec, budget->dvb_frontend);
- dvb_detach(budget->dvb_frontend->ops.tuner_ops.release, budget->dvb_frontend);
- dvb_detach(budget->dvb_frontend->ops.release, budget->dvb_frontend);
+ dvb_frontend_detach(budget->dvb_frontend);
budget->dvb_frontend = NULL;
return;
}
if (budget->dvb_frontend) {
dvb_unregister_frontend(budget->dvb_frontend);
- dvb_detach(budget->dvb_frontend->ops.release_sec, budget->dvb_frontend);
- dvb_detach(budget->dvb_frontend->ops.tuner_ops.release, budget->dvb_frontend);
- dvb_detach(budget->dvb_frontend->ops.release, budget->dvb_frontend);
+ dvb_frontend_detach(budget->dvb_frontend);
}
err = ttpci_budget_deinit (budget);
} else {
if (dvb_register_frontend(&ttusb->adapter, ttusb->fe)) {
printk("dvb-ttusb-budget: Frontend registration failed!\n");
- dvb_detach(ttusb->fe->ops.release_sec, ttusb->fe);
- dvb_detach(ttusb->fe->ops.tuner_ops.release, ttusb->fe);
- dvb_detach(ttusb->fe->ops.release, ttusb->fe);
+ dvb_frontend_detach(ttusb->fe);
ttusb->fe = NULL;
}
}
dvb_dmx_release(&ttusb->dvb_demux);
if (ttusb->fe != NULL) {
dvb_unregister_frontend(ttusb->fe);
- dvb_detach(ttusb->fe->ops.release_sec, ttusb->fe);
- dvb_detach(ttusb->fe->ops.tuner_ops.release, ttusb->fe);
- dvb_detach(ttusb->fe->ops.release, ttusb->fe);
+ dvb_frontend_detach(ttusb->fe);
}
i2c_del_adapter(&ttusb->i2c_adap);
dvb_unregister_adapter(&ttusb->adapter);
fail_dmx:
dvb_unregister_frontend(dvb->frontend);
fail_frontend:
- dvb_detach(dvb->frontend->ops.release_sec, dvb->frontend);
- dvb_detach(dvb->frontend->ops.tuner_ops.release, dvb->frontend);
- dvb_detach(dvb->frontend->ops.release, dvb->frontend);
+ dvb_frontend_detach(dvb->frontend);
dvb_unregister_adapter(&dvb->adapter);
fail_adapter:
return result;
dvb_dmxdev_release(&dvb->dmxdev);
dvb_dmx_release(&dvb->demux);
dvb_unregister_frontend(dvb->frontend);
- dvb_detach(dvb->frontend->ops.release_sec, dvb->frontend);
- dvb_detach(dvb->frontend->ops.tuner_ops.release, dvb->frontend);
- dvb_detach(dvb->frontend->ops.release, dvb->frontend);
+ dvb_frontend_detach(dvb->frontend);
dvb_unregister_adapter(&dvb->adapter);
}