diff options
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 20 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvbdev.h | 28 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-dvb.c | 2 | ||||
-rw-r--r-- | drivers/media/video/cx88/cx88-dvb.c | 2 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 2 | ||||
-rw-r--r-- | drivers/media/video/videobuf-dvb.c | 11 | ||||
-rw-r--r-- | include/media/videobuf-dvb.h | 4 |
7 files changed, 61 insertions, 8 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 98082416aa52..e9ec8e911056 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -1712,7 +1712,18 @@ static int dvb_frontend_ioctl_legacy(struct inode *inode, struct file *file, | |||
1712 | struct dvb_device *dvbdev = file->private_data; | 1712 | struct dvb_device *dvbdev = file->private_data; |
1713 | struct dvb_frontend *fe = dvbdev->priv; | 1713 | struct dvb_frontend *fe = dvbdev->priv; |
1714 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 1714 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
1715 | int err = -EOPNOTSUPP; | 1715 | int cb_err, err = -EOPNOTSUPP; |
1716 | |||
1717 | if (fe->dvb->fe_ioctl_override) { | ||
1718 | cb_err = fe->dvb->fe_ioctl_override(fe, cmd, parg, | ||
1719 | DVB_FE_IOCTL_PRE); | ||
1720 | if (cb_err < 0) | ||
1721 | return cb_err; | ||
1722 | if (cb_err > 0) | ||
1723 | return 0; | ||
1724 | /* fe_ioctl_override returning 0 allows | ||
1725 | * dvb-core to continue handling the ioctl */ | ||
1726 | } | ||
1716 | 1727 | ||
1717 | switch (cmd) { | 1728 | switch (cmd) { |
1718 | case FE_GET_INFO: { | 1729 | case FE_GET_INFO: { |
@@ -1978,6 +1989,13 @@ static int dvb_frontend_ioctl_legacy(struct inode *inode, struct file *file, | |||
1978 | break; | 1989 | break; |
1979 | }; | 1990 | }; |
1980 | 1991 | ||
1992 | if (fe->dvb->fe_ioctl_override) { | ||
1993 | cb_err = fe->dvb->fe_ioctl_override(fe, cmd, parg, | ||
1994 | DVB_FE_IOCTL_POST); | ||
1995 | if (cb_err < 0) | ||
1996 | return cb_err; | ||
1997 | } | ||
1998 | |||
1981 | return err; | 1999 | return err; |
1982 | } | 2000 | } |
1983 | 2001 | ||
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h index 01fc70484743..f7b499d4a3c0 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.h +++ b/drivers/media/dvb/dvb-core/dvbdev.h | |||
@@ -54,6 +54,8 @@ | |||
54 | module_param_array(adapter_nr, short, NULL, 0444); \ | 54 | module_param_array(adapter_nr, short, NULL, 0444); \ |
55 | MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers") | 55 | MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers") |
56 | 56 | ||
57 | struct dvb_frontend; | ||
58 | |||
57 | struct dvb_adapter { | 59 | struct dvb_adapter { |
58 | int num; | 60 | int num; |
59 | struct list_head list_head; | 61 | struct list_head list_head; |
@@ -69,6 +71,32 @@ struct dvb_adapter { | |||
69 | int mfe_shared; /* indicates mutually exclusive frontends */ | 71 | int mfe_shared; /* indicates mutually exclusive frontends */ |
70 | struct dvb_device *mfe_dvbdev; /* frontend device in use */ | 72 | struct dvb_device *mfe_dvbdev; /* frontend device in use */ |
71 | struct mutex mfe_lock; /* access lock for thread creation */ | 73 | struct mutex mfe_lock; /* access lock for thread creation */ |
74 | |||
75 | /* Allow the adapter/bridge driver to perform an action before and/or | ||
76 | * after the core handles an ioctl: | ||
77 | * | ||
78 | * DVB_FE_IOCTL_PRE indicates that the ioctl has not yet been handled. | ||
79 | * DVB_FE_IOCTL_POST indicates that the ioctl has been handled. | ||
80 | * | ||
81 | * When DVB_FE_IOCTL_PRE is passed to the callback as the stage arg: | ||
82 | * | ||
83 | * return 0 to allow dvb-core to handle the ioctl. | ||
84 | * return a positive int to prevent dvb-core from handling the ioctl, | ||
85 | * and exit without error. | ||
86 | * return a negative int to prevent dvb-core from handling the ioctl, | ||
87 | * and return that value as an error. | ||
88 | * | ||
89 | * When DVB_FE_IOCTL_POST is passed to the callback as the stage arg: | ||
90 | * | ||
91 | * return 0 to allow the dvb_frontend ioctl handler to exit normally. | ||
92 | * return a negative int to cause the dvb_frontend ioctl handler to | ||
93 | * return that value as an error. | ||
94 | */ | ||
95 | #define DVB_FE_IOCTL_PRE 0 | ||
96 | #define DVB_FE_IOCTL_POST 1 | ||
97 | int (*fe_ioctl_override)(struct dvb_frontend *fe, | ||
98 | unsigned int cmd, void *parg, | ||
99 | unsigned int stage); | ||
72 | }; | 100 | }; |
73 | 101 | ||
74 | 102 | ||
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index 45e13ee66dc7..0a03e02b119b 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
@@ -904,7 +904,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
904 | 904 | ||
905 | /* register everything */ | 905 | /* register everything */ |
906 | ret = videobuf_dvb_register_bus(&port->frontends, THIS_MODULE, port, | 906 | ret = videobuf_dvb_register_bus(&port->frontends, THIS_MODULE, port, |
907 | &dev->pci->dev, adapter_nr, 0); | 907 | &dev->pci->dev, adapter_nr, 0, NULL); |
908 | 908 | ||
909 | /* init CI & MAC */ | 909 | /* init CI & MAC */ |
910 | switch (dev->board) { | 910 | switch (dev->board) { |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 518bcfe18bcb..d9e402b25b56 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -1174,7 +1174,7 @@ static int dvb_register(struct cx8802_dev *dev) | |||
1174 | 1174 | ||
1175 | /* register everything */ | 1175 | /* register everything */ |
1176 | return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, | 1176 | return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, |
1177 | &dev->pci->dev, adapter_nr, mfe_shared); | 1177 | &dev->pci->dev, adapter_nr, mfe_shared, NULL); |
1178 | 1178 | ||
1179 | frontend_detach: | 1179 | frontend_detach: |
1180 | core->gate_ctrl = NULL; | 1180 | core->gate_ctrl = NULL; |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 058b56bf6717..96d3668f4691 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -1574,7 +1574,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1574 | 1574 | ||
1575 | /* register everything else */ | 1575 | /* register everything else */ |
1576 | ret = videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, | 1576 | ret = videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, |
1577 | &dev->pci->dev, adapter_nr, 0); | 1577 | &dev->pci->dev, adapter_nr, 0, NULL); |
1578 | 1578 | ||
1579 | /* this sequence is necessary to make the tda1004x load its firmware | 1579 | /* this sequence is necessary to make the tda1004x load its firmware |
1580 | * and to enter analog mode of hybrid boards | 1580 | * and to enter analog mode of hybrid boards |
diff --git a/drivers/media/video/videobuf-dvb.c b/drivers/media/video/videobuf-dvb.c index 0e7dcba8e4ae..a56cf0d3a6d6 100644 --- a/drivers/media/video/videobuf-dvb.c +++ b/drivers/media/video/videobuf-dvb.c | |||
@@ -139,7 +139,9 @@ static int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *fe, | |||
139 | struct device *device, | 139 | struct device *device, |
140 | char *adapter_name, | 140 | char *adapter_name, |
141 | short *adapter_nr, | 141 | short *adapter_nr, |
142 | int mfe_shared) | 142 | int mfe_shared, |
143 | int (*fe_ioctl_override)(struct dvb_frontend *, | ||
144 | unsigned int, void *, unsigned int)) | ||
143 | { | 145 | { |
144 | int result; | 146 | int result; |
145 | 147 | ||
@@ -154,6 +156,7 @@ static int videobuf_dvb_register_adapter(struct videobuf_dvb_frontends *fe, | |||
154 | } | 156 | } |
155 | fe->adapter.priv = adapter_priv; | 157 | fe->adapter.priv = adapter_priv; |
156 | fe->adapter.mfe_shared = mfe_shared; | 158 | fe->adapter.mfe_shared = mfe_shared; |
159 | fe->adapter.fe_ioctl_override = fe_ioctl_override; | ||
157 | 160 | ||
158 | return result; | 161 | return result; |
159 | } | 162 | } |
@@ -253,7 +256,9 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, | |||
253 | void *adapter_priv, | 256 | void *adapter_priv, |
254 | struct device *device, | 257 | struct device *device, |
255 | short *adapter_nr, | 258 | short *adapter_nr, |
256 | int mfe_shared) | 259 | int mfe_shared, |
260 | int (*fe_ioctl_override)(struct dvb_frontend *, | ||
261 | unsigned int, void *, unsigned int)) | ||
257 | { | 262 | { |
258 | struct list_head *list, *q; | 263 | struct list_head *list, *q; |
259 | struct videobuf_dvb_frontend *fe; | 264 | struct videobuf_dvb_frontend *fe; |
@@ -267,7 +272,7 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, | |||
267 | 272 | ||
268 | /* Bring up the adapter */ | 273 | /* Bring up the adapter */ |
269 | res = videobuf_dvb_register_adapter(f, module, adapter_priv, device, | 274 | res = videobuf_dvb_register_adapter(f, module, adapter_priv, device, |
270 | fe->dvb.name, adapter_nr, mfe_shared); | 275 | fe->dvb.name, adapter_nr, mfe_shared, fe_ioctl_override); |
271 | if (res < 0) { | 276 | if (res < 0) { |
272 | printk(KERN_WARNING "videobuf_dvb_register_adapter failed (errno = %d)\n", res); | 277 | printk(KERN_WARNING "videobuf_dvb_register_adapter failed (errno = %d)\n", res); |
273 | return res; | 278 | return res; |
diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h index 6ba4f1271d23..07cf4b9d0a65 100644 --- a/include/media/videobuf-dvb.h +++ b/include/media/videobuf-dvb.h | |||
@@ -42,7 +42,9 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f, | |||
42 | void *adapter_priv, | 42 | void *adapter_priv, |
43 | struct device *device, | 43 | struct device *device, |
44 | short *adapter_nr, | 44 | short *adapter_nr, |
45 | int mfe_shared); | 45 | int mfe_shared, |
46 | int (*fe_ioctl_override)(struct dvb_frontend *, | ||
47 | unsigned int, void *, unsigned int)); | ||
46 | 48 | ||
47 | void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); | 49 | void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); |
48 | 50 | ||