diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-06-20 13:28:54 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-06-26 20:11:17 -0400 |
commit | c35b86a7cca34c0021c7751729e0db58477d735c (patch) | |
tree | a8a124ded3c901f655af5d7b84497df8cea66b79 | |
parent | 7f03b749990cbc3be67f6eabcd0814b89abae0f6 (diff) |
staging: comedi: s626: remove 'get_load_trig' callback from encoder private data
There are two functions used for the 'get_load_trig' 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_load_trig() function and use
the encoder channel number to handle the differences.
Remove the then unnecessary 'get_enable' member from the encoder private data.
The 'get_load_trig' callbacks were not being used by the driver. For now block
the s626_get_load_trig() 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>
-rw-r--r-- | drivers/staging/comedi/drivers/s626.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 49b6d5941f3e..614e1a96a713 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -110,9 +110,6 @@ struct s626_enc_info { /* Return interrupt source. */ uint16_t (*get_int_src)(struct comedi_device *dev, const struct s626_enc_info *k); - /* Return preload trigger source. */ - uint16_t (*get_load_trig)(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); @@ -1125,19 +1122,18 @@ static void s626_set_load_trig(struct comedi_device *dev, s626_debi_replace(dev, reg, ~mask, set); } -static uint16_t s626_get_load_trig_a(struct comedi_device *dev, - const struct s626_enc_info *k) -{ - return S626_GET_CRA_LOADSRC_A(s626_debi_read(dev, - S626_LP_CRA(k->chan))); -} - -static uint16_t s626_get_load_trig_b(struct comedi_device *dev, - const struct s626_enc_info *k) +#ifdef unused +static uint16_t s626_get_load_trig(struct comedi_device *dev, + const struct s626_enc_info *k) { - return S626_GET_CRB_LOADSRC_B(s626_debi_read(dev, - S626_LP_CRB(k->chan))); + if (k->chan < 3) + return S626_GET_CRA_LOADSRC_A(s626_debi_read(dev, + S626_LP_CRA(k->chan))); + else + return S626_GET_CRB_LOADSRC_B(s626_debi_read(dev, + S626_LP_CRB(k->chan))); } +#endif /* * Return/set counter interrupt source and clear any captured @@ -1318,7 +1314,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { { .chan = 0, .get_int_src = s626_get_int_src_a, - .get_load_trig = s626_get_load_trig_a, .get_mode = s626_get_mode_a, .pulse_index = s626_pulse_index_a, .set_int_src = s626_set_int_src_a, @@ -1328,7 +1323,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { }, { .chan = 1, .get_int_src = s626_get_int_src_a, - .get_load_trig = s626_get_load_trig_a, .get_mode = s626_get_mode_a, .pulse_index = s626_pulse_index_a, .set_int_src = s626_set_int_src_a, @@ -1338,7 +1332,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { }, { .chan = 2, .get_int_src = s626_get_int_src_a, - .get_load_trig = s626_get_load_trig_a, .get_mode = s626_get_mode_a, .pulse_index = s626_pulse_index_a, .set_int_src = s626_set_int_src_a, @@ -1348,7 +1341,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { }, { .chan = 3, .get_int_src = s626_get_int_src_b, - .get_load_trig = s626_get_load_trig_b, .get_mode = s626_get_mode_b, .pulse_index = s626_pulse_index_b, .set_int_src = s626_set_int_src_b, @@ -1358,7 +1350,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { }, { .chan = 4, .get_int_src = s626_get_int_src_b, - .get_load_trig = s626_get_load_trig_b, .get_mode = s626_get_mode_b, .pulse_index = s626_pulse_index_b, .set_int_src = s626_set_int_src_b, @@ -1368,7 +1359,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { }, { .chan = 5, .get_int_src = s626_get_int_src_b, - .get_load_trig = s626_get_load_trig_b, .get_mode = s626_get_mode_b, .pulse_index = s626_pulse_index_b, .set_int_src = s626_set_int_src_b, |