diff options
author | Ahmed S. Darwish <darwish.07@gmail.com> | 2007-01-19 22:35:03 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-21 10:34:40 -0500 |
commit | eca8ebfc11d1935a7dd4c59cb8defb5bdff44ecd (patch) | |
tree | 818ee1c4b8accd26a3b30599ba6058a73b9d5c02 /drivers/media/video/pvrusb2 | |
parent | c1c2680d922cd36338cf3efaf4ce0067c3e26eb1 (diff) |
V4L/DVB (5090): Pvrusb2: A patch to use ARRAY_SIZE macro when appropriate
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-encoder.c | 19 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 22 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | 3 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-std.c | 25 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 2 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-video-v4l.c | 9 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-wm8775.c | 9 |
7 files changed, 33 insertions, 56 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c index 3ec8093ae97a..f2ac123e0cb3 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c +++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c | |||
@@ -169,25 +169,23 @@ static int pvr2_encoder_cmd(void *ctxt, | |||
169 | 169 | ||
170 | */ | 170 | */ |
171 | 171 | ||
172 | if (arg_cnt_send > (sizeof(wrData)/sizeof(wrData[0]))-4) { | 172 | if (arg_cnt_send > (ARRAY_SIZE(wrData) - 4)) { |
173 | pvr2_trace( | 173 | pvr2_trace( |
174 | PVR2_TRACE_ERROR_LEGS, | 174 | PVR2_TRACE_ERROR_LEGS, |
175 | "Failed to write cx23416 command" | 175 | "Failed to write cx23416 command" |
176 | " - too many input arguments" | 176 | " - too many input arguments" |
177 | " (was given %u limit %u)", | 177 | " (was given %u limit %u)", |
178 | arg_cnt_send, | 178 | arg_cnt_send, ARRAY_SIZE(wrData) - 4); |
179 | (unsigned int)(sizeof(wrData)/sizeof(wrData[0])) - 4); | ||
180 | return -EINVAL; | 179 | return -EINVAL; |
181 | } | 180 | } |
182 | 181 | ||
183 | if (arg_cnt_recv > (sizeof(rdData)/sizeof(rdData[0]))-4) { | 182 | if (arg_cnt_recv > (ARRAY_SIZE(rdData) - 4)) { |
184 | pvr2_trace( | 183 | pvr2_trace( |
185 | PVR2_TRACE_ERROR_LEGS, | 184 | PVR2_TRACE_ERROR_LEGS, |
186 | "Failed to write cx23416 command" | 185 | "Failed to write cx23416 command" |
187 | " - too many return arguments" | 186 | " - too many return arguments" |
188 | " (was given %u limit %u)", | 187 | " (was given %u limit %u)", |
189 | arg_cnt_recv, | 188 | arg_cnt_recv, ARRAY_SIZE(rdData) - 4); |
190 | (unsigned int)(sizeof(rdData)/sizeof(rdData[0])) - 4); | ||
191 | return -EINVAL; | 189 | return -EINVAL; |
192 | } | 190 | } |
193 | 191 | ||
@@ -201,7 +199,7 @@ static int pvr2_encoder_cmd(void *ctxt, | |||
201 | for (idx = 0; idx < arg_cnt_send; idx++) { | 199 | for (idx = 0; idx < arg_cnt_send; idx++) { |
202 | wrData[idx+4] = argp[idx]; | 200 | wrData[idx+4] = argp[idx]; |
203 | } | 201 | } |
204 | for (; idx < (sizeof(wrData)/sizeof(wrData[0]))-4; idx++) { | 202 | for (; idx < ARRAY_SIZE(wrData) - 4; idx++) { |
205 | wrData[idx+4] = 0; | 203 | wrData[idx+4] = 0; |
206 | } | 204 | } |
207 | 205 | ||
@@ -245,8 +243,7 @@ static int pvr2_encoder_cmd(void *ctxt, | |||
245 | if (ret) break; | 243 | if (ret) break; |
246 | wrData[0] = 0x7; | 244 | wrData[0] = 0x7; |
247 | ret = pvr2_encoder_read_words( | 245 | ret = pvr2_encoder_read_words( |
248 | hdw,0,rdData, | 246 | hdw,0,rdData, ARRAY_SIZE(rdData)); |
249 | sizeof(rdData)/sizeof(rdData[0])); | ||
250 | if (ret) break; | 247 | if (ret) break; |
251 | for (idx = 0; idx < arg_cnt_recv; idx++) { | 248 | for (idx = 0; idx < arg_cnt_recv; idx++) { |
252 | argp[idx] = rdData[idx+4]; | 249 | argp[idx] = rdData[idx+4]; |
@@ -269,13 +266,13 @@ static int pvr2_encoder_vcmd(struct pvr2_hdw *hdw, int cmd, | |||
269 | unsigned int idx; | 266 | unsigned int idx; |
270 | u32 data[12]; | 267 | u32 data[12]; |
271 | 268 | ||
272 | if (args > sizeof(data)/sizeof(data[0])) { | 269 | if (args > ARRAY_SIZE(data)) { |
273 | pvr2_trace( | 270 | pvr2_trace( |
274 | PVR2_TRACE_ERROR_LEGS, | 271 | PVR2_TRACE_ERROR_LEGS, |
275 | "Failed to write cx23416 command" | 272 | "Failed to write cx23416 command" |
276 | " - too many arguments" | 273 | " - too many arguments" |
277 | " (was given %u limit %u)", | 274 | " (was given %u limit %u)", |
278 | args,(unsigned int)(sizeof(data)/sizeof(data[0]))); | 275 | args, ARRAY_SIZE(data)); |
279 | return -EINVAL; | 276 | return -EINVAL; |
280 | } | 277 | } |
281 | 278 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 819564c825c0..1c79ce1e16c4 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -74,12 +74,10 @@ static const char *pvr2_client_29xxx[] = { | |||
74 | 74 | ||
75 | static struct pvr2_string_table pvr2_client_lists[] = { | 75 | static struct pvr2_string_table pvr2_client_lists[] = { |
76 | [PVR2_HDW_TYPE_29XXX] = { | 76 | [PVR2_HDW_TYPE_29XXX] = { |
77 | pvr2_client_29xxx, | 77 | pvr2_client_29xxx, ARRAY_SIZE(pvr2_client_29xxx) |
78 | sizeof(pvr2_client_29xxx)/sizeof(pvr2_client_29xxx[0]), | ||
79 | }, | 78 | }, |
80 | [PVR2_HDW_TYPE_24XXX] = { | 79 | [PVR2_HDW_TYPE_24XXX] = { |
81 | pvr2_client_24xxx, | 80 | pvr2_client_24xxx, ARRAY_SIZE(pvr2_client_24xxx) |
82 | sizeof(pvr2_client_24xxx)/sizeof(pvr2_client_24xxx[0]), | ||
83 | }, | 81 | }, |
84 | }; | 82 | }; |
85 | 83 | ||
@@ -212,7 +210,7 @@ static const struct pvr2_mpeg_ids mpeg_ids[] = { | |||
212 | .id = V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM, | 210 | .id = V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM, |
213 | } | 211 | } |
214 | }; | 212 | }; |
215 | #define MPEGDEF_COUNT (sizeof(mpeg_ids)/sizeof(mpeg_ids[0])) | 213 | #define MPEGDEF_COUNT ARRAY_SIZE(mpeg_ids) |
216 | 214 | ||
217 | 215 | ||
218 | static const char *control_values_srate[] = { | 216 | static const char *control_values_srate[] = { |
@@ -984,7 +982,7 @@ static const struct pvr2_ctl_info control_defs[] = { | |||
984 | } | 982 | } |
985 | }; | 983 | }; |
986 | 984 | ||
987 | #define CTRLDEF_COUNT (sizeof(control_defs)/sizeof(control_defs[0])) | 985 | #define CTRLDEF_COUNT ARRAY_SIZE(control_defs) |
988 | 986 | ||
989 | 987 | ||
990 | const char *pvr2_config_get_name(enum pvr2_config cfg) | 988 | const char *pvr2_config_get_name(enum pvr2_config cfg) |
@@ -1133,12 +1131,10 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) | |||
1133 | }; | 1131 | }; |
1134 | static const struct pvr2_string_table fw_file_defs[] = { | 1132 | static const struct pvr2_string_table fw_file_defs[] = { |
1135 | [PVR2_HDW_TYPE_29XXX] = { | 1133 | [PVR2_HDW_TYPE_29XXX] = { |
1136 | fw_files_29xxx, | 1134 | fw_files_29xxx, ARRAY_SIZE(fw_files_29xxx) |
1137 | sizeof(fw_files_29xxx)/sizeof(fw_files_29xxx[0]), | ||
1138 | }, | 1135 | }, |
1139 | [PVR2_HDW_TYPE_24XXX] = { | 1136 | [PVR2_HDW_TYPE_24XXX] = { |
1140 | fw_files_24xxx, | 1137 | fw_files_24xxx, ARRAY_SIZE(fw_files_24xxx) |
1141 | sizeof(fw_files_24xxx)/sizeof(fw_files_24xxx[0]), | ||
1142 | }, | 1138 | }, |
1143 | }; | 1139 | }; |
1144 | hdw->fw1_state = FW1_STATE_FAILED; // default result | 1140 | hdw->fw1_state = FW1_STATE_FAILED; // default result |
@@ -1225,8 +1221,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) | |||
1225 | trace_firmware("pvr2_upload_firmware2"); | 1221 | trace_firmware("pvr2_upload_firmware2"); |
1226 | 1222 | ||
1227 | ret = pvr2_locate_firmware(hdw,&fw_entry,"encoder", | 1223 | ret = pvr2_locate_firmware(hdw,&fw_entry,"encoder", |
1228 | sizeof(fw_files)/sizeof(fw_files[0]), | 1224 | ARRAY_SIZE(fw_files), fw_files); |
1229 | fw_files); | ||
1230 | if (ret < 0) return ret; | 1225 | if (ret < 0) return ret; |
1231 | fwidx = ret; | 1226 | fwidx = ret; |
1232 | ret = 0; | 1227 | ret = 0; |
@@ -1933,8 +1928,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, | |||
1933 | struct pvr2_ctl_info *ciptr; | 1928 | struct pvr2_ctl_info *ciptr; |
1934 | 1929 | ||
1935 | hdw_type = devid - pvr2_device_table; | 1930 | hdw_type = devid - pvr2_device_table; |
1936 | if (hdw_type >= | 1931 | if (hdw_type >= ARRAY_SIZE(pvr2_device_names)) { |
1937 | sizeof(pvr2_device_names)/sizeof(pvr2_device_names[0])) { | ||
1938 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | 1932 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
1939 | "Bogus device type of %u reported",hdw_type); | 1933 | "Bogus device type of %u reported",hdw_type); |
1940 | return NULL; | 1934 | return NULL; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c index 1a8507926676..a28299107be7 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | |||
@@ -976,8 +976,7 @@ static void do_i2c_scan(struct pvr2_hdw *hdw) | |||
976 | printk("%s: i2c scan beginning\n",hdw->name); | 976 | printk("%s: i2c scan beginning\n",hdw->name); |
977 | for (i = 0; i < 128; i++) { | 977 | for (i = 0; i < 128; i++) { |
978 | msg[0].addr = i; | 978 | msg[0].addr = i; |
979 | rc = i2c_transfer(&hdw->i2c_adap,msg, | 979 | rc = i2c_transfer(&hdw->i2c_adap,msg, ARRAY_SIZE(msg)); |
980 | sizeof(msg)/sizeof(msg[0])); | ||
981 | if (rc != 1) continue; | 980 | if (rc != 1) continue; |
982 | printk("%s: i2c scan: found device @ 0x%x\n",hdw->name,i); | 981 | printk("%s: i2c scan: found device @ 0x%x\n",hdw->name,i); |
983 | } | 982 | } |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-std.c b/drivers/media/video/pvrusb2/pvrusb2-std.c index c08925557ed4..30cceef0b169 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-std.c +++ b/drivers/media/video/pvrusb2/pvrusb2-std.c | |||
@@ -141,10 +141,8 @@ int pvr2_std_str_to_id(v4l2_std_id *idPtr,const char *bufPtr, | |||
141 | cnt = 0; | 141 | cnt = 0; |
142 | while ((cnt < bufSize) && (bufPtr[cnt] != '-')) cnt++; | 142 | while ((cnt < bufSize) && (bufPtr[cnt] != '-')) cnt++; |
143 | if (cnt >= bufSize) return 0; // No more characters | 143 | if (cnt >= bufSize) return 0; // No more characters |
144 | sp = find_std_name( | 144 | sp = find_std_name(std_groups, ARRAY_SIZE(std_groups), |
145 | std_groups, | 145 | bufPtr,cnt); |
146 | sizeof(std_groups)/sizeof(std_groups[0]), | ||
147 | bufPtr,cnt); | ||
148 | if (!sp) return 0; // Illegal color system name | 146 | if (!sp) return 0; // Illegal color system name |
149 | cnt++; | 147 | cnt++; |
150 | bufPtr += cnt; | 148 | bufPtr += cnt; |
@@ -163,8 +161,7 @@ int pvr2_std_str_to_id(v4l2_std_id *idPtr,const char *bufPtr, | |||
163 | if (ch == '/') break; | 161 | if (ch == '/') break; |
164 | cnt++; | 162 | cnt++; |
165 | } | 163 | } |
166 | sp = find_std_name(std_items, | 164 | sp = find_std_name(std_items, ARRAY_SIZE(std_items), |
167 | sizeof(std_items)/sizeof(std_items[0]), | ||
168 | bufPtr,cnt); | 165 | bufPtr,cnt); |
169 | if (!sp) return 0; // Illegal modulation system ID | 166 | if (!sp) return 0; // Illegal modulation system ID |
170 | t = sp->id & cmsk; | 167 | t = sp->id & cmsk; |
@@ -189,14 +186,10 @@ unsigned int pvr2_std_id_to_str(char *bufPtr, unsigned int bufSize, | |||
189 | unsigned int c1,c2; | 186 | unsigned int c1,c2; |
190 | cfl = 0; | 187 | cfl = 0; |
191 | c1 = 0; | 188 | c1 = 0; |
192 | for (idx1 = 0; | 189 | for (idx1 = 0; idx1 < ARRAY_SIZE(std_groups); idx1++) { |
193 | idx1 < sizeof(std_groups)/sizeof(std_groups[0]); | ||
194 | idx1++) { | ||
195 | gp = std_groups + idx1; | 190 | gp = std_groups + idx1; |
196 | gfl = 0; | 191 | gfl = 0; |
197 | for (idx2 = 0; | 192 | for (idx2 = 0; idx2 < ARRAY_SIZE(std_items); idx2++) { |
198 | idx2 < sizeof(std_items)/sizeof(std_items[0]); | ||
199 | idx2++) { | ||
200 | ip = std_items + idx2; | 193 | ip = std_items + idx2; |
201 | if (!(gp->id & ip->id & id)) continue; | 194 | if (!(gp->id & ip->id & id)) continue; |
202 | if (!gfl) { | 195 | if (!gfl) { |
@@ -279,7 +272,7 @@ static struct v4l2_standard generic_standards[] = { | |||
279 | } | 272 | } |
280 | }; | 273 | }; |
281 | 274 | ||
282 | #define generic_standards_cnt (sizeof(generic_standards)/sizeof(generic_standards[0])) | 275 | #define generic_standards_cnt ARRAY_SIZE(generic_standards) |
283 | 276 | ||
284 | static struct v4l2_standard *match_std(v4l2_std_id id) | 277 | static struct v4l2_standard *match_std(v4l2_std_id id) |
285 | { | 278 | { |
@@ -348,7 +341,7 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr, | |||
348 | fmsk |= idmsk; | 341 | fmsk |= idmsk; |
349 | } | 342 | } |
350 | 343 | ||
351 | for (idx2 = 0; idx2 < sizeof(std_mixes)/sizeof(std_mixes[0]); idx2++) { | 344 | for (idx2 = 0; idx2 < ARRAY_SIZE(std_mixes); idx2++) { |
352 | if ((id & std_mixes[idx2]) == std_mixes[idx2]) std_cnt++; | 345 | if ((id & std_mixes[idx2]) == std_mixes[idx2]) std_cnt++; |
353 | } | 346 | } |
354 | 347 | ||
@@ -374,8 +367,8 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr, | |||
374 | idx = 0; | 367 | idx = 0; |
375 | 368 | ||
376 | /* Enumerate potential special cases */ | 369 | /* Enumerate potential special cases */ |
377 | for (idx2 = 0; ((idx2 < sizeof(std_mixes)/sizeof(std_mixes[0])) && | 370 | for (idx2 = 0; (idx2 < ARRAY_SIZE(std_mixes)) && (idx < std_cnt); |
378 | (idx < std_cnt)); idx2++) { | 371 | idx2++) { |
379 | if (!(id & std_mixes[idx2])) continue; | 372 | if (!(id & std_mixes[idx2])) continue; |
380 | if (pvr2_std_fill(stddefs+idx,std_mixes[idx2])) idx++; | 373 | if (pvr2_std_fill(stddefs+idx,std_mixes[idx2])) idx++; |
381 | } | 374 | } |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index a3af24320e73..2f6568e7e6f2 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | |||
@@ -493,7 +493,7 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id) | |||
493 | unsigned int cnt,acnt; | 493 | unsigned int cnt,acnt; |
494 | int ret; | 494 | int ret; |
495 | 495 | ||
496 | if ((ctl_id < 0) || (ctl_id >= (sizeof(funcs)/sizeof(funcs[0])))) { | 496 | if ((ctl_id < 0) || (ctl_id >= ARRAY_SIZE(funcs))) { |
497 | return; | 497 | return; |
498 | } | 498 | } |
499 | 499 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c index 10a735ceee24..7f42042c2016 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c +++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c | |||
@@ -139,8 +139,7 @@ static int decoder_check(struct pvr2_v4l_decoder *ctxt) | |||
139 | unsigned long msk; | 139 | unsigned long msk; |
140 | unsigned int idx; | 140 | unsigned int idx; |
141 | 141 | ||
142 | for (idx = 0; idx < sizeof(decoder_ops)/sizeof(decoder_ops[0]); | 142 | for (idx = 0; idx < ARRAY_SIZE(decoder_ops); idx++) { |
143 | idx++) { | ||
144 | msk = 1 << idx; | 143 | msk = 1 << idx; |
145 | if (ctxt->stale_mask & msk) continue; | 144 | if (ctxt->stale_mask & msk) continue; |
146 | if (decoder_ops[idx].check(ctxt)) { | 145 | if (decoder_ops[idx].check(ctxt)) { |
@@ -156,8 +155,7 @@ static void decoder_update(struct pvr2_v4l_decoder *ctxt) | |||
156 | unsigned long msk; | 155 | unsigned long msk; |
157 | unsigned int idx; | 156 | unsigned int idx; |
158 | 157 | ||
159 | for (idx = 0; idx < sizeof(decoder_ops)/sizeof(decoder_ops[0]); | 158 | for (idx = 0; idx < ARRAY_SIZE(decoder_ops); idx++) { |
160 | idx++) { | ||
161 | msk = 1 << idx; | 159 | msk = 1 << idx; |
162 | if (!(ctxt->stale_mask & msk)) continue; | 160 | if (!(ctxt->stale_mask & msk)) continue; |
163 | ctxt->stale_mask &= ~msk; | 161 | ctxt->stale_mask &= ~msk; |
@@ -219,8 +217,7 @@ int pvr2_i2c_decoder_v4l_setup(struct pvr2_hdw *hdw, | |||
219 | ctxt->ctrl.enable = (void (*)(void *,int))decoder_enable; | 217 | ctxt->ctrl.enable = (void (*)(void *,int))decoder_enable; |
220 | ctxt->client = cp; | 218 | ctxt->client = cp; |
221 | ctxt->hdw = hdw; | 219 | ctxt->hdw = hdw; |
222 | ctxt->stale_mask = (1 << (sizeof(decoder_ops)/ | 220 | ctxt->stale_mask = (1 << ARRAY_SIZE(decoder_ops)) - 1; |
223 | sizeof(decoder_ops[0]))) - 1; | ||
224 | hdw->decoder_ctrl = &ctxt->ctrl; | 221 | hdw->decoder_ctrl = &ctxt->ctrl; |
225 | cp->handler = &ctxt->handler; | 222 | cp->handler = &ctxt->handler; |
226 | pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x saa711x V4L2 handler set up", | 223 | pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x saa711x V4L2 handler set up", |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c index 3f6bc4b117c7..234adf7aa614 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c +++ b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c | |||
@@ -105,8 +105,7 @@ static int wm8775_check(struct pvr2_v4l_wm8775 *ctxt) | |||
105 | unsigned long msk; | 105 | unsigned long msk; |
106 | unsigned int idx; | 106 | unsigned int idx; |
107 | 107 | ||
108 | for (idx = 0; idx < sizeof(wm8775_ops)/sizeof(wm8775_ops[0]); | 108 | for (idx = 0; idx < ARRAY_SIZE(wm8775_ops); idx++) { |
109 | idx++) { | ||
110 | msk = 1 << idx; | 109 | msk = 1 << idx; |
111 | if (ctxt->stale_mask & msk) continue; | 110 | if (ctxt->stale_mask & msk) continue; |
112 | if (wm8775_ops[idx].check(ctxt)) { | 111 | if (wm8775_ops[idx].check(ctxt)) { |
@@ -122,8 +121,7 @@ static void wm8775_update(struct pvr2_v4l_wm8775 *ctxt) | |||
122 | unsigned long msk; | 121 | unsigned long msk; |
123 | unsigned int idx; | 122 | unsigned int idx; |
124 | 123 | ||
125 | for (idx = 0; idx < sizeof(wm8775_ops)/sizeof(wm8775_ops[0]); | 124 | for (idx = 0; idx < ARRAY_SIZE(wm8775_ops); idx++) { |
126 | idx++) { | ||
127 | msk = 1 << idx; | 125 | msk = 1 << idx; |
128 | if (!(ctxt->stale_mask & msk)) continue; | 126 | if (!(ctxt->stale_mask & msk)) continue; |
129 | ctxt->stale_mask &= ~msk; | 127 | ctxt->stale_mask &= ~msk; |
@@ -154,8 +152,7 @@ int pvr2_i2c_wm8775_setup(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp) | |||
154 | ctxt->handler.func_table = &hfuncs; | 152 | ctxt->handler.func_table = &hfuncs; |
155 | ctxt->client = cp; | 153 | ctxt->client = cp; |
156 | ctxt->hdw = hdw; | 154 | ctxt->hdw = hdw; |
157 | ctxt->stale_mask = (1 << (sizeof(wm8775_ops)/ | 155 | ctxt->stale_mask = (1 << ARRAY_SIZE(wm8775_ops)) - 1; |
158 | sizeof(wm8775_ops[0]))) - 1; | ||
159 | cp->handler = &ctxt->handler; | 156 | cp->handler = &ctxt->handler; |
160 | pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x wm8775 V4L2 handler set up", | 157 | pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x wm8775 V4L2 handler set up", |
161 | cp->client->addr); | 158 | cp->client->addr); |