diff options
author | Markus Rechberger <markus.rechberger@amd.com> | 2007-04-27 11:31:17 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:43:41 -0400 |
commit | 4217e25275eeb1973ca5bed65645f70b8f6c199d (patch) | |
tree | 8f5cabef65b6d3ad8bbaa92bc304db10e8a807ac | |
parent | cfeb88398f004a0e85ee011fd89a01f5d3bf3c81 (diff) |
V4L/DVB (5324): This patch fixes request_module_depend()
this patch fixes request_module_depend()
Signed-off-by: Markus Rechberger <markus.rechberger@amd.com>
Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/saa7134/saa7134-core.c | 62 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 2 |
2 files changed, 13 insertions, 51 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 5f74ea467d4e..f05b0a9a5e6f 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -182,55 +182,28 @@ int saa7134_tuner_callback(void *ptr, int command, int arg) | |||
182 | /* delayed request_module */ | 182 | /* delayed request_module */ |
183 | 183 | ||
184 | #if defined(CONFIG_MODULES) && defined(MODULE) | 184 | #if defined(CONFIG_MODULES) && defined(MODULE) |
185 | static int need_empress; | ||
186 | static int need_dvb; | ||
187 | static int need_alsa; | ||
188 | static int need_oss; | ||
189 | 185 | ||
190 | static int pending_call(struct notifier_block *self, unsigned long state, | ||
191 | void *module) | ||
192 | { | ||
193 | if (module != THIS_MODULE || state != MODULE_STATE_LIVE) | ||
194 | return NOTIFY_DONE; | ||
195 | 186 | ||
196 | if (need_empress) | 187 | static void request_module_async(struct work_struct *work){ |
188 | struct saa7134_dev* dev = container_of(work, struct saa7134_dev, request_module_wk); | ||
189 | if (card_is_empress(dev)) | ||
197 | request_module("saa7134-empress"); | 190 | request_module("saa7134-empress"); |
198 | if (need_dvb) | 191 | if (card_is_dvb(dev)) |
199 | request_module("saa7134-dvb"); | 192 | request_module("saa7134-dvb"); |
200 | if (need_alsa) | 193 | if (alsa) |
201 | request_module("saa7134-alsa"); | 194 | request_module("saa7134-alsa"); |
202 | if (need_oss) | 195 | if (oss) |
203 | request_module("saa7134-oss"); | 196 | request_module("saa7134-oss"); |
204 | return NOTIFY_DONE; | ||
205 | } | 197 | } |
206 | 198 | ||
207 | static int pending_registered; | 199 | static void request_submodules(struct saa7134_dev *dev) |
208 | static struct notifier_block pending_notifier = { | ||
209 | .notifier_call = pending_call, | ||
210 | }; | ||
211 | |||
212 | static void request_module_depend(char *name, int *flag) | ||
213 | { | 200 | { |
214 | int err; | 201 | INIT_WORK(&dev->request_module_wk, request_module_async); |
215 | switch (THIS_MODULE->state) { | 202 | schedule_work(&dev->request_module_wk); |
216 | case MODULE_STATE_COMING: | ||
217 | if (!pending_registered) { | ||
218 | err = register_module_notifier(&pending_notifier); | ||
219 | pending_registered = 1; | ||
220 | } | ||
221 | *flag = 1; | ||
222 | break; | ||
223 | case MODULE_STATE_LIVE: | ||
224 | request_module(name); | ||
225 | break; | ||
226 | default: | ||
227 | /* nothing */; | ||
228 | break; | ||
229 | } | ||
230 | } | 203 | } |
231 | 204 | ||
232 | #else | 205 | #else |
233 | #define request_module_depend(name,flag) | 206 | #define request_submodules() |
234 | #endif /* CONFIG_MODULES */ | 207 | #endif /* CONFIG_MODULES */ |
235 | 208 | ||
236 | /* ------------------------------------------------------------------ */ | 209 | /* ------------------------------------------------------------------ */ |
@@ -1002,18 +975,9 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
1002 | request_module("tuner"); | 975 | request_module("tuner"); |
1003 | if (card_is_empress(dev)) { | 976 | if (card_is_empress(dev)) { |
1004 | request_module("saa6752hs"); | 977 | request_module("saa6752hs"); |
1005 | request_module_depend("saa7134-empress",&need_empress); | ||
1006 | } | 978 | } |
1007 | 979 | ||
1008 | if (card_is_dvb(dev)) | 980 | request_submodules(dev); |
1009 | request_module_depend("saa7134-dvb",&need_dvb); | ||
1010 | |||
1011 | |||
1012 | if (alsa) | ||
1013 | request_module_depend("saa7134-alsa",&need_alsa); | ||
1014 | |||
1015 | if (oss) | ||
1016 | request_module_depend("saa7134-oss",&need_oss); | ||
1017 | 981 | ||
1018 | v4l2_prio_init(&dev->prio); | 982 | v4l2_prio_init(&dev->prio); |
1019 | 983 | ||
@@ -1210,10 +1174,6 @@ static int saa7134_init(void) | |||
1210 | 1174 | ||
1211 | static void saa7134_fini(void) | 1175 | static void saa7134_fini(void) |
1212 | { | 1176 | { |
1213 | #if defined(CONFIG_MODULES) && defined(MODULE) | ||
1214 | if (pending_registered) | ||
1215 | unregister_module_notifier(&pending_notifier); | ||
1216 | #endif /* CONFIG_MODULES */ | ||
1217 | pci_unregister_driver(&saa7134_pci_driver); | 1177 | pci_unregister_driver(&saa7134_pci_driver); |
1218 | } | 1178 | } |
1219 | 1179 | ||
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index c365ec581a11..6aeba144ff6e 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -437,6 +437,8 @@ struct saa7134_dev { | |||
437 | #ifdef VIDIOC_G_PRIORITY | 437 | #ifdef VIDIOC_G_PRIORITY |
438 | struct v4l2_prio_state prio; | 438 | struct v4l2_prio_state prio; |
439 | #endif | 439 | #endif |
440 | /* workstruct for loading modules */ | ||
441 | struct work_struct request_module_wk; | ||
440 | 442 | ||
441 | /* insmod option/autodetected */ | 443 | /* insmod option/autodetected */ |
442 | int autodetected; | 444 | int autodetected; |