rslib: Split rs control struct
[sfrench/cifs-2.6.git] / include / linux / rslib.h
index 27652c18bf8c8a9b10114895ad51056a30579421..6703311beea3a57af3afebb40be66035e4d12bd6 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/gfp.h>         /* for GFP_KERNEL */
 
 /**
- * struct rs_control - rs control structure
+ * struct rs_codec - rs codec data
  *
  * @mm:                Bits per symbol
  * @nn:                Symbols per block (= (1<<mm)-1)
@@ -29,9 +29,9 @@
  * @gfpoly:    The primitive generator polynominal
  * @gffunc:    Function to generate the field, if non-canonical representation
  * @users:     Users of this structure
- * @list:      List entry for the rs control list
+ * @list:      List entry for the rs codec list
 */
-struct rs_control {
+struct rs_codec {
        int             mm;
        int             nn;
        uint16_t        *alpha_to;
@@ -47,6 +47,14 @@ struct rs_control {
        struct list_head list;
 };
 
+/**
+ * struct rs_control - rs control structure per instance
+ * @codec:     The codec used for this instance
+ */
+struct rs_control {
+       struct rs_codec *codec;
+};
+
 /* General purpose RS codec, 8-bit data width, symbol width 1-15 bit  */
 #ifdef CONFIG_REED_SOLOMON_ENC8
 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,
                uint16_t *corr);
 #endif
 
-/* Create or get a matching rs control structure */
 struct rs_control *init_rs_gfp(int symsize, int gfpoly, int fcr, int prim,
                               int nroots, gfp_t gfp);
 
@@ -100,7 +107,7 @@ void free_rs(struct rs_control *rs);
 
 /** modulo replacement for galois field arithmetics
  *
- *  @rs:       the rs control structure
+ *  @rs:       Pointer to the RS codec
  *  @x:                the value to reduce
  *
  *  where
@@ -110,7 +117,7 @@ void free_rs(struct rs_control *rs);
  *  Simple arithmetic modulo would return a wrong result for values
  *  >= 3 * rs->nn
 */
-static inline int rs_modnn(struct rs_control *rs, int x)
+static inline int rs_modnn(struct rs_codec *rs, int x)
 {
        while (x >= rs->nn) {
                x -= rs->nn;