diff options
Diffstat (limited to 'arch/alpha')
-rw-r--r-- | arch/alpha/kernel/err_ev7.c | 8 | ||||
-rw-r--r-- | arch/alpha/kernel/osf_sys.c | 4 | ||||
-rw-r--r-- | arch/alpha/kernel/setup.c | 50 | ||||
-rw-r--r-- | arch/alpha/kernel/sys_ruffian.c | 8 | ||||
-rw-r--r-- | arch/alpha/kernel/time.c | 2 |
5 files changed, 34 insertions, 38 deletions
diff --git a/arch/alpha/kernel/err_ev7.c b/arch/alpha/kernel/err_ev7.c index bf52ba691957..fed6b3d1b803 100644 --- a/arch/alpha/kernel/err_ev7.c +++ b/arch/alpha/kernel/err_ev7.c | |||
@@ -274,16 +274,14 @@ ev7_process_pal_subpacket(struct el_subpacket *header) | |||
274 | struct el_subpacket_handler ev7_pal_subpacket_handler = | 274 | struct el_subpacket_handler ev7_pal_subpacket_handler = |
275 | SUBPACKET_HANDLER_INIT(EL_CLASS__PAL, ev7_process_pal_subpacket); | 275 | SUBPACKET_HANDLER_INIT(EL_CLASS__PAL, ev7_process_pal_subpacket); |
276 | 276 | ||
277 | void | 277 | void |
278 | ev7_register_error_handlers(void) | 278 | ev7_register_error_handlers(void) |
279 | { | 279 | { |
280 | int i; | 280 | int i; |
281 | 281 | ||
282 | for(i = 0; | 282 | for (i = 0; i < ARRAY_SIZE(el_ev7_pal_annotations); i++) |
283 | i<sizeof(el_ev7_pal_annotations)/sizeof(el_ev7_pal_annotations[1]); | ||
284 | i++) { | ||
285 | cdl_register_subpacket_annotation(&el_ev7_pal_annotations[i]); | 283 | cdl_register_subpacket_annotation(&el_ev7_pal_annotations[i]); |
286 | } | 284 | |
287 | cdl_register_subpacket_handler(&ev7_pal_subpacket_handler); | 285 | cdl_register_subpacket_handler(&ev7_pal_subpacket_handler); |
288 | } | 286 | } |
289 | 287 | ||
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index e15dcf4f3dcd..73c7622b5297 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -623,12 +623,12 @@ osf_sysinfo(int command, char __user *buf, long count) | |||
623 | long len, err = -EINVAL; | 623 | long len, err = -EINVAL; |
624 | 624 | ||
625 | offset = command-1; | 625 | offset = command-1; |
626 | if (offset >= sizeof(sysinfo_table)/sizeof(char *)) { | 626 | if (offset >= ARRAY_SIZE(sysinfo_table)) { |
627 | /* Digital UNIX has a few unpublished interfaces here */ | 627 | /* Digital UNIX has a few unpublished interfaces here */ |
628 | printk("sysinfo(%d)", command); | 628 | printk("sysinfo(%d)", command); |
629 | goto out; | 629 | goto out; |
630 | } | 630 | } |
631 | 631 | ||
632 | down_read(&uts_sem); | 632 | down_read(&uts_sem); |
633 | res = sysinfo_table[offset]; | 633 | res = sysinfo_table[offset]; |
634 | len = strlen(res)+1; | 634 | len = strlen(res)+1; |
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index 2cb9c4380113..fd4a8fa0c93d 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c | |||
@@ -114,8 +114,6 @@ struct alpha_machine_vector alpha_mv; | |||
114 | int alpha_using_srm; | 114 | int alpha_using_srm; |
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | #define N(a) (sizeof(a)/sizeof(a[0])) | ||
118 | |||
119 | static struct alpha_machine_vector *get_sysvec(unsigned long, unsigned long, | 117 | static struct alpha_machine_vector *get_sysvec(unsigned long, unsigned long, |
120 | unsigned long); | 118 | unsigned long); |
121 | static struct alpha_machine_vector *get_sysvec_byname(const char *); | 119 | static struct alpha_machine_vector *get_sysvec_byname(const char *); |
@@ -240,7 +238,7 @@ reserve_std_resources(void) | |||
240 | standard_io_resources[0].start = RTC_PORT(0); | 238 | standard_io_resources[0].start = RTC_PORT(0); |
241 | standard_io_resources[0].end = RTC_PORT(0) + 0x10; | 239 | standard_io_resources[0].end = RTC_PORT(0) + 0x10; |
242 | 240 | ||
243 | for (i = 0; i < N(standard_io_resources); ++i) | 241 | for (i = 0; i < ARRAY_SIZE(standard_io_resources); ++i) |
244 | request_resource(io, standard_io_resources+i); | 242 | request_resource(io, standard_io_resources+i); |
245 | } | 243 | } |
246 | 244 | ||
@@ -918,13 +916,13 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu) | |||
918 | 916 | ||
919 | /* Search the system tables first... */ | 917 | /* Search the system tables first... */ |
920 | vec = NULL; | 918 | vec = NULL; |
921 | if (type < N(systype_vecs)) { | 919 | if (type < ARRAY_SIZE(systype_vecs)) { |
922 | vec = systype_vecs[type]; | 920 | vec = systype_vecs[type]; |
923 | } else if ((type > ST_API_BIAS) && | 921 | } else if ((type > ST_API_BIAS) && |
924 | (type - ST_API_BIAS) < N(api_vecs)) { | 922 | (type - ST_API_BIAS) < ARRAY_SIZE(api_vecs)) { |
925 | vec = api_vecs[type - ST_API_BIAS]; | 923 | vec = api_vecs[type - ST_API_BIAS]; |
926 | } else if ((type > ST_UNOFFICIAL_BIAS) && | 924 | } else if ((type > ST_UNOFFICIAL_BIAS) && |
927 | (type - ST_UNOFFICIAL_BIAS) < N(unofficial_vecs)) { | 925 | (type - ST_UNOFFICIAL_BIAS) < ARRAY_SIZE(unofficial_vecs)) { |
928 | vec = unofficial_vecs[type - ST_UNOFFICIAL_BIAS]; | 926 | vec = unofficial_vecs[type - ST_UNOFFICIAL_BIAS]; |
929 | } | 927 | } |
930 | 928 | ||
@@ -938,11 +936,11 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu) | |||
938 | 936 | ||
939 | switch (type) { | 937 | switch (type) { |
940 | case ST_DEC_ALCOR: | 938 | case ST_DEC_ALCOR: |
941 | if (member < N(alcor_indices)) | 939 | if (member < ARRAY_SIZE(alcor_indices)) |
942 | vec = alcor_vecs[alcor_indices[member]]; | 940 | vec = alcor_vecs[alcor_indices[member]]; |
943 | break; | 941 | break; |
944 | case ST_DEC_EB164: | 942 | case ST_DEC_EB164: |
945 | if (member < N(eb164_indices)) | 943 | if (member < ARRAY_SIZE(eb164_indices)) |
946 | vec = eb164_vecs[eb164_indices[member]]; | 944 | vec = eb164_vecs[eb164_indices[member]]; |
947 | /* PC164 may show as EB164 variation with EV56 CPU, | 945 | /* PC164 may show as EB164 variation with EV56 CPU, |
948 | but, since no true EB164 had anything but EV5... */ | 946 | but, since no true EB164 had anything but EV5... */ |
@@ -950,24 +948,24 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu) | |||
950 | vec = &pc164_mv; | 948 | vec = &pc164_mv; |
951 | break; | 949 | break; |
952 | case ST_DEC_EB64P: | 950 | case ST_DEC_EB64P: |
953 | if (member < N(eb64p_indices)) | 951 | if (member < ARRAY_SIZE(eb64p_indices)) |
954 | vec = eb64p_vecs[eb64p_indices[member]]; | 952 | vec = eb64p_vecs[eb64p_indices[member]]; |
955 | break; | 953 | break; |
956 | case ST_DEC_EB66: | 954 | case ST_DEC_EB66: |
957 | if (member < N(eb66_indices)) | 955 | if (member < ARRAY_SIZE(eb66_indices)) |
958 | vec = eb66_vecs[eb66_indices[member]]; | 956 | vec = eb66_vecs[eb66_indices[member]]; |
959 | break; | 957 | break; |
960 | case ST_DEC_MARVEL: | 958 | case ST_DEC_MARVEL: |
961 | if (member < N(marvel_indices)) | 959 | if (member < ARRAY_SIZE(marvel_indices)) |
962 | vec = marvel_vecs[marvel_indices[member]]; | 960 | vec = marvel_vecs[marvel_indices[member]]; |
963 | break; | 961 | break; |
964 | case ST_DEC_TITAN: | 962 | case ST_DEC_TITAN: |
965 | vec = titan_vecs[0]; /* default */ | 963 | vec = titan_vecs[0]; /* default */ |
966 | if (member < N(titan_indices)) | 964 | if (member < ARRAY_SIZE(titan_indices)) |
967 | vec = titan_vecs[titan_indices[member]]; | 965 | vec = titan_vecs[titan_indices[member]]; |
968 | break; | 966 | break; |
969 | case ST_DEC_TSUNAMI: | 967 | case ST_DEC_TSUNAMI: |
970 | if (member < N(tsunami_indices)) | 968 | if (member < ARRAY_SIZE(tsunami_indices)) |
971 | vec = tsunami_vecs[tsunami_indices[member]]; | 969 | vec = tsunami_vecs[tsunami_indices[member]]; |
972 | break; | 970 | break; |
973 | case ST_DEC_1000: | 971 | case ST_DEC_1000: |
@@ -1039,7 +1037,7 @@ get_sysvec_byname(const char *name) | |||
1039 | 1037 | ||
1040 | size_t i; | 1038 | size_t i; |
1041 | 1039 | ||
1042 | for (i = 0; i < N(all_vecs); ++i) { | 1040 | for (i = 0; i < ARRAY_SIZE(all_vecs); ++i) { |
1043 | struct alpha_machine_vector *mv = all_vecs[i]; | 1041 | struct alpha_machine_vector *mv = all_vecs[i]; |
1044 | if (strcasecmp(mv->vector_name, name) == 0) | 1042 | if (strcasecmp(mv->vector_name, name) == 0) |
1045 | return mv; | 1043 | return mv; |
@@ -1055,13 +1053,13 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu, | |||
1055 | 1053 | ||
1056 | /* If not in the tables, make it UNKNOWN, | 1054 | /* If not in the tables, make it UNKNOWN, |
1057 | else set type name to family */ | 1055 | else set type name to family */ |
1058 | if (type < N(systype_names)) { | 1056 | if (type < ARRAY_SIZE(systype_names)) { |
1059 | *type_name = systype_names[type]; | 1057 | *type_name = systype_names[type]; |
1060 | } else if ((type > ST_API_BIAS) && | 1058 | } else if ((type > ST_API_BIAS) && |
1061 | (type - ST_API_BIAS) < N(api_names)) { | 1059 | (type - ST_API_BIAS) < ARRAY_SIZE(api_names)) { |
1062 | *type_name = api_names[type - ST_API_BIAS]; | 1060 | *type_name = api_names[type - ST_API_BIAS]; |
1063 | } else if ((type > ST_UNOFFICIAL_BIAS) && | 1061 | } else if ((type > ST_UNOFFICIAL_BIAS) && |
1064 | (type - ST_UNOFFICIAL_BIAS) < N(unofficial_names)) { | 1062 | (type - ST_UNOFFICIAL_BIAS) < ARRAY_SIZE(unofficial_names)) { |
1065 | *type_name = unofficial_names[type - ST_UNOFFICIAL_BIAS]; | 1063 | *type_name = unofficial_names[type - ST_UNOFFICIAL_BIAS]; |
1066 | } else { | 1064 | } else { |
1067 | *type_name = sys_unknown; | 1065 | *type_name = sys_unknown; |
@@ -1083,7 +1081,7 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu, | |||
1083 | default: /* default to variation "0" for now */ | 1081 | default: /* default to variation "0" for now */ |
1084 | break; | 1082 | break; |
1085 | case ST_DEC_EB164: | 1083 | case ST_DEC_EB164: |
1086 | if (member < N(eb164_indices)) | 1084 | if (member < ARRAY_SIZE(eb164_indices)) |
1087 | *variation_name = eb164_names[eb164_indices[member]]; | 1085 | *variation_name = eb164_names[eb164_indices[member]]; |
1088 | /* PC164 may show as EB164 variation, but with EV56 CPU, | 1086 | /* PC164 may show as EB164 variation, but with EV56 CPU, |
1089 | so, since no true EB164 had anything but EV5... */ | 1087 | so, since no true EB164 had anything but EV5... */ |
@@ -1091,32 +1089,32 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu, | |||
1091 | *variation_name = eb164_names[1]; /* make it PC164 */ | 1089 | *variation_name = eb164_names[1]; /* make it PC164 */ |
1092 | break; | 1090 | break; |
1093 | case ST_DEC_ALCOR: | 1091 | case ST_DEC_ALCOR: |
1094 | if (member < N(alcor_indices)) | 1092 | if (member < ARRAY_SIZE(alcor_indices)) |
1095 | *variation_name = alcor_names[alcor_indices[member]]; | 1093 | *variation_name = alcor_names[alcor_indices[member]]; |
1096 | break; | 1094 | break; |
1097 | case ST_DEC_EB64P: | 1095 | case ST_DEC_EB64P: |
1098 | if (member < N(eb64p_indices)) | 1096 | if (member < ARRAY_SIZE(eb64p_indices)) |
1099 | *variation_name = eb64p_names[eb64p_indices[member]]; | 1097 | *variation_name = eb64p_names[eb64p_indices[member]]; |
1100 | break; | 1098 | break; |
1101 | case ST_DEC_EB66: | 1099 | case ST_DEC_EB66: |
1102 | if (member < N(eb66_indices)) | 1100 | if (member < ARRAY_SIZE(eb66_indices)) |
1103 | *variation_name = eb66_names[eb66_indices[member]]; | 1101 | *variation_name = eb66_names[eb66_indices[member]]; |
1104 | break; | 1102 | break; |
1105 | case ST_DEC_MARVEL: | 1103 | case ST_DEC_MARVEL: |
1106 | if (member < N(marvel_indices)) | 1104 | if (member < ARRAY_SIZE(marvel_indices)) |
1107 | *variation_name = marvel_names[marvel_indices[member]]; | 1105 | *variation_name = marvel_names[marvel_indices[member]]; |
1108 | break; | 1106 | break; |
1109 | case ST_DEC_RAWHIDE: | 1107 | case ST_DEC_RAWHIDE: |
1110 | if (member < N(rawhide_indices)) | 1108 | if (member < ARRAY_SIZE(rawhide_indices)) |
1111 | *variation_name = rawhide_names[rawhide_indices[member]]; | 1109 | *variation_name = rawhide_names[rawhide_indices[member]]; |
1112 | break; | 1110 | break; |
1113 | case ST_DEC_TITAN: | 1111 | case ST_DEC_TITAN: |
1114 | *variation_name = titan_names[0]; /* default */ | 1112 | *variation_name = titan_names[0]; /* default */ |
1115 | if (member < N(titan_indices)) | 1113 | if (member < ARRAY_SIZE(titan_indices)) |
1116 | *variation_name = titan_names[titan_indices[member]]; | 1114 | *variation_name = titan_names[titan_indices[member]]; |
1117 | break; | 1115 | break; |
1118 | case ST_DEC_TSUNAMI: | 1116 | case ST_DEC_TSUNAMI: |
1119 | if (member < N(tsunami_indices)) | 1117 | if (member < ARRAY_SIZE(tsunami_indices)) |
1120 | *variation_name = tsunami_names[tsunami_indices[member]]; | 1118 | *variation_name = tsunami_names[tsunami_indices[member]]; |
1121 | break; | 1119 | break; |
1122 | } | 1120 | } |
@@ -1211,7 +1209,7 @@ show_cpuinfo(struct seq_file *f, void *slot) | |||
1211 | 1209 | ||
1212 | cpu_index = (unsigned) (cpu->type - 1); | 1210 | cpu_index = (unsigned) (cpu->type - 1); |
1213 | cpu_name = "Unknown"; | 1211 | cpu_name = "Unknown"; |
1214 | if (cpu_index < N(cpu_names)) | 1212 | if (cpu_index < ARRAY_SIZE(cpu_names)) |
1215 | cpu_name = cpu_names[cpu_index]; | 1213 | cpu_name = cpu_names[cpu_index]; |
1216 | 1214 | ||
1217 | get_sysnames(hwrpb->sys_type, hwrpb->sys_variation, | 1215 | get_sysnames(hwrpb->sys_type, hwrpb->sys_variation, |
diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c index 78c30decf3ff..5b99cf3cd69c 100644 --- a/arch/alpha/kernel/sys_ruffian.c +++ b/arch/alpha/kernel/sys_ruffian.c | |||
@@ -182,16 +182,16 @@ static unsigned long __init | |||
182 | ruffian_get_bank_size(unsigned long offset) | 182 | ruffian_get_bank_size(unsigned long offset) |
183 | { | 183 | { |
184 | unsigned long bank_addr, bank, ret = 0; | 184 | unsigned long bank_addr, bank, ret = 0; |
185 | 185 | ||
186 | /* Valid offsets are: 0x800, 0x840 and 0x880 | 186 | /* Valid offsets are: 0x800, 0x840 and 0x880 |
187 | since Ruffian only uses three banks. */ | 187 | since Ruffian only uses three banks. */ |
188 | bank_addr = (unsigned long)PYXIS_MCR + offset; | 188 | bank_addr = (unsigned long)PYXIS_MCR + offset; |
189 | bank = *(vulp)bank_addr; | 189 | bank = *(vulp)bank_addr; |
190 | 190 | ||
191 | /* Check BANK_ENABLE */ | 191 | /* Check BANK_ENABLE */ |
192 | if (bank & 0x01) { | 192 | if (bank & 0x01) { |
193 | static unsigned long size[] __initdata = { | 193 | static unsigned long size[] __initdata = { |
194 | 0x40000000UL, /* 0x00, 1G */ | 194 | 0x40000000UL, /* 0x00, 1G */ |
195 | 0x20000000UL, /* 0x02, 512M */ | 195 | 0x20000000UL, /* 0x02, 512M */ |
196 | 0x10000000UL, /* 0x04, 256M */ | 196 | 0x10000000UL, /* 0x04, 256M */ |
197 | 0x08000000UL, /* 0x06, 128M */ | 197 | 0x08000000UL, /* 0x06, 128M */ |
@@ -203,7 +203,7 @@ ruffian_get_bank_size(unsigned long offset) | |||
203 | }; | 203 | }; |
204 | 204 | ||
205 | bank = (bank & 0x1e) >> 1; | 205 | bank = (bank & 0x1e) >> 1; |
206 | if (bank < sizeof(size)/sizeof(*size)) | 206 | if (bank < ARRAY_SIZE(size)) |
207 | ret = size[bank]; | 207 | ret = size[bank]; |
208 | } | 208 | } |
209 | 209 | ||
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c index 50eccde2dcd8..b191cc759737 100644 --- a/arch/alpha/kernel/time.c +++ b/arch/alpha/kernel/time.c | |||
@@ -233,7 +233,7 @@ validate_cc_value(unsigned long cc) | |||
233 | index = cpu->type & 0xffffffff; | 233 | index = cpu->type & 0xffffffff; |
234 | 234 | ||
235 | /* If index out of bounds, no way to validate. */ | 235 | /* If index out of bounds, no way to validate. */ |
236 | if (index >= sizeof(cpu_hz)/sizeof(cpu_hz[0])) | 236 | if (index >= ARRAY_SIZE(cpu_hz)) |
237 | return cc; | 237 | return cc; |
238 | 238 | ||
239 | /* If index contains no data, no way to validate. */ | 239 | /* If index contains no data, no way to validate. */ |