Commit 1ab5e74f authored by Mike Isely's avatar Mike Isely Committed by Mauro Carvalho Chehab

V4L/DVB (11172): pvrusb2: Cause overall initialization to fail if sub-driver(s) fail

Signed-off-by: default avatarMike Isely <isely@pobox.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent af78e16b
...@@ -1974,7 +1974,7 @@ static unsigned int pvr2_copy_i2c_addr_list( ...@@ -1974,7 +1974,7 @@ static unsigned int pvr2_copy_i2c_addr_list(
} }
static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw, static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
const struct pvr2_device_client_desc *cd) const struct pvr2_device_client_desc *cd)
{ {
const char *fname; const char *fname;
...@@ -1989,11 +1989,10 @@ static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw, ...@@ -1989,11 +1989,10 @@ static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
fname = (mid < ARRAY_SIZE(module_names)) ? module_names[mid] : NULL; fname = (mid < ARRAY_SIZE(module_names)) ? module_names[mid] : NULL;
if (!fname) { if (!fname) {
pvr2_trace(PVR2_TRACE_ERROR_LEGS, pvr2_trace(PVR2_TRACE_ERROR_LEGS,
"Module ID %u for device %s is unknown" "Module ID %u for device %s has no name",
" (this is probably a bad thing...)",
mid, mid,
hdw->hdw_desc->description); hdw->hdw_desc->description);
return; return -EINVAL;
} }
i2ccnt = pvr2_copy_i2c_addr_list(i2caddr, cd->i2c_address_list, 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,11 +2006,10 @@ static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
if (!i2ccnt) { if (!i2ccnt) {
pvr2_trace(PVR2_TRACE_ERROR_LEGS, pvr2_trace(PVR2_TRACE_ERROR_LEGS,
"Module ID %u for device %s:" "Module ID %u (%s) for device %s:"
" No i2c addresses" " No i2c addresses",
" (this is probably a bad thing...)", mid, fname, hdw->hdw_desc->description);
mid, hdw->hdw_desc->description); return -EINVAL;
return;
} }
/* Note how the 2nd and 3rd arguments are the same for both /* 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,10 +2031,9 @@ static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
if (!sd) { if (!sd) {
pvr2_trace(PVR2_TRACE_ERROR_LEGS, pvr2_trace(PVR2_TRACE_ERROR_LEGS,
"Module ID %u for device %s failed to load" "Module ID %u (%s) for device %s failed to load",
" (this is probably a bad thing...)", mid, fname, hdw->hdw_desc->description);
mid, hdw->hdw_desc->description); return -EIO;
return;
} }
/* Tag this sub-device instance with the module ID we know about. /* 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,6 +2077,8 @@ static void pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
break; break;
default: break; default: break;
} }
return 0;
} }
...@@ -2088,6 +2087,7 @@ static void pvr2_hdw_load_modules(struct pvr2_hdw *hdw) ...@@ -2088,6 +2087,7 @@ static void pvr2_hdw_load_modules(struct pvr2_hdw *hdw)
unsigned int idx; unsigned int idx;
const struct pvr2_string_table *cm; const struct pvr2_string_table *cm;
const struct pvr2_device_client_table *ct; const struct pvr2_device_client_table *ct;
int okFl = !0;
cm = &hdw->hdw_desc->client_modules; cm = &hdw->hdw_desc->client_modules;
for (idx = 0; idx < cm->cnt; idx++) { for (idx = 0; idx < cm->cnt; idx++) {
...@@ -2096,8 +2096,9 @@ static void pvr2_hdw_load_modules(struct pvr2_hdw *hdw) ...@@ -2096,8 +2096,9 @@ static void pvr2_hdw_load_modules(struct pvr2_hdw *hdw)
ct = &hdw->hdw_desc->client_table; ct = &hdw->hdw_desc->client_table;
for (idx = 0; idx < ct->cnt; idx++) { for (idx = 0; idx < ct->cnt; idx++) {
pvr2_hdw_load_subdev(hdw,&ct->lst[idx]); if (!pvr2_hdw_load_subdev(hdw, &ct->lst[idx])) okFl = 0;
} }
if (!okFl) pvr2_hdw_render_useless(hdw);
} }
...@@ -2159,6 +2160,7 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) ...@@ -2159,6 +2160,7 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
if (!pvr2_hdw_dev_ok(hdw)) return; if (!pvr2_hdw_dev_ok(hdw)) return;
pvr2_hdw_load_modules(hdw); pvr2_hdw_load_modules(hdw);
if (!pvr2_hdw_dev_ok(hdw)) return;
for (idx = 0; idx < CTRLDEF_COUNT; idx++) { for (idx = 0; idx < CTRLDEF_COUNT; idx++) {
cptr = hdw->controls + idx; cptr = hdw->controls + idx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment