From eca8ebfc11d1935a7dd4c59cb8defb5bdff44ecd Mon Sep 17 00:00:00 2001 From: "Ahmed S. Darwish" Date: Sat, 20 Jan 2007 00:35:03 -0300 Subject: V4L/DVB (5090): Pvrusb2: A patch to use ARRAY_SIZE macro when appropriate Signed-off-by: Ahmed S. Darwish Signed-off-by: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pvrusb2/pvrusb2-encoder.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'drivers/media/video/pvrusb2/pvrusb2-encoder.c') diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c index 3ec8093ae97..f2ac123e0cb 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, */ - if (arg_cnt_send > (sizeof(wrData)/sizeof(wrData[0]))-4) { + if (arg_cnt_send > (ARRAY_SIZE(wrData) - 4)) { pvr2_trace( PVR2_TRACE_ERROR_LEGS, "Failed to write cx23416 command" " - too many input arguments" " (was given %u limit %u)", - arg_cnt_send, - (unsigned int)(sizeof(wrData)/sizeof(wrData[0])) - 4); + arg_cnt_send, ARRAY_SIZE(wrData) - 4); return -EINVAL; } - if (arg_cnt_recv > (sizeof(rdData)/sizeof(rdData[0]))-4) { + if (arg_cnt_recv > (ARRAY_SIZE(rdData) - 4)) { pvr2_trace( PVR2_TRACE_ERROR_LEGS, "Failed to write cx23416 command" " - too many return arguments" " (was given %u limit %u)", - arg_cnt_recv, - (unsigned int)(sizeof(rdData)/sizeof(rdData[0])) - 4); + arg_cnt_recv, ARRAY_SIZE(rdData) - 4); return -EINVAL; } @@ -201,7 +199,7 @@ static int pvr2_encoder_cmd(void *ctxt, for (idx = 0; idx < arg_cnt_send; idx++) { wrData[idx+4] = argp[idx]; } - for (; idx < (sizeof(wrData)/sizeof(wrData[0]))-4; idx++) { + for (; idx < ARRAY_SIZE(wrData) - 4; idx++) { wrData[idx+4] = 0; } @@ -245,8 +243,7 @@ static int pvr2_encoder_cmd(void *ctxt, if (ret) break; wrData[0] = 0x7; ret = pvr2_encoder_read_words( - hdw,0,rdData, - sizeof(rdData)/sizeof(rdData[0])); + hdw,0,rdData, ARRAY_SIZE(rdData)); if (ret) break; for (idx = 0; idx < arg_cnt_recv; idx++) { argp[idx] = rdData[idx+4]; @@ -269,13 +266,13 @@ static int pvr2_encoder_vcmd(struct pvr2_hdw *hdw, int cmd, unsigned int idx; u32 data[12]; - if (args > sizeof(data)/sizeof(data[0])) { + if (args > ARRAY_SIZE(data)) { pvr2_trace( PVR2_TRACE_ERROR_LEGS, "Failed to write cx23416 command" " - too many arguments" " (was given %u limit %u)", - args,(unsigned int)(sizeof(data)/sizeof(data[0]))); + args, ARRAY_SIZE(data)); return -EINVAL; } -- cgit v1.2.3