[PATCH 09/18] staging: comedi: s626: remove 'get_load_trig' callback from encoder private data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregk@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/s626.c | 30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
index 49b6d59..614e1a9 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,
-- 
1.9.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux