[patch] v4l: saa7134 module

From: Gerd Knorr
Date: Thu Jan 20 2005 - 10:38:04 EST


- fix saa7134 module loading issues.

Signed-off-by: Gerd Knorr <kraxel@xxxxxxxxxxx>
---
drivers/media/video/saa7134/saa7134-core.c | 47 ++++++++++++++++++++-
1 files changed, 45 insertions(+), 2 deletions(-)

Index: linux-2.6.10/drivers/media/video/saa7134/saa7134-core.c
===================================================================
--- linux-2.6.10.orig/drivers/media/video/saa7134/saa7134-core.c 2005-01-10 12:40:58.613644368 +0100
+++ linux-2.6.10/drivers/media/video/saa7134/saa7134-core.c 2005-01-10 12:40:59.759428971 +0100
@@ -222,6 +222,49 @@ static void dump_statusregs(struct saa71
}
#endif

+/* ----------------------------------------------------------- */
+/* delayed request_module */
+
+static int need_empress;
+static int need_dvb;
+
+static int pending_call(struct notifier_block *self, unsigned long state,
+ void *module)
+{
+ if (module != THIS_MODULE || state != MODULE_STATE_LIVE)
+ return NOTIFY_DONE;
+
+ if (need_empress)
+ request_module("saa7134-empress");
+ if (need_dvb)
+ request_module("saa7134-dvb");
+ return NOTIFY_DONE;
+}
+
+static int pending_registered;
+static struct notifier_block pending_notifier = {
+ .notifier_call = pending_call,
+};
+
+static void request_module_depend(char *name, int *flag)
+{
+ switch (THIS_MODULE->state) {
+ case MODULE_STATE_COMING:
+ if (!pending_registered) {
+ register_module_notifier(&pending_notifier);
+ pending_registered = 1;
+ }
+ *flag = 1;
+ break;
+ case MODULE_STATE_LIVE:
+ request_module(name);
+ break;
+ default:
+ /* nothing */;
+ break;
+ }
+}
+
/* ------------------------------------------------------------------ */

/* nr of (saa7134-)pages for the given buffer size */
@@ -941,11 +984,11 @@ static int __devinit saa7134_initdev(str
if (dev->tda9887_conf)
request_module("tda9887");
if (card_is_empress(dev)) {
- request_module("saa7134-empress");
request_module("saa6752hs");
+ request_module_depend("saa7134-empress",&need_empress);
}
if (card_is_dvb(dev))
- request_module("saa7134-dvb");
+ request_module_depend("saa7134-dvb",&need_dvb);

v4l2_prio_init(&dev->prio);


--
#define printk(args...) fprintf(stderr, ## args)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/