@@ -115,19 +115,18 @@ static const char addressbits[256] = {
115115void __nand_calculate_ecc (const unsigned char * buf , unsigned int eccsize ,
116116 unsigned char * code , bool sm_order )
117117{
118+ const u32 * bp = (uint32_t * )buf ;
119+ const u32 eccsize_mult = eccsize >> 8 ;
120+ /* current value in buffer */
121+ u32 cur ;
122+ /* rp0..rp17 are the various accumulated parities (per byte) */
123+ u32 rp0 , rp1 , rp2 , rp3 , rp4 , rp5 , rp6 , rp7 , rp8 , rp9 , rp10 , rp11 , rp12 ,
124+ rp13 , rp14 , rp15 , rp16 , rp17 ;
125+ /* Cumulative parity for all data */
126+ u32 par ;
127+ /* Cumulative parity at the end of the loop (rp12, rp14, rp16) */
128+ u32 tmppar ;
118129 int i ;
119- const uint32_t * bp = (uint32_t * )buf ;
120- /* 256 or 512 bytes/ecc */
121- const uint32_t eccsize_mult = eccsize >> 8 ;
122- uint32_t cur ; /* current value in buffer */
123- /* rp0..rp15..rp17 are the various accumulated parities (per byte) */
124- uint32_t rp0 , rp1 , rp2 , rp3 , rp4 , rp5 , rp6 , rp7 ;
125- uint32_t rp8 , rp9 , rp10 , rp11 , rp12 , rp13 , rp14 , rp15 , rp16 ;
126- uint32_t rp17 ;
127- uint32_t par ; /* the cumulative parity for all data */
128- uint32_t tmppar ; /* the cumulative parity for this iteration;
129- for rp12, rp14 and rp16 at the end of the
130- loop */
131130
132131 par = 0 ;
133132 rp4 = 0 ;
@@ -372,10 +371,9 @@ int __nand_correct_data(unsigned char *buf,
372371 unsigned char * read_ecc , unsigned char * calc_ecc ,
373372 unsigned int eccsize , bool sm_order )
374373{
374+ const u32 eccsize_mult = eccsize >> 8 ;
375375 unsigned char b0 , b1 , b2 , bit_addr ;
376376 unsigned int byte_addr ;
377- /* 256 or 512 bytes/ecc */
378- const uint32_t eccsize_mult = eccsize >> 8 ;
379377
380378 /*
381379 * b0 to b2 indicate which bit is faulty (if any)
0 commit comments