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/pvrusb2-encoder.c | |
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/pvrusb2-encoder.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-encoder.c | 19 |
1 files changed, 8 insertions, 11 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 | ||