[PATCH 11/22] staging: comedi: rtd520: remove utcCtrl from private data

Ian Abbott abbotti at mev.co.uk
Wed Mar 27 10:55:19 UTC 2013


On 2013-03-26 22:01, H Hartley Sweeten wrote:
> This variable in the private data is not necessary. Remove it.
>
> 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/rtd520.c | 15 ++++-----------
>   1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c
> index 6902353..70e93c0 100644
> --- a/drivers/staging/comedi/drivers/rtd520.c
> +++ b/drivers/staging/comedi/drivers/rtd520.c
> @@ -412,9 +412,6 @@ struct rtdPrivate {
>   	/* timer gate (when enabled) */
>   	u8 utcGate[4];		/* 1 extra allows simple range check */
>
> -	/* shadow registers affect other registers, but can't be read back */
> -	/* The macros below update these on writes */
> -	u8 utcCtrl[4];		/* crtl mode for 3 utc + read back */
>   	unsigned fifoLen;
>   };
>
> @@ -1319,14 +1316,10 @@ static void rtd_init_board(struct comedi_device *dev)
>   	writel(0, devpriv->las0 + LAS0_DAC2_RESET);
>   	/* clear digital IO fifo */
>   	writew(0, devpriv->las0 + LAS0_DIO_STATUS);
> -	devpriv->utcCtrl[0] = (0 << 6) | 0x30;
> -	devpriv->utcCtrl[1] = (1 << 6) | 0x30;
> -	devpriv->utcCtrl[2] = (2 << 6) | 0x30;
> -	devpriv->utcCtrl[3] = (3 << 6) | 0x00;
> -	writeb(devpriv->utcCtrl[0], devpriv->las0 + LAS0_UTC_CTRL);
> -	writeb(devpriv->utcCtrl[1], devpriv->las0 + LAS0_UTC_CTRL);
> -	writeb(devpriv->utcCtrl[2], devpriv->las0 + LAS0_UTC_CTRL);
> -	writeb(devpriv->utcCtrl[3], devpriv->las0 + LAS0_UTC_CTRL);
> +	writeb((0 << 6) | 0x30, devpriv->las0 + LAS0_UTC_CTRL);
> +	writeb((1 << 6) | 0x30, devpriv->las0 + LAS0_UTC_CTRL);
> +	writeb((2 << 6) | 0x30, devpriv->las0 + LAS0_UTC_CTRL);
> +	writeb((3 << 6) | 0x00, devpriv->las0 + LAS0_UTC_CTRL);
>   	/* TODO: set user out source ??? */
>   }

This is not a comment on the patch, but a comment on the operation.  The 
first three writeb()s set each of the 3 "8254" counter channels 
(selected by bits 7..6) to mode 0 (bits 3..1), binary count (bit 0), 
with the 16-bit counter accessed lsb first (bits 5..4).  The remaining 
writeb() is a bit mysterious.  It's a "read-back" command (bits 7..6 = 
3), latching the count and status (bits 6 and 5, both negative logic), 
but with no channels selected (bits 3, 2 and 1 for channels 2, 1 and 0, 
respectively).  Because it doesn't select any channels it's probably a 
bit of a no-op and therefore unnecessary.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-



More information about the devel mailing list