On Tue, Jul 17, 2007 at 01:39:53PM -0400, Nicholas Fearnley wrote:
>
> On 17 Jul 2007, at 18:11, Tyler Trafford wrote:
>
> > Hans Verkuil wrote:
> >
> >> I've never actually tested having ivtv compiled in the kernel, I
> >> always tested it as a module. I'm not sure how firmware loading is
> >> supposed to work for in-kernel drivers. I suspect that by the time
> >> the
> >> driver is initialized the hotplug daemons may not be active yet.
> >
> > http://ivtvdriver.org/pipermail/ivtv-devel/2007-February/004501.html
> >
> > I think it might be a good idea for drivers that require firmware to
> > delay initialization until triggered by the user.
> > --
> > Tyler Trafford
>
> I agree, the budget dvb cards do just that on firing up the driver.
> It's disappointing that something in the kernel *has* to be compiled
> as a module, I totally understand the technical constraint in this
> case though.
>
> Would it be an easy change? I'll have a look and feedback.
I don't think it would be very hard, something like the attached patch.
(The patch won't work, it's just to give the general idea.)
--
Tyler Trafford
A sect or party is an elegant incognito devised to save a man from
the vexation of thinking.
-- Ralph Waldo Emerson, Journals, 1831
diff -r 0e29b111bbc1 linux/drivers/media/video/ivtv/ivtv-driver.c
--- a/linux/drivers/media/video/ivtv/ivtv-driver.c Mon Jul 16 10:47:51 2007 -0300
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.c Tue Jul 17 14:29:47 2007 -0400
@@ -1315,6 +1315,15 @@ static struct pci_driver ivtv_pci_driver
.remove = ivtv_remove,
};
+int ivtv_init_device()
+{
+ if (pci_register_driver(&ivtv_pci_driver)) {
+ printk(KERN_ERR "ivtv: Error detecting PCI card\n");
+ return -ENODEV;
+ }
+ return 0;
+}
+
static int module_start(void)
{
printk(KERN_INFO "ivtv: ==================== START INIT IVTV ====================\n");
@@ -1334,10 +1343,13 @@ static int module_start(void)
printk(KERN_INFO "ivtv: debug value must be >= 0 and <= 1023!\n");
}
+#ifdef CONFIG_VIDEO_IVTV_MODULE
if (pci_register_driver(&ivtv_pci_driver)) {
printk(KERN_ERR "ivtv: Error detecting PCI card\n");
return -ENODEV;
}
+#endif
+
printk(KERN_INFO "ivtv: ==================== END INIT IVTV ====================\n");
return 0;
}
diff -r 0e29b111bbc1 linux/drivers/media/video/ivtv/ivtv-driver.h
--- a/linux/drivers/media/video/ivtv/ivtv-driver.h Mon Jul 16 10:47:51 2007 -0300
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.h Tue Jul 17 14:29:47 2007 -0400
@@ -848,6 +848,8 @@ extern spinlock_t ivtv_cards_lock;
/*==============Prototypes==================*/
+int ivtv_init_device();
+
/* Hardware/IRQ */
void ivtv_set_irq_mask(struct ivtv *itv, u32 mask);
void ivtv_clear_irq_mask(struct ivtv *itv, u32 mask);
diff -r 0e29b111bbc1 linux/drivers/media/video/ivtv/ivtv-ioctl.c
--- a/linux/drivers/media/video/ivtv/ivtv-ioctl.c Mon Jul 16 10:47:51 2007 -0300
+++ b/linux/drivers/media/video/ivtv/ivtv-ioctl.c Tue Jul 17 14:29:47 2007 -0400
@@ -1483,6 +1483,9 @@ static int ivtv_v4l2_do_ioctl(struct ino
v4l_printk_ioctl(cmd);
}
return ivtv_debug_ioctls(filp, cmd, arg);
+
+ case VIDIOC_INT_INIT_DEVICE:
+ return ivtv_init_device();
case VIDIOC_G_PRIORITY:
case VIDIOC_S_PRIORITY:
_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel