@@ -114,8 +114,6 @@ struct alpha_machine_vector alpha_mv;
114114int alpha_using_srm ;
115115#endif
116116
117- #define N (a ) (sizeof(a)/sizeof(a[0]))
118-
119117static struct alpha_machine_vector * get_sysvec (unsigned long , unsigned long ,
120118 unsigned long );
121119static struct alpha_machine_vector * get_sysvec_byname (const char * );
@@ -240,7 +238,7 @@ reserve_std_resources(void)
240238 standard_io_resources [0 ].start = RTC_PORT (0 );
241239 standard_io_resources [0 ].end = RTC_PORT (0 ) + 0x10 ;
242240
243- for (i = 0 ; i < N (standard_io_resources ); ++ i )
241+ for (i = 0 ; i < ARRAY_SIZE (standard_io_resources ); ++ i )
244242 request_resource (io , standard_io_resources + i );
245243}
246244
@@ -918,13 +916,13 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu)
918916
919917 /* Search the system tables first... */
920918 vec = NULL ;
921- if (type < N (systype_vecs )) {
919+ if (type < ARRAY_SIZE (systype_vecs )) {
922920 vec = systype_vecs [type ];
923921 } else if ((type > ST_API_BIAS ) &&
924- (type - ST_API_BIAS ) < N (api_vecs )) {
922+ (type - ST_API_BIAS ) < ARRAY_SIZE (api_vecs )) {
925923 vec = api_vecs [type - ST_API_BIAS ];
926924 } else if ((type > ST_UNOFFICIAL_BIAS ) &&
927- (type - ST_UNOFFICIAL_BIAS ) < N (unofficial_vecs )) {
925+ (type - ST_UNOFFICIAL_BIAS ) < ARRAY_SIZE (unofficial_vecs )) {
928926 vec = unofficial_vecs [type - ST_UNOFFICIAL_BIAS ];
929927 }
930928
@@ -938,36 +936,36 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu)
938936
939937 switch (type ) {
940938 case ST_DEC_ALCOR :
941- if (member < N (alcor_indices ))
939+ if (member < ARRAY_SIZE (alcor_indices ))
942940 vec = alcor_vecs [alcor_indices [member ]];
943941 break ;
944942 case ST_DEC_EB164 :
945- if (member < N (eb164_indices ))
943+ if (member < ARRAY_SIZE (eb164_indices ))
946944 vec = eb164_vecs [eb164_indices [member ]];
947945 /* PC164 may show as EB164 variation with EV56 CPU,
948946 but, since no true EB164 had anything but EV5... */
949947 if (vec == & eb164_mv && cpu == EV56_CPU )
950948 vec = & pc164_mv ;
951949 break ;
952950 case ST_DEC_EB64P :
953- if (member < N (eb64p_indices ))
951+ if (member < ARRAY_SIZE (eb64p_indices ))
954952 vec = eb64p_vecs [eb64p_indices [member ]];
955953 break ;
956954 case ST_DEC_EB66 :
957- if (member < N (eb66_indices ))
955+ if (member < ARRAY_SIZE (eb66_indices ))
958956 vec = eb66_vecs [eb66_indices [member ]];
959957 break ;
960958 case ST_DEC_MARVEL :
961- if (member < N (marvel_indices ))
959+ if (member < ARRAY_SIZE (marvel_indices ))
962960 vec = marvel_vecs [marvel_indices [member ]];
963961 break ;
964962 case ST_DEC_TITAN :
965963 vec = titan_vecs [0 ]; /* default */
966- if (member < N (titan_indices ))
964+ if (member < ARRAY_SIZE (titan_indices ))
967965 vec = titan_vecs [titan_indices [member ]];
968966 break ;
969967 case ST_DEC_TSUNAMI :
970- if (member < N (tsunami_indices ))
968+ if (member < ARRAY_SIZE (tsunami_indices ))
971969 vec = tsunami_vecs [tsunami_indices [member ]];
972970 break ;
973971 case ST_DEC_1000 :
@@ -1039,7 +1037,7 @@ get_sysvec_byname(const char *name)
10391037
10401038 size_t i ;
10411039
1042- for (i = 0 ; i < N (all_vecs ); ++ i ) {
1040+ for (i = 0 ; i < ARRAY_SIZE (all_vecs ); ++ i ) {
10431041 struct alpha_machine_vector * mv = all_vecs [i ];
10441042 if (strcasecmp (mv -> vector_name , name ) == 0 )
10451043 return mv ;
@@ -1055,13 +1053,13 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu,
10551053
10561054 /* If not in the tables, make it UNKNOWN,
10571055 else set type name to family */
1058- if (type < N (systype_names )) {
1056+ if (type < ARRAY_SIZE (systype_names )) {
10591057 * type_name = systype_names [type ];
10601058 } else if ((type > ST_API_BIAS ) &&
1061- (type - ST_API_BIAS ) < N (api_names )) {
1059+ (type - ST_API_BIAS ) < ARRAY_SIZE (api_names )) {
10621060 * type_name = api_names [type - ST_API_BIAS ];
10631061 } else if ((type > ST_UNOFFICIAL_BIAS ) &&
1064- (type - ST_UNOFFICIAL_BIAS ) < N (unofficial_names )) {
1062+ (type - ST_UNOFFICIAL_BIAS ) < ARRAY_SIZE (unofficial_names )) {
10651063 * type_name = unofficial_names [type - ST_UNOFFICIAL_BIAS ];
10661064 } else {
10671065 * type_name = sys_unknown ;
@@ -1083,40 +1081,40 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu,
10831081 default : /* default to variation "0" for now */
10841082 break ;
10851083 case ST_DEC_EB164 :
1086- if (member < N (eb164_indices ))
1084+ if (member < ARRAY_SIZE (eb164_indices ))
10871085 * variation_name = eb164_names [eb164_indices [member ]];
10881086 /* PC164 may show as EB164 variation, but with EV56 CPU,
10891087 so, since no true EB164 had anything but EV5... */
10901088 if (eb164_indices [member ] == 0 && cpu == EV56_CPU )
10911089 * variation_name = eb164_names [1 ]; /* make it PC164 */
10921090 break ;
10931091 case ST_DEC_ALCOR :
1094- if (member < N (alcor_indices ))
1092+ if (member < ARRAY_SIZE (alcor_indices ))
10951093 * variation_name = alcor_names [alcor_indices [member ]];
10961094 break ;
10971095 case ST_DEC_EB64P :
1098- if (member < N (eb64p_indices ))
1096+ if (member < ARRAY_SIZE (eb64p_indices ))
10991097 * variation_name = eb64p_names [eb64p_indices [member ]];
11001098 break ;
11011099 case ST_DEC_EB66 :
1102- if (member < N (eb66_indices ))
1100+ if (member < ARRAY_SIZE (eb66_indices ))
11031101 * variation_name = eb66_names [eb66_indices [member ]];
11041102 break ;
11051103 case ST_DEC_MARVEL :
1106- if (member < N (marvel_indices ))
1104+ if (member < ARRAY_SIZE (marvel_indices ))
11071105 * variation_name = marvel_names [marvel_indices [member ]];
11081106 break ;
11091107 case ST_DEC_RAWHIDE :
1110- if (member < N (rawhide_indices ))
1108+ if (member < ARRAY_SIZE (rawhide_indices ))
11111109 * variation_name = rawhide_names [rawhide_indices [member ]];
11121110 break ;
11131111 case ST_DEC_TITAN :
11141112 * variation_name = titan_names [0 ]; /* default */
1115- if (member < N (titan_indices ))
1113+ if (member < ARRAY_SIZE (titan_indices ))
11161114 * variation_name = titan_names [titan_indices [member ]];
11171115 break ;
11181116 case ST_DEC_TSUNAMI :
1119- if (member < N (tsunami_indices ))
1117+ if (member < ARRAY_SIZE (tsunami_indices ))
11201118 * variation_name = tsunami_names [tsunami_indices [member ]];
11211119 break ;
11221120 }
@@ -1211,7 +1209,7 @@ show_cpuinfo(struct seq_file *f, void *slot)
12111209
12121210 cpu_index = (unsigned ) (cpu -> type - 1 );
12131211 cpu_name = "Unknown" ;
1214- if (cpu_index < N (cpu_names ))
1212+ if (cpu_index < ARRAY_SIZE (cpu_names ))
12151213 cpu_name = cpu_names [cpu_index ];
12161214
12171215 get_sysnames (hwrpb -> sys_type , hwrpb -> sys_variation ,
0 commit comments