aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2/pvrusb2-std.c
diff options
context:
space:
mode:
authorAhmed S. Darwish <darwish.07@gmail.com>2007-01-19 22:35:03 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:34:40 -0500
commiteca8ebfc11d1935a7dd4c59cb8defb5bdff44ecd (patch)
tree818ee1c4b8accd26a3b30599ba6058a73b9d5c02 /drivers/media/video/pvrusb2/pvrusb2-std.c
parentc1c2680d922cd36338cf3efaf4ce0067c3e26eb1 (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-std.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-std.c25
1 files changed, 9 insertions, 16 deletions
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
284static struct v4l2_standard *match_std(v4l2_std_id id) 277static 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 }