[PATCH 3/3] staging: comedi: drivers: streamlined auto attach with main comedi

Ian Abbott abbotti at mev.co.uk
Mon Jan 6 12:06:21 UTC 2014


It would be better to put "usbduxsigma:" in the patch title instead of 
"drivers:" since it's only for a single driver.

On 2013-12-28 21:32, Bernd Porr wrote:
> Removed the word "attached" from the "ADC_zero" output which is
> now reported by comedi itself at the end of the auto attach.
> A negative value of the offset is an error and should be reported to
> comedi auto config as an error. Output only the offset if no error
> has been reported.
>
> Signed-off-by: Bernd Porr <mail at berndporr.me.uk>
> ---
>   drivers/staging/comedi/drivers/usbduxsigma.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c
> index a5363de..125eae5 100644
> --- a/drivers/staging/comedi/drivers/usbduxsigma.c
> +++ b/drivers/staging/comedi/drivers/usbduxsigma.c
> @@ -1656,11 +1656,14 @@ static int usbduxsigma_auto_attach(struct comedi_device *dev,
>   	}
>
>   	offset = usbduxsigma_getstatusinfo(dev, 0);
> -	if (offset < 0)
> +	if (offset < 0) {
> +		/* a neg ADC value in comedi terms is a device error */
>   		dev_err(dev->class_dev,
> -			"Communication to USBDUXSIGMA failed! Check firmware and cabling\n");
> +			"Communication to USBDUXSIGMA failed! Check firmware and cabling.\n");
> +		return offset;
> +	}
>
> -	dev_info(dev->class_dev, "attached, ADC_zero = %x\n", offset);
> +	dev_info(dev->class_dev, "ADC_zero = %x\n", offset);
>
>   	return 0;
>   }
>

Ideally, it would be two patches, one to return the error and the other 
to correct the messages, but doesn't matter too much.

Reviewed-by: Ian Abbott <abbotti at mev.co.uk>

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