Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6e5eb59102aa6007d3ea2b382a1d3ca4112c272a
Commit:     6e5eb59102aa6007d3ea2b382a1d3ca4112c272a
Parent:     c976bc82339437e840f7dbf0b8c89c09d3fcd75e
Author:     Hans Verkuil <[EMAIL PROTECTED]>
AuthorDate: Wed Jul 25 12:55:52 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Tue Oct 9 22:03:23 2007 -0300

    V4L/DVB (5924): ivtv-fb: initializing the fb should trigger ivtv firmware 
load
    
    
    ivtv-fb: initializing the framebuffer should trigger ivtv firmware load
    
    Signed-off-by: Hans Verkuil <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/ivtv/ivtv-driver.c  |   12 ++++++++++--
 drivers/media/video/ivtv/ivtv-fb.c      |    5 +++++
 drivers/media/video/ivtv/ivtv-fileops.c |   10 +++-------
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/media/video/ivtv/ivtv-driver.c 
b/drivers/media/video/ivtv/ivtv-driver.c
index 00bdcc2..55ed030 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -1189,6 +1189,12 @@ int ivtv_init_on_first_open(struct ivtv *itv)
        int fw_retry_count = 3;
        int video_input;
 
+       if (test_bit(IVTV_F_I_FAILED, &itv->i_flags))
+               return -ENXIO;
+
+       if (test_and_set_bit(IVTV_F_I_INITED, &itv->i_flags))
+               return 0;
+
        while (--fw_retry_count > 0) {
                /* load firmware */
                if (ivtv_firmware_init(itv) == 0)
@@ -1196,9 +1202,10 @@ int ivtv_init_on_first_open(struct ivtv *itv)
                if (fw_retry_count > 1)
                        IVTV_WARN("Retry loading firmware\n");
        }
+
        if (fw_retry_count == 0) {
-               IVTV_ERR("Error initializing firmware\n");
-               return -1;
+               set_bit(IVTV_F_I_FAILED, &itv->i_flags);
+               return -ENXIO;
        }
 
        /* Try and get firmware versions */
@@ -1381,6 +1388,7 @@ EXPORT_SYMBOL(ivtv_udma_setup);
 EXPORT_SYMBOL(ivtv_udma_unmap);
 EXPORT_SYMBOL(ivtv_udma_alloc);
 EXPORT_SYMBOL(ivtv_udma_prepare);
+EXPORT_SYMBOL(ivtv_init_on_first_open);
 
 module_init(module_start);
 module_exit(module_cleanup);
diff --git a/drivers/media/video/ivtv/ivtv-fb.c 
b/drivers/media/video/ivtv/ivtv-fb.c
index b8ad249..00765da 100644
--- a/drivers/media/video/ivtv/ivtv-fb.c
+++ b/drivers/media/video/ivtv/ivtv-fb.c
@@ -1013,6 +1013,11 @@ static int ivtvfb_init_io(struct ivtv *itv)
 {
        struct osd_info *oi = itv->osd_info;
 
+       if (ivtv_init_on_first_open(itv)) {
+               IVTV_FB_ERR("Failed to initialize ivtv\n");
+               return -ENXIO;
+       }
+
        ivtv_fb_get_framebuffer(itv, &oi->video_rbase, &oi->video_buffer_size);
 
        /* The osd buffer size depends on the number of video buffers allocated
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c 
b/drivers/media/video/ivtv/ivtv-fileops.c
index 4988608..fedddec 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -846,16 +846,12 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp)
        if (itv == NULL) {
                /* Couldn't find a device registered
                   on that minor, shouldn't happen! */
-               printk(KERN_WARNING "ivtv:  No ivtv device found on minor 
%d\n", minor);
+               IVTV_WARN("No ivtv device found on minor %d\n", minor);
                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);
+       if (ivtv_init_on_first_open(itv)) {
+               IVTV_ERR("Failed to initialize on minor %d\n", minor);
                return -ENXIO;
        }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to