Commit 13f2609d authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

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



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: 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 253e2ee4
Loading
Loading
Loading
Loading
+10 −20
Original line number Diff line number Diff line
@@ -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,
#ifdef unused
static uint16_t s626_get_int_src(struct comedi_device *dev,
				 const struct s626_enc_info *k)
{
	if (chan < 3)
		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)
{
	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,