aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2007-01-19 22:39:17 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:34:41 -0500
commit27c7b710a4010e10b14500c0b27bb4c2a806de1b (patch)
tree5f4285057225c3c08e2d560dfc1c298ac3e738d5 /drivers/media/video/pvrusb2
parentca545f7c39476c6c4c6e639452180a2b38342669 (diff)
V4L/DVB (5092): Pvrusb2: Use ARRAY_SIZE wherever possible
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-audio.c9
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ctrl.c5
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c9
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-debugifc.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-eeprom.c5
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c2
6 files changed, 13 insertions, 21 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-audio.c b/drivers/media/video/pvrusb2/pvrusb2-audio.c
index 7e61d4a17846..a45ede0a8cf1 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-audio.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-audio.c
@@ -98,8 +98,7 @@ static int msp3400_check(struct pvr2_msp3400_handler *ctxt)
98 unsigned long msk; 98 unsigned long msk;
99 unsigned int idx; 99 unsigned int idx;
100 100
101 for (idx = 0; idx < sizeof(msp3400_ops)/sizeof(msp3400_ops[0]); 101 for (idx = 0; idx < ARRAY_SIZE(msp3400_ops); idx++) {
102 idx++) {
103 msk = 1 << idx; 102 msk = 1 << idx;
104 if (ctxt->stale_mask & msk) continue; 103 if (ctxt->stale_mask & msk) continue;
105 if (msp3400_ops[idx].check(ctxt)) { 104 if (msp3400_ops[idx].check(ctxt)) {
@@ -115,8 +114,7 @@ static void msp3400_update(struct pvr2_msp3400_handler *ctxt)
115 unsigned long msk; 114 unsigned long msk;
116 unsigned int idx; 115 unsigned int idx;
117 116
118 for (idx = 0; idx < sizeof(msp3400_ops)/sizeof(msp3400_ops[0]); 117 for (idx = 0; idx < ARRAY_SIZE(msp3400_ops); idx++) {
119 idx++) {
120 msk = 1 << idx; 118 msk = 1 << idx;
121 if (!(ctxt->stale_mask & msk)) continue; 119 if (!(ctxt->stale_mask & msk)) continue;
122 ctxt->stale_mask &= ~msk; 120 ctxt->stale_mask &= ~msk;
@@ -159,8 +157,7 @@ int pvr2_i2c_msp3400_setup(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
159 ctxt->i2c_handler.func_table = &msp3400_funcs; 157 ctxt->i2c_handler.func_table = &msp3400_funcs;
160 ctxt->client = cp; 158 ctxt->client = cp;
161 ctxt->hdw = hdw; 159 ctxt->hdw = hdw;
162 ctxt->stale_mask = (1 << (sizeof(msp3400_ops)/ 160 ctxt->stale_mask = (1 << ARRAY_SIZE(msp3400_ops)) - 1;
163 sizeof(msp3400_ops[0]))) - 1;
164 cp->handler = &ctxt->i2c_handler; 161 cp->handler = &ctxt->i2c_handler;
165 pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x msp3400 V4L2 handler set up", 162 pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x msp3400 V4L2 handler set up",
166 cp->client->addr); 163 cp->client->addr);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index f8f4e2f311ab..f569b00201dd 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -515,9 +515,8 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr,
515 } 515 }
516 if (maskptr) *maskptr = ~0; 516 if (maskptr) *maskptr = ~0;
517 } else if (cptr->info->type == pvr2_ctl_bool) { 517 } else if (cptr->info->type == pvr2_ctl_bool) {
518 ret = parse_token( 518 ret = parse_token(ptr,len,valptr,boolNames,
519 ptr,len,valptr,boolNames, 519 ARRAY_SIZE(boolNames));
520 sizeof(boolNames)/sizeof(boolNames[0]));
521 if (ret == 1) { 520 if (ret == 1) {
522 *valptr = *valptr ? !0 : 0; 521 *valptr = *valptr ? !0 : 0;
523 } else if (ret == 0) { 522 } else if (ret == 0) {
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
index 851099a85e5a..e8a9252c7df6 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
@@ -150,8 +150,7 @@ static int decoder_check(struct pvr2_v4l_cx2584x *ctxt)
150 unsigned long msk; 150 unsigned long msk;
151 unsigned int idx; 151 unsigned int idx;
152 152
153 for (idx = 0; idx < sizeof(decoder_ops)/sizeof(decoder_ops[0]); 153 for (idx = 0; idx < ARRAY_SIZE(decoder_ops); idx++) {
154 idx++) {
155 msk = 1 << idx; 154 msk = 1 << idx;
156 if (ctxt->stale_mask & msk) continue; 155 if (ctxt->stale_mask & msk) continue;
157 if (decoder_ops[idx].check(ctxt)) { 156 if (decoder_ops[idx].check(ctxt)) {
@@ -167,8 +166,7 @@ static void decoder_update(struct pvr2_v4l_cx2584x *ctxt)
167 unsigned long msk; 166 unsigned long msk;
168 unsigned int idx; 167 unsigned int idx;
169 168
170 for (idx = 0; idx < sizeof(decoder_ops)/sizeof(decoder_ops[0]); 169 for (idx = 0; idx < ARRAY_SIZE(decoder_ops); idx++) {
171 idx++) {
172 msk = 1 << idx; 170 msk = 1 << idx;
173 if (!(ctxt->stale_mask & msk)) continue; 171 if (!(ctxt->stale_mask & msk)) continue;
174 ctxt->stale_mask &= ~msk; 172 ctxt->stale_mask &= ~msk;
@@ -242,8 +240,7 @@ int pvr2_i2c_cx2584x_v4l_setup(struct pvr2_hdw *hdw,
242 ctxt->ctrl.force_reset = (void (*)(void*))decoder_reset; 240 ctxt->ctrl.force_reset = (void (*)(void*))decoder_reset;
243 ctxt->client = cp; 241 ctxt->client = cp;
244 ctxt->hdw = hdw; 242 ctxt->hdw = hdw;
245 ctxt->stale_mask = (1 << (sizeof(decoder_ops)/ 243 ctxt->stale_mask = (1 << ARRAY_SIZE(decoder_ops)) - 1;
246 sizeof(decoder_ops[0]))) - 1;
247 hdw->decoder_ctrl = &ctxt->ctrl; 244 hdw->decoder_ctrl = &ctxt->ctrl;
248 cp->handler = &ctxt->handler; 245 cp->handler = &ctxt->handler;
249 { 246 {
diff --git a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
index f985f00d885a..e9da9bb8f8de 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c
@@ -152,7 +152,7 @@ static unsigned long debugifc_find_mask(const char *buf,unsigned int count)
152{ 152{
153 struct debugifc_mask_item *mip; 153 struct debugifc_mask_item *mip;
154 unsigned int idx; 154 unsigned int idx;
155 for (idx = 0; idx < sizeof(mask_items)/sizeof(mask_items[0]); idx++) { 155 for (idx = 0; idx < ARRAY_SIZE(mask_items); idx++) {
156 mip = mask_items + idx; 156 mip = mask_items + idx;
157 if (debugifc_match_keyword(buf,count,mip->name)) { 157 if (debugifc_match_keyword(buf,count,mip->name)) {
158 return mip->msk; 158 return mip->msk;
@@ -169,7 +169,7 @@ static int debugifc_print_mask(char *buf,unsigned int sz,
169 unsigned int idx; 169 unsigned int idx;
170 int bcnt = 0; 170 int bcnt = 0;
171 int ccnt; 171 int ccnt;
172 for (idx = 0; idx < sizeof(mask_items)/sizeof(mask_items[0]); idx++) { 172 for (idx = 0; idx < ARRAY_SIZE(mask_items); idx++) {
173 mip = mask_items + idx; 173 mip = mask_items + idx;
174 if (!(mip->msk & msk)) continue; 174 if (!(mip->msk & msk)) continue;
175 ccnt = scnprintf(buf,sz,"%s%c%s", 175 ccnt = scnprintf(buf,sz,"%s%c%s",
diff --git a/drivers/media/video/pvrusb2/pvrusb2-eeprom.c b/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
index 6cff8e75f426..45cbca0143ca 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
@@ -102,9 +102,8 @@ static u8 *pvr2_eeprom_fetch(struct pvr2_hdw *hdw)
102 } 102 }
103 msg[1].len = pcnt; 103 msg[1].len = pcnt;
104 msg[1].buf = eeprom+tcnt; 104 msg[1].buf = eeprom+tcnt;
105 if ((ret = i2c_transfer( 105 if ((ret = i2c_transfer(&hdw->i2c_adap,
106 &hdw->i2c_adap, 106 msg,ARRAY_SIZE(msg))) != 2) {
107 msg,sizeof(msg)/sizeof(msg[0]))) != 2) {
108 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 107 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
109 "eeprom fetch set offs err=%d",ret); 108 "eeprom fetch set offs err=%d",ret);
110 kfree(eeprom); 109 kfree(eeprom);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 7f9168538245..5e166ed19fc5 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -723,7 +723,7 @@ static void ctrl_stdenumcur_clear_dirty(struct pvr2_ctrl *cptr)
723 723
724#define DEFENUM(tab) \ 724#define DEFENUM(tab) \
725 .type = pvr2_ctl_enum, \ 725 .type = pvr2_ctl_enum, \
726 .def.type_enum.count = (sizeof(tab)/sizeof((tab)[0])), \ 726 .def.type_enum.count = ARRAY_SIZE(tab), \
727 .def.type_enum.value_names = tab 727 .def.type_enum.value_names = tab
728 728
729#define DEFBOOL \ 729#define DEFBOOL \