| @@ -23,15 +23,15 @@ · 22 unmodified lines |
| 23 | 23 | * This library provides runtime configurable encoding/decoding of binary |
| 24 | 24 | * Bose-Chaudhuri-Hocquenghem (BCH) codes. |
| 25 | 25 | * |
| 26 | | − * Call init_bch to get a pointer to a newly allocated bch_control structure for |
| 26 | + * Call bch_init to get a pointer to a newly allocated bch_control structure for |
| 27 | 27 | * the given m (Galois field order), t (error correction capability) and |
| 28 | 28 | * (optional) primitive polynomial parameters. |
| 29 | 29 | * |
| 30 | | − * Call encode_bch to compute and store ecc parity bytes to a given buffer. |
| 31 | | − * Call decode_bch to detect and locate errors in received data. |
| 30 | + * Call bch_encode to compute and store ecc parity bytes to a given buffer. |
| 31 | + * Call bch_decode to detect and locate errors in received data. |
| 32 | 32 | * |
| 33 | 33 | * On systems supporting hw BCH features, intermediate results may be provided |
| 34 | | − * to decode_bch in order to skip certain steps. See decode_bch() documentation |
| 34 | + * to bch_decode in order to skip certain steps. See bch_decode() documentation |
| 35 | 35 | * for details. |
| 36 | 36 | * |
| 37 | 37 | * Option CONFIG_BCH_CONST_PARAMS can be used to force fixed values of |
| @@ -115,9 +115,9 @@ struct gf_poly_deg1 { · 77 unmodified lines |
| 115 | 115 | }; |
| 116 | 116 | |
| 117 | 117 | /* |
| 118 | | − * same as encode_bch(), but process input data one byte at a time |
| 118 | + * same as bch_encode(), but process input data one byte at a time |
| 119 | 119 | */ |
| 120 | | −static void encode_bch_unaligned(struct bch_control *bch, |
| 120 | +static void bch_encode_unaligned(struct bch_control *bch, |
| 121 | 121 | const unsigned char *data, unsigned int len, |
| 122 | 122 | uint32_t *ecc) |
| 123 | 123 | { |
| @@ -174,7 +174,7 @@ static void store_ecc8(struct bch_control *bch, uint8_t *dst, · 50 unmodified lines |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | | − * encode_bch - calculate BCH ecc parity of data |
| 177 | + * bch_encode - calculate BCH ecc parity of data |
| 178 | 178 | * @bch: BCH control structure |
| 179 | 179 | * @data: data to encode |
| 180 | 180 | * @len: data length in bytes |
| @@ -187,7 +187,7 @@ static void store_ecc8(struct bch_control *bch, uint8_t *dst, · 6 unmodified lines |
| 187 | 187 | * The exact number of computed ecc parity bits is given by member @ecc_bits of |
| 188 | 188 | * @bch; it may be less than m*t for large values of t. |
| 189 | 189 | */ |
| 190 | | −void encode_bch(struct bch_control *bch, const uint8_t *data, |
| 190 | +void bch_encode(struct bch_control *bch, const uint8_t *data, |
| 191 | 191 | unsigned int len, uint8_t *ecc) |
| 192 | 192 | { |
| 193 | 193 | const unsigned int l = BCH_ECC_WORDS(bch)-1; |
| @@ -215,7 +215,7 @@ void encode_bch(struct bch_control *bch, const uint8_t *data, · 21 unmodified lines |
| 215 | 215 | m = ((unsigned long)data) & 3; |
| 216 | 216 | if (m) { |
| 217 | 217 | mlen = (len < (4-m)) ? len : 4-m; |
| 218 | | − encode_bch_unaligned(bch, data, mlen, bch->ecc_buf); |
| 218 | + bch_encode_unaligned(bch, data, mlen, bch->ecc_buf); |
| 219 | 219 | data += mlen; |
| 220 | 220 | len -= mlen; |
| 221 | 221 | } |
| @@ -255,13 +255,13 @@ void encode_bch(struct bch_control *bch, const uint8_t *data, · 33 unmodified lines |
| 255 | 255 | |
| 256 | 256 | /* process last unaligned bytes */ |
| 257 | 257 | if (len) |
| 258 | | − encode_bch_unaligned(bch, data, len, bch->ecc_buf); |
| 258 | + bch_encode_unaligned(bch, data, len, bch->ecc_buf); |
| 259 | 259 | |
| 260 | 260 | /* store ecc parity bytes into original parity buffer */ |
| 261 | 261 | if (ecc) |
| 262 | 262 | store_ecc8(bch, ecc, bch->ecc_buf); |
| 263 | 263 | } |
| 264 | | −EXPORT_SYMBOL_GPL(encode_bch); |
| 264 | +EXPORT_SYMBOL_GPL(bch_encode); |
| 265 | 265 | |
| 266 | 266 | static inline int modulo(struct bch_control *bch, unsigned int v) |
| 267 | 267 | { |
| @@ -952,7 +952,7 @@ static int chien_search(struct bch_control *bch, unsigned int len, · 684 unmodified lines |
| 952 | 952 | #endif /* USE_CHIEN_SEARCH */ |
| 953 | 953 | |
| 954 | 954 | /** |
| 955 | | − * decode_bch - decode received codeword and find bit error locations |
| 955 | + * bch_decode - decode received codeword and find bit error locations |
| 956 | 956 | * @bch: BCH control structure |
| 957 | 957 | * @data: received data, ignored if @calc_ecc is provided |
| 958 | 958 | * @len: data length in bytes, must always be provided |
| @@ -966,22 +966,22 @@ static int chien_search(struct bch_control *bch, unsigned int len, · 7 unmodified lines |
| 966 | 966 | * invalid parameters were provided |
| 967 | 967 | * |
| 968 | 968 | * Depending on the available hw BCH support and the need to compute @calc_ecc |
| 969 | | − * separately (using encode_bch()), this function should be called with one of |
| 969 | + * separately (using bch_encode()), this function should be called with one of |
| 970 | 970 | * the following parameter configurations - |
| 971 | 971 | * |
| 972 | 972 | * by providing @data and @recv_ecc only: |
| 973 | | − * decode_bch(@bch, @data, @len, @recv_ecc, NULL, NULL, @errloc) |
| 973 | + * bch_decode(@bch, @data, @len, @recv_ecc, NULL, NULL, @errloc) |
| 974 | 974 | * |
| 975 | 975 | * by providing @recv_ecc and @calc_ecc: |
| 976 | | − * decode_bch(@bch, NULL, @len, @recv_ecc, @calc_ecc, NULL, @errloc) |
| 976 | + * bch_decode(@bch, NULL, @len, @recv_ecc, @calc_ecc, NULL, @errloc) |
| 977 | 977 | * |
| 978 | 978 | * by providing ecc = recv_ecc XOR calc_ecc: |
| 979 | | − * decode_bch(@bch, NULL, @len, NULL, ecc, NULL, @errloc) |
| 979 | + * bch_decode(@bch, NULL, @len, NULL, ecc, NULL, @errloc) |
| 980 | 980 | * |
| 981 | 981 | * by providing syndrome results @syn: |
| 982 | | − * decode_bch(@bch, NULL, @len, NULL, NULL, @syn, @errloc) |
| 982 | + * bch_decode(@bch, NULL, @len, NULL, NULL, @syn, @errloc) |
| 983 | 983 | * |
| 984 | | − * Once decode_bch() has successfully returned with a positive value, error |
| 984 | + * Once bch_decode() has successfully returned with a positive value, error |
| 985 | 985 | * locations returned in array @errloc should be interpreted as follows - |
| 986 | 986 | * |
| 987 | 987 | * if (errloc[n] >= 8*len), then n-th error is located in ecc (no need for |
| @@ -993,7 +993,7 @@ static int chien_search(struct bch_control *bch, unsigned int len, · 5 unmodified lines |
| 993 | 993 | * Note that this function does not perform any data correction by itself, it |
| 994 | 994 | * merely indicates error locations. |
| 995 | 995 | */ |
| 996 | | −int decode_bch(struct bch_control *bch, const uint8_t *data, unsigned int len, |
| 996 | +int bch_decode(struct bch_control *bch, const uint8_t *data, unsigned int len, |
| 997 | 997 | const uint8_t *recv_ecc, const uint8_t *calc_ecc, |
| 998 | 998 | const unsigned int *syn, unsigned int *errloc) |
| 999 | 999 | { |
| @@ -1012,7 +1012,7 @@ int decode_bch(struct bch_control *bch, const uint8_t *data, unsigned int len, · 12 unmodified lines |
| 1012 | 1012 | /* compute received data ecc into an internal buffer */ |
| 1013 | 1013 | if (!data || !recv_ecc) |
| 1014 | 1014 | return -EINVAL; |
| 1015 | | − encode_bch(bch, data, len, NULL); |
| 1015 | + bch_encode(bch, data, len, NULL); |
| 1016 | 1016 | } else { |
| 1017 | 1017 | /* load provided calculated ecc */ |
| 1018 | 1018 | load_ecc8(bch, bch->ecc_buf, calc_ecc); |
| @@ -1053,7 +1053,7 @@ int decode_bch(struct bch_control *bch, const uint8_t *data, unsigned int len, · 34 unmodified lines |
| 1053 | 1053 | } |
| 1054 | 1054 | return (err >= 0) ? err : -EBADMSG; |
| 1055 | 1055 | } |
| 1056 | | −EXPORT_SYMBOL_GPL(decode_bch); |
| 1056 | +EXPORT_SYMBOL_GPL(bch_decode); |
| 1057 | 1057 | |
| 1058 | 1058 | /* |
| 1059 | 1059 | * generate Galois field lookup tables |
| @@ -1236,7 +1236,7 @@ finish: · 176 unmodified lines |
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | /** |
| 1239 | | − * init_bch - initialize a BCH encoder/decoder |
| 1239 | + * bch_init - initialize a BCH encoder/decoder |
| 1240 | 1240 | * @m: Galois field order, should be in the range 5-15 |
| 1241 | 1241 | * @t: maximum error correction capability, in bits |
| 1242 | 1242 | * @prim_poly: user-provided primitive polynomial (or 0 to use default) |
| @@ -1246,17 +1246,17 @@ finish: · 3 unmodified lines |
| 1246 | 1246 | * |
| 1247 | 1247 | * This initialization can take some time, as lookup tables are built for fast |
| 1248 | 1248 | * encoding/decoding; make sure not to call this function from a time critical |
| 1249 | | − * path. Usually, init_bch() should be called on module/driver init and |
| 1250 | | − * free_bch() should be called to release memory on exit. |
| 1249 | + * path. Usually, bch_init() should be called on module/driver init and |
| 1250 | + * bch_free() should be called to release memory on exit. |
| 1251 | 1251 | * |
| 1252 | 1252 | * You may provide your own primitive polynomial of degree @m in argument |
| 1253 | | − * @prim_poly, or let init_bch() use its default polynomial. |
| 1253 | + * @prim_poly, or let bch_init() use its default polynomial. |
| 1254 | 1254 | * |
| 1255 | | − * Once init_bch() has successfully returned a pointer to a newly allocated |
| 1255 | + * Once bch_init() has successfully returned a pointer to a newly allocated |
| 1256 | 1256 | * BCH control structure, ecc length in bytes is given by member @ecc_bytes of |
| 1257 | 1257 | * the structure. |
| 1258 | 1258 | */ |
| 1259 | | −struct bch_control *init_bch(int m, int t, unsigned int prim_poly) |
| 1259 | +struct bch_control *bch_init(int m, int t, unsigned int prim_poly) |
| 1260 | 1260 | { |
| 1261 | 1261 | int err = 0; |
| 1262 | 1262 | unsigned int i, words; |
| @@ -1347,16 +1347,16 @@ struct bch_control *init_bch(int m, int t, unsigned int prim_poly) · 84 unmodified lines |
| 1347 | 1347 | return bch; |
| 1348 | 1348 | |
| 1349 | 1349 | fail: |
| 1350 | | − free_bch(bch); |
| 1350 | + bch_free(bch); |
| 1351 | 1351 | return NULL; |
| 1352 | 1352 | } |
| 1353 | | −EXPORT_SYMBOL_GPL(init_bch); |
| 1353 | +EXPORT_SYMBOL_GPL(bch_init); |
| 1354 | 1354 | |
| 1355 | 1355 | /** |
| 1356 | | − * free_bch - free the BCH control structure |
| 1356 | + * bch_free - free the BCH control structure |
| 1357 | 1357 | * @bch: BCH control structure to release |
| 1358 | 1358 | */ |
| 1359 | | −void free_bch(struct bch_control *bch) |
| 1359 | +void bch_free(struct bch_control *bch) |
| 1360 | 1360 | { |
| 1361 | 1361 | unsigned int i; |
| 1362 | 1362 | |
| @@ -1377,7 +1377,7 @@ void free_bch(struct bch_control *bch) · 14 unmodified lines |
| 1377 | 1377 | kfree(bch); |
| 1378 | 1378 | } |
| 1379 | 1379 | } |
| 1380 | | −EXPORT_SYMBOL_GPL(free_bch); |
| 1380 | +EXPORT_SYMBOL_GPL(bch_free); |
| 1381 | 1381 | |
| 1382 | 1382 | MODULE_LICENSE("GPL"); |
| 1383 | 1383 | MODULE_AUTHOR("Ivan Djelic <ivan.djelic@parrot.com>"); |