aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2/pvrusb2-hdw.c
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2009-03-06 22:24:24 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:35 -0400
commit1ab5e74fa3d41a3d49005e430f98cdff77a3cee6 (patch)
tree624f64489f7e84154e23433df0e479aa4fe028b4 /drivers/media/video/pvrusb2/pvrusb2-hdw.c
parentaf78e16b5d5ba74566814ba0f50ee1d736d933a5 (diff)
V4L/DVB (11172): pvrusb2: Cause overall initialization to fail if sub-driver(s) fail
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-hdw.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 74b365f1cfd2..2f9667e62bb1 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -1974,8 +1974,8 @@ static unsigned int pvr2_copy_i2c_addr_list(
1974} 1974}
1975 1975
1976 1976
1977static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw, 1977static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
1978 const struct pvr2_device_client_desc *cd) 1978 const struct pvr2_device_client_desc *cd)
1979{ 1979{
1980 const char *fname; 1980 const char *fname;
1981 unsigned char mid; 1981 unsigned char mid;
@@ -1989,11 +1989,10 @@ static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
1989 fname = (mid < ARRAY_SIZE(module_names)) ? module_names[mid] : NULL; 1989 fname = (mid < ARRAY_SIZE(module_names)) ? module_names[mid] : NULL;
1990 if (!fname) { 1990 if (!fname) {
1991 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 1991 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
1992 "Module ID %u for device %s is unknown" 1992 "Module ID %u for device %s has no name",
1993 " (this is probably a bad thing...)",
1994 mid, 1993 mid,
1995 hdw->hdw_desc->description); 1994 hdw->hdw_desc->description);
1996 return; 1995 return -EINVAL;
1997 } 1996 }
1998 1997
1999 i2ccnt = pvr2_copy_i2c_addr_list(i2caddr, cd->i2c_address_list, 1998 i2ccnt = pvr2_copy_i2c_addr_list(i2caddr, cd->i2c_address_list,
@@ -2007,11 +2006,10 @@ static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
2007 2006
2008 if (!i2ccnt) { 2007 if (!i2ccnt) {
2009 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 2008 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
2010 "Module ID %u for device %s:" 2009 "Module ID %u (%s) for device %s:"
2011 " No i2c addresses" 2010 " No i2c addresses",
2012 " (this is probably a bad thing...)", 2011 mid, fname, hdw->hdw_desc->description);
2013 mid, hdw->hdw_desc->description); 2012 return -EINVAL;
2014 return;
2015 } 2013 }
2016 2014
2017 /* Note how the 2nd and 3rd arguments are the same for both 2015 /* Note how the 2nd and 3rd arguments are the same for both
@@ -2033,10 +2031,9 @@ static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
2033 2031
2034 if (!sd) { 2032 if (!sd) {
2035 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 2033 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
2036 "Module ID %u for device %s failed to load" 2034 "Module ID %u (%s) for device %s failed to load",
2037 " (this is probably a bad thing...)", 2035 mid, fname, hdw->hdw_desc->description);
2038 mid, hdw->hdw_desc->description); 2036 return -EIO;
2039 return;
2040 } 2037 }
2041 2038
2042 /* Tag this sub-device instance with the module ID we know about. 2039 /* Tag this sub-device instance with the module ID we know about.
@@ -2080,6 +2077,8 @@ static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
2080 break; 2077 break;
2081 default: break; 2078 default: break;
2082 } 2079 }
2080
2081 return 0;
2083} 2082}
2084 2083
2085 2084
@@ -2088,6 +2087,7 @@ static void pvr2_hdw_load_modules(struct pvr2_hdw *hdw)
2088 unsigned int idx; 2087 unsigned int idx;
2089 const struct pvr2_string_table *cm; 2088 const struct pvr2_string_table *cm;
2090 const struct pvr2_device_client_table *ct; 2089 const struct pvr2_device_client_table *ct;
2090 int okFl = !0;
2091 2091
2092 cm = &hdw->hdw_desc->client_modules; 2092 cm = &hdw->hdw_desc->client_modules;
2093 for (idx = 0; idx < cm->cnt; idx++) { 2093 for (idx = 0; idx < cm->cnt; idx++) {
@@ -2096,8 +2096,9 @@ static void pvr2_hdw_load_modules(struct pvr2_hdw *hdw)
2096 2096
2097 ct = &hdw->hdw_desc->client_table; 2097 ct = &hdw->hdw_desc->client_table;
2098 for (idx = 0; idx < ct->cnt; idx++) { 2098 for (idx = 0; idx < ct->cnt; idx++) {
2099 pvr2_hdw_load_subdev(hdw,&ct->lst[idx]); 2099 if (!pvr2_hdw_load_subdev(hdw, &ct->lst[idx])) okFl = 0;
2100 } 2100 }
2101 if (!okFl) pvr2_hdw_render_useless(hdw);
2101} 2102}
2102 2103
2103 2104
@@ -2159,6 +2160,7 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
2159 if (!pvr2_hdw_dev_ok(hdw)) return; 2160 if (!pvr2_hdw_dev_ok(hdw)) return;
2160 2161
2161 pvr2_hdw_load_modules(hdw); 2162 pvr2_hdw_load_modules(hdw);
2163 if (!pvr2_hdw_dev_ok(hdw)) return;
2162 2164
2163 for (idx = 0; idx < CTRLDEF_COUNT; idx++) { 2165 for (idx = 0; idx < CTRLDEF_COUNT; idx++) {
2164 cptr = hdw->controls + idx; 2166 cptr = hdw->controls + idx;