lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 11 Nov 2018 12:40:44 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Baolin Wang <baolin.wang@...aro.org>
Cc:     knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
        freeman.liu@...soc.com, broonie@...nel.org,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: sc27xx: Add ADC data conversion timeout

On Fri,  9 Nov 2018 11:25:31 +0800
Baolin Wang <baolin.wang@...aro.org> wrote:

> From: Freeman Liu <freeman.liu@...soc.com>
> 
> Sometimes the ADC controller met some problems, and it will not complete
> the data conversion, that will can not wake up the read process any more
> to block users. So we should add one maximum conversion time to avoid
> this issue.
> 
> Signed-off-by: Freeman Liu <freeman.liu@...soc.com>
> Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
Hi.

Patch looks good, but sounds like this is a fix so could I have a fixes
tag and a patch title that makes that clear?

I think we will want this one back ported to stable by the sound of it.

If it is just a theoretical issue then perhaps we don't need to bother.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/sc27xx_adc.c |   12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/sc27xx_adc.c b/drivers/iio/adc/sc27xx_adc.c
> index 7940b23..f7f7a189 100644
> --- a/drivers/iio/adc/sc27xx_adc.c
> +++ b/drivers/iio/adc/sc27xx_adc.c
> @@ -52,6 +52,9 @@
>  /* Timeout (ms) for the trylock of hardware spinlocks */
>  #define SC27XX_ADC_HWLOCK_TIMEOUT	5000
>  
> +/* Timeout (ms) for ADC data conversion according to ADC datasheet */
> +#define SC27XX_ADC_RDY_TIMEOUT		100
> +
>  /* Maximum ADC channel number */
>  #define SC27XX_ADC_CHANNEL_MAX		32
>  
> @@ -223,7 +226,14 @@ static int sc27xx_adc_read(struct sc27xx_adc_data *data, int channel,
>  	if (ret)
>  		goto disable_adc;
>  
> -	wait_for_completion(&data->completion);
> +	ret = wait_for_completion_timeout(&data->completion,
> +				msecs_to_jiffies(SC27XX_ADC_RDY_TIMEOUT));
> +	if (!ret) {
> +		dev_err(data->dev, "read ADC data timeout\n");
> +		ret = -ETIMEDOUT;
> +	} else {
> +		ret = 0;
> +	}
>  
>  disable_adc:
>  	regmap_update_bits(data->regmap, data->base + SC27XX_ADC_CTL,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ