[RFC PATCH 30/36] staging: comedi: amplc_dio200_common: remove 'gat_sce_ofs' from struct dio200_subdev_8254

H Hartley Sweeten hsweeten at visionengravers.com
Fri Feb 20 23:05:09 UTC 2015


This member is only used one place in the driver. Remove it and calculate the
register offset when needed.

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/staging/comedi/drivers/amplc_dio200_common.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
index 1786ea2..2c9c8dd 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
@@ -99,7 +99,6 @@ static const unsigned int ts_clock_period[TS_CONFIG_MAX_CLK_SRC + 1] = {
 
 struct dio200_subdev_8254 {
 	unsigned int ofs;		/* Counter base offset */
-	unsigned int gat_sce_ofs;	/* GAT_SCE base address */
 	int which;			/* Bit 5 of CLK_SCE or GAT_SCE */
 	unsigned int clock_src[3];	/* Current clock sources */
 	unsigned int gate_src[3];	/* Current gate sources */
@@ -586,7 +585,7 @@ static int dio200_subdev_8254_set_gate_src(struct comedi_device *dev,
 
 	subpriv->gate_src[counter_number] = gate_src;
 	byte = gat_sce(subpriv->which, counter_number, gate_src);
-	dio200_write8(dev, subpriv->gat_sce_ofs, byte);
+	dio200_write8(dev, DIO200_GAT_SCE(subpriv->ofs >> 3), byte);
 
 	return 0;
 }
@@ -725,12 +724,8 @@ static int dio200_subdev_8254_init(struct comedi_device *dev,
 
 	spin_lock_init(&subpriv->spinlock);
 	subpriv->ofs = offset;
-	if (board->has_clk_gat_sce) {
-		/* Derive CLK_SCE and GAT_SCE register offsets from
-		 * 8254 offset. */
-		subpriv->gat_sce_ofs = DIO200_GAT_SCE(offset >> 3);
+	if (board->has_clk_gat_sce)
 		subpriv->which = (offset >> 2) & 1;
-	}
 
 	/* Initialize channels. */
 	for (chan = 0; chan < 3; chan++) {
-- 
2.3.0



More information about the devel mailing list