The patch number 13224 was added via Mike Isely <is...@pobox.com>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        Linux Media Mailing List <linux-me...@vger.kernel.org>

------

From: Mike Isely  <is...@pobox.com>
pvrusb2: Improve diagnostic info on driver initialization failure


It used to be that the only real detectable reason for the driver to
fail during initialization would be that if the hardware is simply
jammed.  However with the advent of the sub-device mechanism in V4L it
is possible now to detect if a sub-device module fails to load
successfully.  The pvrusb2 driver does in fact react to this by also
(correctly) failing, however the original diagnostic message "hardware
is jammed" was still being reported.  This misleads the user because
in fact it might not actually be a hardware failure.  This change adds
logic to tell the difference and then report a more appropriate
message to the kernel log.

Priority: normal

Signed-off-by: Mike Isely <is...@pobox.com>


---

 linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h |    1 
 linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c          |   28 ++++++++--
 2 files changed, 25 insertions(+), 4 deletions(-)

diff -r b902478b9d31 -r 418db7d451ab 
linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h  Sun Oct 11 
22:18:13 2009 -0500
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h  Sun Oct 11 
22:21:20 2009 -0500
@@ -270,6 +270,7 @@
 
        int force_dirty;        /* consider all controls dirty if true */
        int flag_ok;            /* device in known good state */
+       int flag_modulefail;    /* true if at least one module failed to load */
        int flag_disconnected;  /* flag_ok == 0 due to disconnect */
        int flag_init_ok;       /* true if structure is fully initialized */
        int fw1_state;          /* current situation with fw1 */
diff -r b902478b9d31 -r 418db7d451ab 
linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c   Sun Oct 11 22:18:13 
2009 -0500
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c   Sun Oct 11 22:21:20 
2009 -0500
@@ -2047,7 +2047,8 @@
        fname = (mid < ARRAY_SIZE(module_names)) ? module_names[mid] : NULL;
        if (!fname) {
                pvr2_trace(PVR2_TRACE_ERROR_LEGS,
-                          "Module ID %u for device %s has no name",
+                          "Module ID %u for device %s has no name?"
+                          "  The driver might have a configuration problem.",
                           mid,
                           hdw->hdw_desc->description);
                return -EINVAL;
@@ -2075,7 +2076,8 @@
        if (!i2ccnt) {
                pvr2_trace(PVR2_TRACE_ERROR_LEGS,
                           "Module ID %u (%s) for device %s:"
-                          " No i2c addresses",
+                          " No i2c addresses."
+                          "  The driver might have a configuration problem.",
                           mid, fname, hdw->hdw_desc->description);
                return -EINVAL;
        }
@@ -2107,7 +2109,9 @@
 
        if (!sd) {
                pvr2_trace(PVR2_TRACE_ERROR_LEGS,
-                          "Module ID %u (%s) for device %s failed to load",
+                          "Module ID %u (%s) for device %s failed to load."
+                          "  Possible missing sub-device kernel module or"
+                          " initialization failure within module.",
                           mid, fname, hdw->hdw_desc->description);
                return -EIO;
        }
@@ -2149,7 +2153,10 @@
        for (idx = 0; idx < ct->cnt; idx++) {
                if (pvr2_hdw_load_subdev(hdw, &ct->lst[idx]) < 0) okFl = 0;
        }
-       if (!okFl) pvr2_hdw_render_useless(hdw);
+       if (!okFl) {
+               hdw->flag_modulefail = !0;
+               pvr2_hdw_render_useless(hdw);
+       }
 }
 
 
@@ -2351,6 +2358,19 @@
                                break;
                        }
                }
+               if (hdw->flag_modulefail) {
+                       pvr2_trace(
+                               PVR2_TRACE_ERROR_LEGS,
+                               "***WARNING*** pvrusb2 driver initialization"
+                               " failed due to the failure of one or more"
+                               " sub-device kernel modules.");
+                       pvr2_trace(
+                               PVR2_TRACE_ERROR_LEGS,
+                               "You need to resolve the failing condition"
+                               " before this driver can function.  There"
+                               " should be some earlier messages giving more"
+                               " information about the problem.");
+               }
                if (procreload) {
                        pvr2_trace(
                                PVR2_TRACE_ERROR_LEGS,


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/418db7d451ab7dad79b8238d0c862c1eb81cf8a2

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to