[PATCH 7/9] staging: comedi: drivers: remove unnecessary *_SIZE defines

Ian Abbott abbotti at mev.co.uk
Mon Jul 21 11:16:01 UTC 2014


On 2014-07-19 01:01, H Hartley Sweeten wrote:
> Some of the legacy comedi drivers have a *_SIZE define that is only
> passed to comedi_request_region() to specify the size of the region.
>
> Some of the pnp drivers (pci, etc.) also have a *_SIZE define which
> is unused.
>
> For aesthetics, remove these defines.
>
> Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
> Cc: Ian Abbott <abbotti at mev.co.uk>
> Cc: Greg Kroah-Hartman <gregk at linuxfoundation.org>

The patch is fine, although the non-power-of-2 wacko sizes in the 
original code ought to be rounded up.

> diff --git a/drivers/staging/comedi/drivers/dt2817.c b/drivers/staging/comedi/drivers/dt2817.c
> index bf58993..5131dee 100644
> --- a/drivers/staging/comedi/drivers/dt2817.c
> +++ b/drivers/staging/comedi/drivers/dt2817.c
> @@ -36,8 +36,6 @@ Configuration options:
>   #include <linux/module.h>
>   #include "../comedidev.h"
>
> -#define DT2817_SIZE 5
> -
>   #define DT2817_CR 0
>   #define DT2817_DATA 1
>
> @@ -114,7 +112,7 @@ static int dt2817_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>   	int ret;
>   	struct comedi_subdevice *s;
>
> -	ret = comedi_request_region(dev, it->options[0], DT2817_SIZE);
> +	ret = comedi_request_region(dev, it->options[0], 0x5);
>   	if (ret)
>   		return ret;
>

I.e., that one should be rounded up to 8.

> diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c
> index 76fed31..de67161 100644
> --- a/drivers/staging/comedi/drivers/ni_at_a2150.c
> +++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
> @@ -71,7 +71,6 @@ TRIG_WAKE_EOS
>   #include "8253.h"
>   #include "comedi_fc.h"
>
> -#define A2150_SIZE           28
>   #define A2150_DMA_BUFFER_SIZE	0xff00	/*  size in bytes of dma buffer */
>
>   /* Registers and bits */
> @@ -702,7 +701,7 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>   	if (!devpriv)
>   		return -ENOMEM;
>
> -	ret = comedi_request_region(dev, it->options[0], A2150_SIZE);
> +	ret = comedi_request_region(dev, it->options[0], 0x1c);
>   	if (ret)
>   		return ret;
>

And that one should be rounded up to 0x20.

-- 
-=( 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