Commit 4487502e authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: s626: remove 'get_enable' callback from encoder private data

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c718f4a1
...@@ -107,9 +107,6 @@ struct s626_enc_info { ...@@ -107,9 +107,6 @@ struct s626_enc_info {
int chan; int chan;
/* Pointers to functions that differ for A and B counters: */ /* 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. */ /* Return interrupt source. */
uint16_t (*get_int_src)(struct comedi_device *dev, uint16_t (*get_int_src)(struct comedi_device *dev,
const struct s626_enc_info *k); const struct s626_enc_info *k);
...@@ -1085,19 +1082,18 @@ static void s626_set_enable(struct comedi_device *dev, ...@@ -1085,19 +1082,18 @@ static void s626_set_enable(struct comedi_device *dev,
s626_debi_replace(dev, S626_LP_CRB(k->chan), ~mask, set); s626_debi_replace(dev, S626_LP_CRB(k->chan), ~mask, set);
} }
static uint16_t s626_get_enable_a(struct comedi_device *dev, #ifdef unused
const struct s626_enc_info *k) 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, uint16_t crb = s626_debi_read(dev, S626_LP_CRB(k->chan));
S626_LP_CRB(k->chan)));
}
static uint16_t s626_get_enable_b(struct comedi_device *dev, if (k->chan < 3)
const struct s626_enc_info *k) return S626_GET_CRB_CLKENAB_A(crb);
{ else
return S626_GET_CRB_CLKENAB_B(s626_debi_read(dev, return S626_GET_CRB_CLKENAB_B(crb);
S626_LP_CRB(k->chan)));
} }
#endif
#ifdef unused #ifdef unused
static uint16_t s626_get_latch_source(struct comedi_device *dev, 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, ...@@ -1320,7 +1316,6 @@ static void s626_pulse_index_b(struct comedi_device *dev,
static const struct s626_enc_info s626_enc_chan_info[] = { static const struct s626_enc_info s626_enc_chan_info[] = {
{ {
.chan = 0, .chan = 0,
.get_enable = s626_get_enable_a,
.get_int_src = s626_get_int_src_a, .get_int_src = s626_get_int_src_a,
.get_load_trig = s626_get_load_trig_a, .get_load_trig = s626_get_load_trig_a,
.get_mode = s626_get_mode_a, .get_mode = s626_get_mode_a,
...@@ -1332,7 +1327,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { ...@@ -1332,7 +1327,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
.my_event_bits = S626_EVBITS(0), .my_event_bits = S626_EVBITS(0),
}, { }, {
.chan = 1, .chan = 1,
.get_enable = s626_get_enable_a,
.get_int_src = s626_get_int_src_a, .get_int_src = s626_get_int_src_a,
.get_load_trig = s626_get_load_trig_a, .get_load_trig = s626_get_load_trig_a,
.get_mode = s626_get_mode_a, .get_mode = s626_get_mode_a,
...@@ -1344,7 +1338,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { ...@@ -1344,7 +1338,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
.my_event_bits = S626_EVBITS(1), .my_event_bits = S626_EVBITS(1),
}, { }, {
.chan = 2, .chan = 2,
.get_enable = s626_get_enable_a,
.get_int_src = s626_get_int_src_a, .get_int_src = s626_get_int_src_a,
.get_load_trig = s626_get_load_trig_a, .get_load_trig = s626_get_load_trig_a,
.get_mode = s626_get_mode_a, .get_mode = s626_get_mode_a,
...@@ -1356,7 +1349,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { ...@@ -1356,7 +1349,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
.my_event_bits = S626_EVBITS(2), .my_event_bits = S626_EVBITS(2),
}, { }, {
.chan = 3, .chan = 3,
.get_enable = s626_get_enable_b,
.get_int_src = s626_get_int_src_b, .get_int_src = s626_get_int_src_b,
.get_load_trig = s626_get_load_trig_b, .get_load_trig = s626_get_load_trig_b,
.get_mode = s626_get_mode_b, .get_mode = s626_get_mode_b,
...@@ -1368,7 +1360,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { ...@@ -1368,7 +1360,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
.my_event_bits = S626_EVBITS(3), .my_event_bits = S626_EVBITS(3),
}, { }, {
.chan = 4, .chan = 4,
.get_enable = s626_get_enable_b,
.get_int_src = s626_get_int_src_b, .get_int_src = s626_get_int_src_b,
.get_load_trig = s626_get_load_trig_b, .get_load_trig = s626_get_load_trig_b,
.get_mode = s626_get_mode_b, .get_mode = s626_get_mode_b,
...@@ -1380,7 +1371,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = { ...@@ -1380,7 +1371,6 @@ static const struct s626_enc_info s626_enc_chan_info[] = {
.my_event_bits = S626_EVBITS(4), .my_event_bits = S626_EVBITS(4),
}, { }, {
.chan = 5, .chan = 5,
.get_enable = s626_get_enable_b,
.get_int_src = s626_get_int_src_b, .get_int_src = s626_get_int_src_b,
.get_load_trig = s626_get_load_trig_b, .get_load_trig = s626_get_load_trig_b,
.get_mode = s626_get_mode_b, .get_mode = s626_get_mode_b,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment