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-hdw.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-hdw.c')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 819564c825c0..1c79ce1e16c4 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -74,12 +74,10 @@ static const char *pvr2_client_29xxx[] = { | |||
74 | 74 | ||
75 | static struct pvr2_string_table pvr2_client_lists[] = { | 75 | static struct pvr2_string_table pvr2_client_lists[] = { |
76 | [PVR2_HDW_TYPE_29XXX] = { | 76 | [PVR2_HDW_TYPE_29XXX] = { |
77 | pvr2_client_29xxx, | 77 | pvr2_client_29xxx, ARRAY_SIZE(pvr2_client_29xxx) |
78 | sizeof(pvr2_client_29xxx)/sizeof(pvr2_client_29xxx[0]), | ||
79 | }, | 78 | }, |
80 | [PVR2_HDW_TYPE_24XXX] = { | 79 | [PVR2_HDW_TYPE_24XXX] = { |
81 | pvr2_client_24xxx, | 80 | pvr2_client_24xxx, ARRAY_SIZE(pvr2_client_24xxx) |
82 | sizeof(pvr2_client_24xxx)/sizeof(pvr2_client_24xxx[0]), | ||
83 | }, | 81 | }, |
84 | }; | 82 | }; |
85 | 83 | ||
@@ -212,7 +210,7 @@ static const struct pvr2_mpeg_ids mpeg_ids[] = { | |||
212 | .id = V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM, | 210 | .id = V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM, |
213 | } | 211 | } |
214 | }; | 212 | }; |
215 | #define MPEGDEF_COUNT (sizeof(mpeg_ids)/sizeof(mpeg_ids[0])) | 213 | #define MPEGDEF_COUNT ARRAY_SIZE(mpeg_ids) |
216 | 214 | ||
217 | 215 | ||
218 | static const char *control_values_srate[] = { | 216 | static const char *control_values_srate[] = { |
@@ -984,7 +982,7 @@ static const struct pvr2_ctl_info control_defs[] = { | |||
984 | } | 982 | } |
985 | }; | 983 | }; |
986 | 984 | ||
987 | #define CTRLDEF_COUNT (sizeof(control_defs)/sizeof(control_defs[0])) | 985 | #define CTRLDEF_COUNT ARRAY_SIZE(control_defs) |
988 | 986 | ||
989 | 987 | ||
990 | const char *pvr2_config_get_name(enum pvr2_config cfg) | 988 | const char *pvr2_config_get_name(enum pvr2_config cfg) |
@@ -1133,12 +1131,10 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) | |||
1133 | }; | 1131 | }; |
1134 | static const struct pvr2_string_table fw_file_defs[] = { | 1132 | static const struct pvr2_string_table fw_file_defs[] = { |
1135 | [PVR2_HDW_TYPE_29XXX] = { | 1133 | [PVR2_HDW_TYPE_29XXX] = { |
1136 | fw_files_29xxx, | 1134 | fw_files_29xxx, ARRAY_SIZE(fw_files_29xxx) |
1137 | sizeof(fw_files_29xxx)/sizeof(fw_files_29xxx[0]), | ||
1138 | }, | 1135 | }, |
1139 | [PVR2_HDW_TYPE_24XXX] = { | 1136 | [PVR2_HDW_TYPE_24XXX] = { |
1140 | fw_files_24xxx, | 1137 | fw_files_24xxx, ARRAY_SIZE(fw_files_24xxx) |
1141 | sizeof(fw_files_24xxx)/sizeof(fw_files_24xxx[0]), | ||
1142 | }, | 1138 | }, |
1143 | }; | 1139 | }; |
1144 | hdw->fw1_state = FW1_STATE_FAILED; // default result | 1140 | hdw->fw1_state = FW1_STATE_FAILED; // default result |
@@ -1225,8 +1221,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) | |||
1225 | trace_firmware("pvr2_upload_firmware2"); | 1221 | trace_firmware("pvr2_upload_firmware2"); |
1226 | 1222 | ||
1227 | ret = pvr2_locate_firmware(hdw,&fw_entry,"encoder", | 1223 | ret = pvr2_locate_firmware(hdw,&fw_entry,"encoder", |
1228 | sizeof(fw_files)/sizeof(fw_files[0]), | 1224 | ARRAY_SIZE(fw_files), fw_files); |
1229 | fw_files); | ||
1230 | if (ret < 0) return ret; | 1225 | if (ret < 0) return ret; |
1231 | fwidx = ret; | 1226 | fwidx = ret; |
1232 | ret = 0; | 1227 | ret = 0; |
@@ -1933,8 +1928,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, | |||
1933 | struct pvr2_ctl_info *ciptr; | 1928 | struct pvr2_ctl_info *ciptr; |
1934 | 1929 | ||
1935 | hdw_type = devid - pvr2_device_table; | 1930 | hdw_type = devid - pvr2_device_table; |
1936 | if (hdw_type >= | 1931 | if (hdw_type >= ARRAY_SIZE(pvr2_device_names)) { |
1937 | sizeof(pvr2_device_names)/sizeof(pvr2_device_names[0])) { | ||
1938 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | 1932 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, |
1939 | "Bogus device type of %u reported",hdw_type); | 1933 | "Bogus device type of %u reported",hdw_type); |
1940 | return NULL; | 1934 | return NULL; |