diff options
author | Mike Isely <isely@pobox.com> | 2009-06-20 13:57:24 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-23 02:15:17 -0400 |
commit | 90135c96869fa0ef3182282b2a661b57fcdb7230 (patch) | |
tree | 807741895a1206e29eb0a4909790820caacd13e1 /drivers/media/video/pvrusb2 | |
parent | 81e804c9c2e38431c1c01165d06076776c6fcbd6 (diff) |
V4L/DVB (12122): pvrusb2: De-obfuscate code which handles routing schemes
This change does not change any outward behavior; it merely chops down
some large if-conditions with embedded assignments into something a
little more maintainable for others (I of course never had a problem
with this...).
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c | 12 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c | 15 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-video-v4l.c | 13 |
3 files changed, 20 insertions, 20 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c index 41f6e009d5ef..68980e19409f 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c +++ b/drivers/media/video/pvrusb2/pvrusb2-cs53l32a.c | |||
@@ -67,12 +67,11 @@ void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) | |||
67 | u32 input; | 67 | u32 input; |
68 | pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", | 68 | pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", |
69 | hdw->input_val); | 69 | hdw->input_val); |
70 | if ((sid < ARRAY_SIZE(routing_schemes)) && | 70 | sp = (sid < ARRAY_SIZE(routing_schemes)) ? |
71 | ((sp = routing_schemes[sid]) != NULL) && | 71 | routing_schemes[sid] : NULL; |
72 | (hdw->input_val >= 0) && | 72 | if ((sp == NULL) || |
73 | (hdw->input_val < sp->cnt)) { | 73 | (hdw->input_val < 0) || |
74 | input = sp->def[hdw->input_val]; | 74 | (hdw->input_val >= sp->cnt)) { |
75 | } else { | ||
76 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | 75 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
77 | "*** WARNING *** subdev v4l2 set_input:" | 76 | "*** WARNING *** subdev v4l2 set_input:" |
78 | " Invalid routing scheme (%u)" | 77 | " Invalid routing scheme (%u)" |
@@ -80,6 +79,7 @@ void pvr2_cs53l32a_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) | |||
80 | sid, hdw->input_val); | 79 | sid, hdw->input_val); |
81 | return; | 80 | return; |
82 | } | 81 | } |
82 | input = sp->def[hdw->input_val]; | ||
83 | sd->ops->audio->s_routing(sd, input, 0, 0); | 83 | sd->ops->audio->s_routing(sd, input, 0, 0); |
84 | } | 84 | } |
85 | } | 85 | } |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c index 8710c6218aa8..82c135835753 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c +++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c | |||
@@ -114,13 +114,11 @@ void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) | |||
114 | const struct routing_scheme *sp; | 114 | const struct routing_scheme *sp; |
115 | unsigned int sid = hdw->hdw_desc->signal_routing_scheme; | 115 | unsigned int sid = hdw->hdw_desc->signal_routing_scheme; |
116 | 116 | ||
117 | if ((sid < ARRAY_SIZE(routing_schemes)) && | 117 | sp = (sid < ARRAY_SIZE(routing_schemes)) ? |
118 | ((sp = routing_schemes[sid]) != NULL) && | 118 | routing_schemes[sid] : NULL; |
119 | (hdw->input_val >= 0) && | 119 | if ((sp == NULL) || |
120 | (hdw->input_val < sp->cnt)) { | 120 | (hdw->input_val < 0) || |
121 | vid_input = sp->def[hdw->input_val].vid; | 121 | (hdw->input_val >= sp->cnt)) { |
122 | aud_input = sp->def[hdw->input_val].aud; | ||
123 | } else { | ||
124 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | 122 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
125 | "*** WARNING *** subdev cx2584x set_input:" | 123 | "*** WARNING *** subdev cx2584x set_input:" |
126 | " Invalid routing scheme (%u)" | 124 | " Invalid routing scheme (%u)" |
@@ -128,7 +126,8 @@ void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) | |||
128 | sid, hdw->input_val); | 126 | sid, hdw->input_val); |
129 | return; | 127 | return; |
130 | } | 128 | } |
131 | 129 | vid_input = sp->def[hdw->input_val].vid; | |
130 | aud_input = sp->def[hdw->input_val].aud; | ||
132 | pvr2_trace(PVR2_TRACE_CHIPS, | 131 | pvr2_trace(PVR2_TRACE_CHIPS, |
133 | "subdev cx2584x set_input vid=0x%x aud=0x%x", | 132 | "subdev cx2584x set_input vid=0x%x aud=0x%x", |
134 | vid_input, aud_input); | 133 | vid_input, aud_input); |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c index 8c32288eebed..4c96cf48c796 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c +++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c | |||
@@ -85,12 +85,12 @@ void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) | |||
85 | 85 | ||
86 | pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", | 86 | pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", |
87 | hdw->input_val); | 87 | hdw->input_val); |
88 | if ((sid < ARRAY_SIZE(routing_schemes)) && | 88 | |
89 | ((sp = routing_schemes[sid]) != NULL) && | 89 | sp = (sid < ARRAY_SIZE(routing_schemes)) ? |
90 | (hdw->input_val >= 0) && | 90 | routing_schemes[sid] : NULL; |
91 | (hdw->input_val < sp->cnt)) { | 91 | if ((sp == NULL) || |
92 | input = sp->def[hdw->input_val]; | 92 | (hdw->input_val < 0) || |
93 | } else { | 93 | (hdw->input_val >= sp->cnt)) { |
94 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | 94 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
95 | "*** WARNING *** subdev v4l2 set_input:" | 95 | "*** WARNING *** subdev v4l2 set_input:" |
96 | " Invalid routing scheme (%u)" | 96 | " Invalid routing scheme (%u)" |
@@ -98,6 +98,7 @@ void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) | |||
98 | sid, hdw->input_val); | 98 | sid, hdw->input_val); |
99 | return; | 99 | return; |
100 | } | 100 | } |
101 | input = sp->def[hdw->input_val]; | ||
101 | sd->ops->video->s_routing(sd, input, 0, 0); | 102 | sd->ops->video->s_routing(sd, input, 0, 0); |
102 | } | 103 | } |
103 | } | 104 | } |