diff options
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-std.c')
| -rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-std.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-std.c b/drivers/media/video/pvrusb2/pvrusb2-std.c index c08925557ed4..81de26ba41d9 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 | ||
| @@ -366,16 +359,15 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr, | |||
| 366 | std_cnt); | 359 | std_cnt); |
| 367 | if (!std_cnt) return NULL; // paranoia | 360 | if (!std_cnt) return NULL; // paranoia |
| 368 | 361 | ||
| 369 | stddefs = kmalloc(sizeof(struct v4l2_standard) * std_cnt, | 362 | stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt, |
| 370 | GFP_KERNEL); | 363 | GFP_KERNEL); |
| 371 | memset(stddefs,0,sizeof(struct v4l2_standard) * std_cnt); | ||
| 372 | for (idx = 0; idx < std_cnt; idx++) stddefs[idx].index = idx; | 364 | for (idx = 0; idx < std_cnt; idx++) stddefs[idx].index = idx; |
| 373 | 365 | ||
| 374 | idx = 0; | 366 | idx = 0; |
| 375 | 367 | ||
| 376 | /* Enumerate potential special cases */ | 368 | /* Enumerate potential special cases */ |
| 377 | for (idx2 = 0; ((idx2 < sizeof(std_mixes)/sizeof(std_mixes[0])) && | 369 | for (idx2 = 0; (idx2 < ARRAY_SIZE(std_mixes)) && (idx < std_cnt); |
| 378 | (idx < std_cnt)); idx2++) { | 370 | idx2++) { |
| 379 | if (!(id & std_mixes[idx2])) continue; | 371 | if (!(id & std_mixes[idx2])) continue; |
| 380 | if (pvr2_std_fill(stddefs+idx,std_mixes[idx2])) idx++; | 372 | if (pvr2_std_fill(stddefs+idx,std_mixes[idx2])) idx++; |
| 381 | } | 373 | } |
