diff options
-rw-r--r-- | drivers/mtd/nand/raw/cafe_nand.c | 7 | ||||
-rw-r--r-- | drivers/mtd/nand/raw/diskonchip.c | 7 | ||||
-rw-r--r-- | include/linux/rslib.h | 19 | ||||
-rw-r--r-- | lib/reed_solomon/decode_rs.c | 1 | ||||
-rw-r--r-- | lib/reed_solomon/encode_rs.c | 1 | ||||
-rw-r--r-- | lib/reed_solomon/reed_solomon.c | 135 |
6 files changed, 100 insertions, 70 deletions
diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c index d8c8c9d1e640..d721f489b38b 100644 --- a/drivers/mtd/nand/raw/cafe_nand.c +++ b/drivers/mtd/nand/raw/cafe_nand.c | |||
@@ -394,12 +394,13 @@ static int cafe_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, | |||
394 | 394 | ||
395 | for (i=0; i<8; i+=2) { | 395 | for (i=0; i<8; i+=2) { |
396 | uint32_t tmp = cafe_readl(cafe, NAND_ECC_SYN01 + (i*2)); | 396 | uint32_t tmp = cafe_readl(cafe, NAND_ECC_SYN01 + (i*2)); |
397 | syn[i] = cafe->rs->index_of[tmp & 0xfff]; | 397 | |
398 | syn[i+1] = cafe->rs->index_of[(tmp >> 16) & 0xfff]; | 398 | syn[i] = cafe->rs->codec->index_of[tmp & 0xfff]; |
399 | syn[i+1] = cafe->rs->codec->index_of[(tmp >> 16) & 0xfff]; | ||
399 | } | 400 | } |
400 | 401 | ||
401 | n = decode_rs16(cafe->rs, NULL, NULL, 1367, syn, 0, pos, 0, | 402 | n = decode_rs16(cafe->rs, NULL, NULL, 1367, syn, 0, pos, 0, |
402 | pat); | 403 | pat); |
403 | 404 | ||
404 | for (i = 0; i < n; i++) { | 405 | for (i = 0; i < n; i++) { |
405 | int p = pos[i]; | 406 | int p = pos[i]; |
diff --git a/drivers/mtd/nand/raw/diskonchip.c b/drivers/mtd/nand/raw/diskonchip.c index 86a258de0b75..73308333e788 100644 --- a/drivers/mtd/nand/raw/diskonchip.c +++ b/drivers/mtd/nand/raw/diskonchip.c | |||
@@ -140,6 +140,7 @@ static int doc_ecc_decode(struct rs_control *rs, uint8_t *data, uint8_t *ecc) | |||
140 | int i, j, nerr, errpos[8]; | 140 | int i, j, nerr, errpos[8]; |
141 | uint8_t parity; | 141 | uint8_t parity; |
142 | uint16_t ds[4], s[5], tmp, errval[8], syn[4]; | 142 | uint16_t ds[4], s[5], tmp, errval[8], syn[4]; |
143 | struct rs_codec *cd = rs->codec; | ||
143 | 144 | ||
144 | memset(syn, 0, sizeof(syn)); | 145 | memset(syn, 0, sizeof(syn)); |
145 | /* Convert the ecc bytes into words */ | 146 | /* Convert the ecc bytes into words */ |
@@ -160,15 +161,15 @@ static int doc_ecc_decode(struct rs_control *rs, uint8_t *data, uint8_t *ecc) | |||
160 | for (j = 1; j < NROOTS; j++) { | 161 | for (j = 1; j < NROOTS; j++) { |
161 | if (ds[j] == 0) | 162 | if (ds[j] == 0) |
162 | continue; | 163 | continue; |
163 | tmp = rs->index_of[ds[j]]; | 164 | tmp = cd->index_of[ds[j]]; |
164 | for (i = 0; i < NROOTS; i++) | 165 | for (i = 0; i < NROOTS; i++) |
165 | s[i] ^= rs->alpha_to[rs_modnn(rs, tmp + (FCR + i) * j)]; | 166 | s[i] ^= cd->alpha_to[rs_modnn(cd, tmp + (FCR + i) * j)]; |
166 | } | 167 | } |
167 | 168 | ||
168 | /* Calc syn[i] = s[i] / alpha^(v + i) */ | 169 | /* Calc syn[i] = s[i] / alpha^(v + i) */ |
169 | for (i = 0; i < NROOTS; i++) { | 170 | for (i = 0; i < NROOTS; i++) { |
170 | if (s[i]) | 171 | if (s[i]) |
171 | syn[i] = rs_modnn(rs, rs->index_of[s[i]] + (NN - FCR - i)); | 172 | syn[i] = rs_modnn(cd, cd->index_of[s[i]] + (NN - FCR - i)); |
172 | } | 173 | } |
173 | /* Call the decoder library */ | 174 | /* Call the decoder library */ |
174 | nerr = decode_rs16(rs, NULL, NULL, 1019, syn, 0, errpos, 0, errval); | 175 | nerr = decode_rs16(rs, NULL, NULL, 1019, syn, 0, errpos, 0, errval); |
diff --git a/include/linux/rslib.h b/include/linux/rslib.h index 27652c18bf8c..6703311beea3 100644 --- a/include/linux/rslib.h +++ b/include/linux/rslib.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/gfp.h> /* for GFP_KERNEL */ | 15 | #include <linux/gfp.h> /* for GFP_KERNEL */ |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * struct rs_control - rs control structure | 18 | * struct rs_codec - rs codec data |
19 | * | 19 | * |
20 | * @mm: Bits per symbol | 20 | * @mm: Bits per symbol |
21 | * @nn: Symbols per block (= (1<<mm)-1) | 21 | * @nn: Symbols per block (= (1<<mm)-1) |
@@ -29,9 +29,9 @@ | |||
29 | * @gfpoly: The primitive generator polynominal | 29 | * @gfpoly: The primitive generator polynominal |
30 | * @gffunc: Function to generate the field, if non-canonical representation | 30 | * @gffunc: Function to generate the field, if non-canonical representation |
31 | * @users: Users of this structure | 31 | * @users: Users of this structure |
32 | * @list: List entry for the rs control list | 32 | * @list: List entry for the rs codec list |
33 | */ | 33 | */ |
34 | struct rs_control { | 34 | struct rs_codec { |
35 | int mm; | 35 | int mm; |
36 | int nn; | 36 | int nn; |
37 | uint16_t *alpha_to; | 37 | uint16_t *alpha_to; |
@@ -47,6 +47,14 @@ struct rs_control { | |||
47 | struct list_head list; | 47 | struct list_head list; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | /** | ||
51 | * struct rs_control - rs control structure per instance | ||
52 | * @codec: The codec used for this instance | ||
53 | */ | ||
54 | struct rs_control { | ||
55 | struct rs_codec *codec; | ||
56 | }; | ||
57 | |||
50 | /* General purpose RS codec, 8-bit data width, symbol width 1-15 bit */ | 58 | /* General purpose RS codec, 8-bit data width, symbol width 1-15 bit */ |
51 | #ifdef CONFIG_REED_SOLOMON_ENC8 | 59 | #ifdef CONFIG_REED_SOLOMON_ENC8 |
52 | int encode_rs8(struct rs_control *rs, uint8_t *data, int len, uint16_t *par, | 60 | int encode_rs8(struct rs_control *rs, uint8_t *data, int len, uint16_t *par, |
@@ -69,7 +77,6 @@ int decode_rs16(struct rs_control *rs, uint16_t *data, uint16_t *par, int len, | |||
69 | uint16_t *corr); | 77 | uint16_t *corr); |
70 | #endif | 78 | #endif |
71 | 79 | ||
72 | /* Create or get a matching rs control structure */ | ||
73 | struct rs_control *init_rs_gfp(int symsize, int gfpoly, int fcr, int prim, | 80 | struct rs_control *init_rs_gfp(int symsize, int gfpoly, int fcr, int prim, |
74 | int nroots, gfp_t gfp); | 81 | int nroots, gfp_t gfp); |
75 | 82 | ||
@@ -100,7 +107,7 @@ void free_rs(struct rs_control *rs); | |||
100 | 107 | ||
101 | /** modulo replacement for galois field arithmetics | 108 | /** modulo replacement for galois field arithmetics |
102 | * | 109 | * |
103 | * @rs: the rs control structure | 110 | * @rs: Pointer to the RS codec |
104 | * @x: the value to reduce | 111 | * @x: the value to reduce |
105 | * | 112 | * |
106 | * where | 113 | * where |
@@ -110,7 +117,7 @@ void free_rs(struct rs_control *rs); | |||
110 | * Simple arithmetic modulo would return a wrong result for values | 117 | * Simple arithmetic modulo would return a wrong result for values |
111 | * >= 3 * rs->nn | 118 | * >= 3 * rs->nn |
112 | */ | 119 | */ |
113 | static inline int rs_modnn(struct rs_control *rs, int x) | 120 | static inline int rs_modnn(struct rs_codec *rs, int x) |
114 | { | 121 | { |
115 | while (x >= rs->nn) { | 122 | while (x >= rs->nn) { |
116 | x -= rs->nn; | 123 | x -= rs->nn; |
diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c index d61007ade4a0..794cced31c75 100644 --- a/lib/reed_solomon/decode_rs.c +++ b/lib/reed_solomon/decode_rs.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * Generic data width independent code which is included by the wrappers. | 10 | * Generic data width independent code which is included by the wrappers. |
11 | */ | 11 | */ |
12 | { | 12 | { |
13 | struct rs_codec *rs = rsc->codec; | ||
13 | int deg_lambda, el, deg_omega; | 14 | int deg_lambda, el, deg_omega; |
14 | int i, j, r, k, pad; | 15 | int i, j, r, k, pad; |
15 | int nn = rs->nn; | 16 | int nn = rs->nn; |
diff --git a/lib/reed_solomon/encode_rs.c b/lib/reed_solomon/encode_rs.c index 10ca1ebb13dd..9112d46e869e 100644 --- a/lib/reed_solomon/encode_rs.c +++ b/lib/reed_solomon/encode_rs.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * Generic data width independent code which is included by the wrappers. | 10 | * Generic data width independent code which is included by the wrappers. |
11 | */ | 11 | */ |
12 | { | 12 | { |
13 | struct rs_codec *rs = rsc->codec; | ||
13 | int i, j, pad; | 14 | int i, j, pad; |
14 | int nn = rs->nn; | 15 | int nn = rs->nn; |
15 | int nroots = rs->nroots; | 16 | int nroots = rs->nroots; |
diff --git a/lib/reed_solomon/reed_solomon.c b/lib/reed_solomon/reed_solomon.c index 02c19ecffc28..cb21e8b5a4e0 100644 --- a/lib/reed_solomon/reed_solomon.c +++ b/lib/reed_solomon/reed_solomon.c | |||
@@ -11,22 +11,23 @@ | |||
11 | * | 11 | * |
12 | * The generic Reed Solomon library provides runtime configurable | 12 | * The generic Reed Solomon library provides runtime configurable |
13 | * encoding / decoding of RS codes. | 13 | * encoding / decoding of RS codes. |
14 | * Each user must call init_rs to get a pointer to a rs_control | 14 | * |
15 | * structure for the given rs parameters. This structure is either | 15 | * Each user must call init_rs to get a pointer to a rs_control structure |
16 | * generated or a already available matching control structure is used. | 16 | * for the given rs parameters. The control struct is unique per instance. |
17 | * If a structure is generated then the polynomial arrays for | 17 | * It points to a codec which can be shared by multiple control structures. |
18 | * fast encoding / decoding are built. This can take some time so | 18 | * If a codec is newly allocated then the polynomial arrays for fast |
19 | * make sure not to call this function from a time critical path. | 19 | * encoding / decoding are built. This can take some time so make sure not |
20 | * Usually a module / driver should initialize the necessary | 20 | * to call this function from a time critical path. Usually a module / |
21 | * rs_control structure on module / driver init and release it | 21 | * driver should initialize the necessary rs_control structure on module / |
22 | * on exit. | 22 | * driver init and release it on exit. |
23 | * The encoding puts the calculated syndrome into a given syndrome | 23 | * |
24 | * buffer. | 24 | * The encoding puts the calculated syndrome into a given syndrome buffer. |
25 | * The decoding is a two step process. The first step calculates | 25 | * |
26 | * the syndrome over the received (data + syndrome) and calls the | 26 | * The decoding is a two step process. The first step calculates the |
27 | * second stage, which does the decoding / error correction itself. | 27 | * syndrome over the received (data + syndrome) and calls the second stage, |
28 | * Many hw encoders provide a syndrome calculation over the received | 28 | * which does the decoding / error correction itself. Many hw encoders |
29 | * data + syndrome and can call the second stage directly. | 29 | * provide a syndrome calculation over the received data + syndrome and can |
30 | * call the second stage directly. | ||
30 | */ | 31 | */ |
31 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
32 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
@@ -36,13 +37,13 @@ | |||
36 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
37 | #include <linux/mutex.h> | 38 | #include <linux/mutex.h> |
38 | 39 | ||
39 | /* This list holds all currently allocated rs control structures */ | 40 | /* This list holds all currently allocated rs codec structures */ |
40 | static LIST_HEAD (rslist); | 41 | static LIST_HEAD(codec_list); |
41 | /* Protection for the list */ | 42 | /* Protection for the list */ |
42 | static DEFINE_MUTEX(rslistlock); | 43 | static DEFINE_MUTEX(rslistlock); |
43 | 44 | ||
44 | /** | 45 | /** |
45 | * rs_init - Initialize a Reed-Solomon codec | 46 | * codec_init - Initialize a Reed-Solomon codec |
46 | * @symsize: symbol size, bits (1-8) | 47 | * @symsize: symbol size, bits (1-8) |
47 | * @gfpoly: Field generator polynomial coefficients | 48 | * @gfpoly: Field generator polynomial coefficients |
48 | * @gffunc: Field generator function | 49 | * @gffunc: Field generator function |
@@ -51,14 +52,14 @@ static DEFINE_MUTEX(rslistlock); | |||
51 | * @nroots: RS code generator polynomial degree (number of roots) | 52 | * @nroots: RS code generator polynomial degree (number of roots) |
52 | * @gfp: GFP_ flags for allocations | 53 | * @gfp: GFP_ flags for allocations |
53 | * | 54 | * |
54 | * Allocate a control structure and the polynom arrays for faster | 55 | * Allocate a codec structure and the polynom arrays for faster |
55 | * en/decoding. Fill the arrays according to the given parameters. | 56 | * en/decoding. Fill the arrays according to the given parameters. |
56 | */ | 57 | */ |
57 | static struct rs_control *rs_init(int symsize, int gfpoly, int (*gffunc)(int), | 58 | static struct rs_codec *codec_init(int symsize, int gfpoly, int (*gffunc)(int), |
58 | int fcr, int prim, int nroots, gfp_t gfp) | 59 | int fcr, int prim, int nroots, gfp_t gfp) |
59 | { | 60 | { |
60 | struct rs_control *rs; | ||
61 | int i, j, sr, root, iprim; | 61 | int i, j, sr, root, iprim; |
62 | struct rs_codec *rs; | ||
62 | 63 | ||
63 | rs = kzalloc(sizeof(*rs), gfp); | 64 | rs = kzalloc(sizeof(*rs), gfp); |
64 | if (!rs) | 65 | if (!rs) |
@@ -138,6 +139,9 @@ static struct rs_control *rs_init(int symsize, int gfpoly, int (*gffunc)(int), | |||
138 | /* convert rs->genpoly[] to index form for quicker encoding */ | 139 | /* convert rs->genpoly[] to index form for quicker encoding */ |
139 | for (i = 0; i <= nroots; i++) | 140 | for (i = 0; i <= nroots; i++) |
140 | rs->genpoly[i] = rs->index_of[rs->genpoly[i]]; | 141 | rs->genpoly[i] = rs->index_of[rs->genpoly[i]]; |
142 | |||
143 | rs->users = 1; | ||
144 | list_add(&rs->list, &codec_list); | ||
141 | return rs; | 145 | return rs; |
142 | 146 | ||
143 | err: | 147 | err: |
@@ -150,27 +154,37 @@ err: | |||
150 | 154 | ||
151 | 155 | ||
152 | /** | 156 | /** |
153 | * free_rs - Free the rs control structure, if it is no longer used | 157 | * free_rs - Free the rs control structure |
154 | * @rs: the control structure which is not longer used by the | 158 | * @rs: The control structure which is not longer used by the |
155 | * caller | 159 | * caller |
160 | * | ||
161 | * Free the control structure. If @rs is the last user of the associated | ||
162 | * codec, free the codec as well. | ||
156 | */ | 163 | */ |
157 | void free_rs(struct rs_control *rs) | 164 | void free_rs(struct rs_control *rs) |
158 | { | 165 | { |
166 | struct rs_codec *cd; | ||
167 | |||
168 | if (!rs) | ||
169 | return; | ||
170 | |||
171 | cd = rs->codec; | ||
159 | mutex_lock(&rslistlock); | 172 | mutex_lock(&rslistlock); |
160 | rs->users--; | 173 | cd->users--; |
161 | if(!rs->users) { | 174 | if(!cd->users) { |
162 | list_del(&rs->list); | 175 | list_del(&cd->list); |
163 | kfree(rs->alpha_to); | 176 | kfree(cd->alpha_to); |
164 | kfree(rs->index_of); | 177 | kfree(cd->index_of); |
165 | kfree(rs->genpoly); | 178 | kfree(cd->genpoly); |
166 | kfree(rs); | 179 | kfree(cd); |
167 | } | 180 | } |
168 | mutex_unlock(&rslistlock); | 181 | mutex_unlock(&rslistlock); |
182 | kfree(rs); | ||
169 | } | 183 | } |
170 | EXPORT_SYMBOL_GPL(free_rs); | 184 | EXPORT_SYMBOL_GPL(free_rs); |
171 | 185 | ||
172 | /** | 186 | /** |
173 | * init_rs_internal - Find a matching or allocate a new rs control structure | 187 | * init_rs_internal - Allocate rs control, find a matching codec or allocate a new one |
174 | * @symsize: the symbol size (number of bits) | 188 | * @symsize: the symbol size (number of bits) |
175 | * @gfpoly: the extended Galois field generator polynomial coefficients, | 189 | * @gfpoly: the extended Galois field generator polynomial coefficients, |
176 | * with the 0th coefficient in the low order bit. The polynomial | 190 | * with the 0th coefficient in the low order bit. The polynomial |
@@ -201,33 +215,39 @@ static struct rs_control *init_rs_internal(int symsize, int gfpoly, | |||
201 | if (nroots < 0 || nroots >= (1<<symsize)) | 215 | if (nroots < 0 || nroots >= (1<<symsize)) |
202 | return NULL; | 216 | return NULL; |
203 | 217 | ||
218 | rs = kzalloc(sizeof(*rs), GFP_KERNEL); | ||
219 | if (!rs) | ||
220 | return NULL; | ||
221 | |||
204 | mutex_lock(&rslistlock); | 222 | mutex_lock(&rslistlock); |
205 | 223 | ||
206 | /* Walk through the list and look for a matching entry */ | 224 | /* Walk through the list and look for a matching entry */ |
207 | list_for_each(tmp, &rslist) { | 225 | list_for_each(tmp, &codec_list) { |
208 | rs = list_entry(tmp, struct rs_control, list); | 226 | struct rs_codec *cd = list_entry(tmp, struct rs_codec, list); |
209 | if (symsize != rs->mm) | 227 | |
228 | if (symsize != cd->mm) | ||
210 | continue; | 229 | continue; |
211 | if (gfpoly != rs->gfpoly) | 230 | if (gfpoly != cd->gfpoly) |
212 | continue; | 231 | continue; |
213 | if (gffunc != rs->gffunc) | 232 | if (gffunc != cd->gffunc) |
214 | continue; | 233 | continue; |
215 | if (fcr != rs->fcr) | 234 | if (fcr != cd->fcr) |
216 | continue; | 235 | continue; |
217 | if (prim != rs->prim) | 236 | if (prim != cd->prim) |
218 | continue; | 237 | continue; |
219 | if (nroots != rs->nroots) | 238 | if (nroots != cd->nroots) |
220 | continue; | 239 | continue; |
221 | /* We have a matching one already */ | 240 | /* We have a matching one already */ |
222 | rs->users++; | 241 | cd->users++; |
242 | rs->codec = cd; | ||
223 | goto out; | 243 | goto out; |
224 | } | 244 | } |
225 | 245 | ||
226 | /* Create a new one */ | 246 | /* Create a new one */ |
227 | rs = rs_init(symsize, gfpoly, gffunc, fcr, prim, nroots, gfp); | 247 | rs->codec = codec_init(symsize, gfpoly, gffunc, fcr, prim, nroots, gfp); |
228 | if (rs) { | 248 | if (!rs->codec) { |
229 | rs->users = 1; | 249 | kfree(rs); |
230 | list_add(&rs->list, &rslist); | 250 | rs = NULL; |
231 | } | 251 | } |
232 | out: | 252 | out: |
233 | mutex_unlock(&rslistlock); | 253 | mutex_unlock(&rslistlock); |
@@ -235,7 +255,7 @@ out: | |||
235 | } | 255 | } |
236 | 256 | ||
237 | /** | 257 | /** |
238 | * init_rs_gfp - Find a matching or allocate a new rs control structure | 258 | * init_rs_gfp - Create a RS control struct and initialize it |
239 | * @symsize: the symbol size (number of bits) | 259 | * @symsize: the symbol size (number of bits) |
240 | * @gfpoly: the extended Galois field generator polynomial coefficients, | 260 | * @gfpoly: the extended Galois field generator polynomial coefficients, |
241 | * with the 0th coefficient in the low order bit. The polynomial | 261 | * with the 0th coefficient in the low order bit. The polynomial |
@@ -254,9 +274,8 @@ struct rs_control *init_rs_gfp(int symsize, int gfpoly, int fcr, int prim, | |||
254 | EXPORT_SYMBOL_GPL(init_rs_gfp); | 274 | EXPORT_SYMBOL_GPL(init_rs_gfp); |
255 | 275 | ||
256 | /** | 276 | /** |
257 | * init_rs_non_canonical - Find a matching or allocate a new rs control | 277 | * init_rs_non_canonical - Allocate rs control struct for fields with |
258 | * structure, for fields with non-canonical | 278 | * non-canonical representation |
259 | * representation | ||
260 | * @symsize: the symbol size (number of bits) | 279 | * @symsize: the symbol size (number of bits) |
261 | * @gffunc: pointer to function to generate the next field element, | 280 | * @gffunc: pointer to function to generate the next field element, |
262 | * or the multiplicative identity element if given 0. Used | 281 | * or the multiplicative identity element if given 0. Used |
@@ -277,7 +296,7 @@ EXPORT_SYMBOL_GPL(init_rs_non_canonical); | |||
277 | #ifdef CONFIG_REED_SOLOMON_ENC8 | 296 | #ifdef CONFIG_REED_SOLOMON_ENC8 |
278 | /** | 297 | /** |
279 | * encode_rs8 - Calculate the parity for data values (8bit data width) | 298 | * encode_rs8 - Calculate the parity for data values (8bit data width) |
280 | * @rs: the rs control structure | 299 | * @rsc: the rs control structure |
281 | * @data: data field of a given type | 300 | * @data: data field of a given type |
282 | * @len: data length | 301 | * @len: data length |
283 | * @par: parity data, must be initialized by caller (usually all 0) | 302 | * @par: parity data, must be initialized by caller (usually all 0) |
@@ -287,7 +306,7 @@ EXPORT_SYMBOL_GPL(init_rs_non_canonical); | |||
287 | * symbol size > 8. The calling code must take care of encoding of the | 306 | * symbol size > 8. The calling code must take care of encoding of the |
288 | * syndrome result for storage itself. | 307 | * syndrome result for storage itself. |
289 | */ | 308 | */ |
290 | int encode_rs8(struct rs_control *rs, uint8_t *data, int len, uint16_t *par, | 309 | int encode_rs8(struct rs_control *rsc, uint8_t *data, int len, uint16_t *par, |
291 | uint16_t invmsk) | 310 | uint16_t invmsk) |
292 | { | 311 | { |
293 | #include "encode_rs.c" | 312 | #include "encode_rs.c" |
@@ -298,7 +317,7 @@ EXPORT_SYMBOL_GPL(encode_rs8); | |||
298 | #ifdef CONFIG_REED_SOLOMON_DEC8 | 317 | #ifdef CONFIG_REED_SOLOMON_DEC8 |
299 | /** | 318 | /** |
300 | * decode_rs8 - Decode codeword (8bit data width) | 319 | * decode_rs8 - Decode codeword (8bit data width) |
301 | * @rs: the rs control structure | 320 | * @rsc: the rs control structure |
302 | * @data: data field of a given type | 321 | * @data: data field of a given type |
303 | * @par: received parity data field | 322 | * @par: received parity data field |
304 | * @len: data length | 323 | * @len: data length |
@@ -313,7 +332,7 @@ EXPORT_SYMBOL_GPL(encode_rs8); | |||
313 | * syndrome result and the received parity before calling this code. | 332 | * syndrome result and the received parity before calling this code. |
314 | * Returns the number of corrected bits or -EBADMSG for uncorrectable errors. | 333 | * Returns the number of corrected bits or -EBADMSG for uncorrectable errors. |
315 | */ | 334 | */ |
316 | int decode_rs8(struct rs_control *rs, uint8_t *data, uint16_t *par, int len, | 335 | int decode_rs8(struct rs_control *rsc, uint8_t *data, uint16_t *par, int len, |
317 | uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk, | 336 | uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk, |
318 | uint16_t *corr) | 337 | uint16_t *corr) |
319 | { | 338 | { |
@@ -325,7 +344,7 @@ EXPORT_SYMBOL_GPL(decode_rs8); | |||
325 | #ifdef CONFIG_REED_SOLOMON_ENC16 | 344 | #ifdef CONFIG_REED_SOLOMON_ENC16 |
326 | /** | 345 | /** |
327 | * encode_rs16 - Calculate the parity for data values (16bit data width) | 346 | * encode_rs16 - Calculate the parity for data values (16bit data width) |
328 | * @rs: the rs control structure | 347 | * @rsc: the rs control structure |
329 | * @data: data field of a given type | 348 | * @data: data field of a given type |
330 | * @len: data length | 349 | * @len: data length |
331 | * @par: parity data, must be initialized by caller (usually all 0) | 350 | * @par: parity data, must be initialized by caller (usually all 0) |
@@ -333,7 +352,7 @@ EXPORT_SYMBOL_GPL(decode_rs8); | |||
333 | * | 352 | * |
334 | * Each field in the data array contains up to symbol size bits of valid data. | 353 | * Each field in the data array contains up to symbol size bits of valid data. |
335 | */ | 354 | */ |
336 | int encode_rs16(struct rs_control *rs, uint16_t *data, int len, uint16_t *par, | 355 | int encode_rs16(struct rs_control *rsc, uint16_t *data, int len, uint16_t *par, |
337 | uint16_t invmsk) | 356 | uint16_t invmsk) |
338 | { | 357 | { |
339 | #include "encode_rs.c" | 358 | #include "encode_rs.c" |
@@ -344,7 +363,7 @@ EXPORT_SYMBOL_GPL(encode_rs16); | |||
344 | #ifdef CONFIG_REED_SOLOMON_DEC16 | 363 | #ifdef CONFIG_REED_SOLOMON_DEC16 |
345 | /** | 364 | /** |
346 | * decode_rs16 - Decode codeword (16bit data width) | 365 | * decode_rs16 - Decode codeword (16bit data width) |
347 | * @rs: the rs control structure | 366 | * @rsc: the rs control structure |
348 | * @data: data field of a given type | 367 | * @data: data field of a given type |
349 | * @par: received parity data field | 368 | * @par: received parity data field |
350 | * @len: data length | 369 | * @len: data length |
@@ -357,7 +376,7 @@ EXPORT_SYMBOL_GPL(encode_rs16); | |||
357 | * Each field in the data array contains up to symbol size bits of valid data. | 376 | * Each field in the data array contains up to symbol size bits of valid data. |
358 | * Returns the number of corrected bits or -EBADMSG for uncorrectable errors. | 377 | * Returns the number of corrected bits or -EBADMSG for uncorrectable errors. |
359 | */ | 378 | */ |
360 | int decode_rs16(struct rs_control *rs, uint16_t *data, uint16_t *par, int len, | 379 | int decode_rs16(struct rs_control *rsc, uint16_t *data, uint16_t *par, int len, |
361 | uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk, | 380 | uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk, |
362 | uint16_t *corr) | 381 | uint16_t *corr) |
363 | { | 382 | { |