aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rslib.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/rslib.h')
-rw-r--r--include/linux/rslib.h19
1 files changed, 13 insertions, 6 deletions
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*/
34struct rs_control { 34struct 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 */
54struct 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
52int encode_rs8(struct rs_control *rs, uint8_t *data, int len, uint16_t *par, 60int 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 */
73struct rs_control *init_rs_gfp(int symsize, int gfpoly, int fcr, int prim, 80struct 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*/
113static inline int rs_modnn(struct rs_control *rs, int x) 120static 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;