staging: comedi: s626: remove 'get_enable' callback from encoder private data
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 20 Jun 2014 20:28:52 +0000 (13:28 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2014 00:11:17 +0000 (20:11 -0400)
There are two functions used for the 'get_enable' callback, s626_get_enable_a()
function is used for the channel 0-2 encoders and s626_get_enable_b() is used
for the channel 3-5 encoders.

Refactor the two callbacks into a single s626_get_enable() function and use the
encoder channel number to handle the differenced.

Remove the then unnecessary 'get_enable' member and just call s626_set_enable()
directly.

The 'get_enable' callbacks were not being used by the driver. For now block the
s626_get_enable() function with '#ifdef unused' to prevent a compiler warning.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/s626.c

index 55ac04b24e57c179ad69979342c1b02419ea8e33..4f93d6c19e482c2e697fadf775f8da810d8e04fe 100644 (file)
@@ -107,9 +107,6 @@ struct s626_enc_info {
        int chan;
 
        /* Pointers to functions that differ for A and B counters: */
-       /* Return clock enable. */
-       uint16_t (*get_enable)(struct comedi_device *dev,
-                             const struct s626_enc_info *k);
        /* Return interrupt source. */
        uint16_t (*get_int_src)(struct comedi_device *dev,
                               const struct s626_enc_info *k);
@@ -1085,19 +1082,18 @@ static void s626_set_enable(struct comedi_device *dev,
        s626_debi_replace(dev, S626_LP_CRB(k->chan), ~mask, set);
 }
 
-static uint16_t s626_get_enable_a(struct comedi_device *dev,
-                                 const struct s626_enc_info *k)
+#ifdef unused
+static uint16_t s626_get_enable(struct comedi_device *dev,
+                               const struct s626_enc_info *k)
 {
-       return S626_GET_CRB_CLKENAB_A(s626_debi_read(dev,
-                                                    S626_LP_CRB(k->chan)));
-}
+       uint16_t crb = s626_debi_read(dev, S626_LP_CRB(k->chan));
 
-static uint16_t s626_get_enable_b(struct comedi_device *dev,
-                                 const struct s626_enc_info *k)
-{
-       return S626_GET_CRB_CLKENAB_B(s626_debi_read(dev,
-                                                    S626_LP_CRB(k->chan)));
+       if (k->chan < 3)
+               return S626_GET_CRB_CLKENAB_A(crb);
+       else
+               return S626_GET_CRB_CLKENAB_B(crb);
 }
+#endif
 
 #ifdef unused
 static uint16_t s626_get_latch_source(struct comedi_device *dev,
@@ -1320,7 +1316,6 @@ static void s626_pulse_index_b(struct comedi_device *dev,
 static const struct s626_enc_info s626_enc_chan_info[] = {
        {
                .chan                   = 0,
-               .get_enable             = s626_get_enable_a,
                .get_int_src            = s626_get_int_src_a,
                .get_load_trig          = s626_get_load_trig_a,
                .get_mode               = s626_get_mode_a,
@@ -1332,7 +1327,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
                .my_event_bits          = S626_EVBITS(0),
        }, {
                .chan                   = 1,
-               .get_enable             = s626_get_enable_a,
                .get_int_src            = s626_get_int_src_a,
                .get_load_trig          = s626_get_load_trig_a,
                .get_mode               = s626_get_mode_a,
@@ -1344,7 +1338,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
                .my_event_bits          = S626_EVBITS(1),
        }, {
                .chan                   = 2,
-               .get_enable             = s626_get_enable_a,
                .get_int_src            = s626_get_int_src_a,
                .get_load_trig          = s626_get_load_trig_a,
                .get_mode               = s626_get_mode_a,
@@ -1356,7 +1349,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
                .my_event_bits          = S626_EVBITS(2),
        }, {
                .chan                   = 3,
-               .get_enable             = s626_get_enable_b,
                .get_int_src            = s626_get_int_src_b,
                .get_load_trig          = s626_get_load_trig_b,
                .get_mode               = s626_get_mode_b,
@@ -1368,7 +1360,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
                .my_event_bits          = S626_EVBITS(3),
        }, {
                .chan                   = 4,
-               .get_enable             = s626_get_enable_b,
                .get_int_src            = s626_get_int_src_b,
                .get_load_trig          = s626_get_load_trig_b,
                .get_mode               = s626_get_mode_b,
@@ -1380,7 +1371,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
                .my_event_bits          = S626_EVBITS(4),
        }, {
                .chan                   = 5,
-               .get_enable             = s626_get_enable_b,
                .get_int_src            = s626_get_int_src_b,
                .get_load_trig          = s626_get_load_trig_b,
                .get_mode               = s626_get_mode_b,