Skip to content

Commit b551fa3

Browse files
committed
mtd: nand: ecc-hamming: Cleanup and style fixes
Various style fixes. There is not functional change. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-15-miquel.raynal@bootlin.com
1 parent c50e7f3 commit b551fa3

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

‎drivers/mtd/nand/ecc-sw-hamming.c‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,18 @@ static const char addressbits[256] = {
115115
void __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

Comments
 (0)