summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/ivtv/ivtv-fileops.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-07-22 17:52:40 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2007-07-22 17:52:40 +0200
commite2d4a5995647766cb059191c3490ef28775993ea (patch)
tree6deffde27dc46c551cdb72f4a373f54bffac633a /linux/drivers/media/video/ivtv/ivtv-fileops.c
parentb08d173dbc4328d6f835f27e07e45a57894e097d (diff)
downloadmediapointer-dvb-s2-e2d4a5995647766cb059191c3490ef28775993ea.tar.gz
mediapointer-dvb-s2-e2d4a5995647766cb059191c3490ef28775993ea.tar.bz2
ivtv, cx25840: postpone fw load until first use.
From: Hans Verkuil <hverkuil@xs4all.nl> The firmware is now loaded when the driver is actually used for the first time. This allows the driver to be compiled in-kernel instead of as a module. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media/video/ivtv/ivtv-fileops.c')
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-fileops.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/linux/drivers/media/video/ivtv/ivtv-fileops.c b/linux/drivers/media/video/ivtv/ivtv-fileops.c
index 5dd519caf..c7c1d3e59 100644
--- a/linux/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/linux/drivers/media/video/ivtv/ivtv-fileops.c
@@ -846,6 +846,15 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp)
return -ENXIO;
}
+ if (!test_and_set_bit(IVTV_F_I_INITED, &itv->i_flags))
+ if (ivtv_init_on_first_open(itv))
+ set_bit(IVTV_F_I_FAILED, &itv->i_flags);
+
+ if (test_bit(IVTV_F_I_FAILED, &itv->i_flags)) {
+ printk(KERN_WARNING "ivtv: failed to initialize on minor %d\n", minor);
+ return -ENXIO;
+ }
+
if (y == IVTV_DEC_STREAM_TYPE_MPG &&
test_bit(IVTV_F_S_CLAIMED, &itv->streams[IVTV_DEC_STREAM_TYPE_YUV].s_flags))
return -EBUSY;