From: H Hartley Sweeten Date: Fri, 20 Jun 2014 20:28:54 +0000 (-0700) Subject: staging: comedi: s626: remove 'get_load_trig' callback from encoder private data X-Git-Tag: firefly_0821_release~176^2~3491^2~1509 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c35b86a7cca34c0021c7751729e0db58477d735c;p=firefly-linux-kernel-4.4.55.git 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- 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,