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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 6 Nov 2016 11:54:49 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Brian Masney <masneyb@...tation.org>, linux-iio@...r.kernel.org
Cc:     devel@...verdev.osuosl.org, gregkh@...uxfoundation.org,
        lars@...afoo.de, pmeerw@...erw.net, knaack.h@....de,
        linux-kernel@...r.kernel.org, Jon.Brenner@....com
Subject: Re: [PATCH 6/9] staging: iio: tsl2583: remove redudant i2c call in
 taos_als_calibrate()

On 03/11/16 12:56, Brian Masney wrote:
> taos_als_calibrate() queries the control register to determine if the
> unit is powered on and has the ADC enabled. It then queries the same
> register a second time to determine if the ADC reading is valid. This
> patch removes the redundant i2c_smbus_read_byte_data() call.
> 
> Verified that the driver still functions correctly using a TSL2581
> hooked up to a Raspberry Pi 2.
> 
> Signed-off-by: Brian Masney <masneyb@...tation.org>
Applied.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/light/tsl2583.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index af1cf9b..7eab17f 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -338,18 +338,7 @@ static int taos_als_calibrate(struct iio_dev *indio_dev)
>  		dev_err(&chip->client->dev,
>  			"taos_als_calibrate failed: device not powered on with ADC enabled\n");
>  		return -EINVAL;
> -	}
> -
> -	ret = i2c_smbus_read_byte_data(chip->client,
> -				       TSL258X_CMD_REG | TSL258X_CNTRL);
> -	if (ret < 0) {
> -		dev_err(&chip->client->dev,
> -			"%s failed to read from the CNTRL register\n",
> -			__func__);
> -		return ret;
> -	}
> -
> -	if ((ret & TSL258X_STA_ADC_VALID) != TSL258X_STA_ADC_VALID) {
> +	} else if ((ret & TSL258X_STA_ADC_VALID) != TSL258X_STA_ADC_VALID) {
>  		dev_err(&chip->client->dev,
>  			"taos_als_calibrate failed: STATUS - ADC not valid.\n");
>  		return -ENODATA;
> 

Powered by blists - more mailing lists