]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
staging: comedi: s626: remove 'get_int_src' callback from encoder private data
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 20 Jun 2014 20:28:56 +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_int_src' callback. One is used for
the channel 0-2 encoders and the other for the channel 3-5 encoders.

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

Remove the then unnecessary 'get_int_src' member from the encoder private data.

The 'get_int_src' callbacks were not being used by the driver. For now block
the s626_get_int_src() 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 4c53d36c84d96e9eb3de948bff44074d65df54bd..232b9fc5e5f6cc17e3a72b660fb7eaf2d478e571 100644 (file)
@@ -107,9 +107,6 @@ struct s626_enc_info {
        int chan;
 
        /* Pointers to functions that differ for A and B counters: */
-       /* Return interrupt source. */
-       uint16_t (*get_int_src)(struct comedi_device *dev,
-                              const struct s626_enc_info *k);
        /* Return standardized operating mode. */
        uint16_t (*get_mode)(struct comedi_device *dev,
                            const struct s626_enc_info *k);
@@ -1177,19 +1174,18 @@ static void s626_set_int_src(struct comedi_device *dev,
        devpriv->counter_int_enabs |= k->my_event_bits[int_source];
 }
 
-static uint16_t s626_get_int_src_a(struct comedi_device *dev,
-                                  const struct s626_enc_info *k)
-{
-       return S626_GET_CRA_INTSRC_A(s626_debi_read(dev,
-                                                   S626_LP_CRA(k->chan)));
-}
-
-static uint16_t s626_get_int_src_b(struct comedi_device *dev,
-                                  const struct s626_enc_info *k)
+#ifdef unused
+static uint16_t s626_get_int_src(struct comedi_device *dev,
+                                const struct s626_enc_info *k)
 {
-       return S626_GET_CRB_INTSRC_B(s626_debi_read(dev,
-                                                   S626_LP_CRB(k->chan)));
+       if (chan < 3)
+               return S626_GET_CRA_INTSRC_A(s626_debi_read(dev,
+                                                       S626_LP_CRA(k->chan)));
+       else
+               return S626_GET_CRB_INTSRC_B(s626_debi_read(dev,
+                                                       S626_LP_CRB(k->chan)));
 }
+#endif
 
 #ifdef unused
 /*
@@ -1303,7 +1299,6 @@ static void s626_pulse_index_b(struct comedi_device *dev,
 static const struct s626_enc_info s626_enc_chan_info[] = {
        {
                .chan                   = 0,
-               .get_int_src            = s626_get_int_src_a,
                .get_mode               = s626_get_mode_a,
                .pulse_index            = s626_pulse_index_a,
                .set_mode               = s626_set_mode_a,
@@ -1311,7 +1306,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
                .my_event_bits          = S626_EVBITS(0),
        }, {
                .chan                   = 1,
-               .get_int_src            = s626_get_int_src_a,
                .get_mode               = s626_get_mode_a,
                .pulse_index            = s626_pulse_index_a,
                .set_mode               = s626_set_mode_a,
@@ -1319,7 +1313,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
                .my_event_bits          = S626_EVBITS(1),
        }, {
                .chan                   = 2,
-               .get_int_src            = s626_get_int_src_a,
                .get_mode               = s626_get_mode_a,
                .pulse_index            = s626_pulse_index_a,
                .set_mode               = s626_set_mode_a,
@@ -1327,7 +1320,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
                .my_event_bits          = S626_EVBITS(2),
        }, {
                .chan                   = 3,
-               .get_int_src            = s626_get_int_src_b,
                .get_mode               = s626_get_mode_b,
                .pulse_index            = s626_pulse_index_b,
                .set_mode               = s626_set_mode_b,
@@ -1335,7 +1327,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
                .my_event_bits          = S626_EVBITS(3),
        }, {
                .chan                   = 4,
-               .get_int_src            = s626_get_int_src_b,
                .get_mode               = s626_get_mode_b,
                .pulse_index            = s626_pulse_index_b,
                .set_mode               = s626_set_mode_b,
@@ -1343,7 +1334,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
                .my_event_bits          = S626_EVBITS(4),
        }, {
                .chan                   = 5,
-               .get_int_src            = s626_get_int_src_b,
                .get_mode               = s626_get_mode_b,
                .pulse_index            = s626_pulse_index_b,
                .set_mode               = s626_set_mode_b,