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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 13 Jan 2014 22:25:10 +0100 (CET)
From:	Peter Meerwald <pmeerw@...erw.net>
To:	Ivaylo Dimitrov <ivo.g.dimitrov.75@...il.com>
cc:	jic23@...nel.org, pali.rohar@...il.com, pavel@....cz,
	linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
	Ivaylo Dimitrov <freemangordon@....bg>
Subject: Re: [PATCH] iio: tsl2563: Use the correct channel2 member


> Use the correct channel2 member instead of channel when dealing with sysfs
> reads/writes
 
> Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@...il.com>

as a bonus, m is renamed to mask

Acked-by: Peter Meerwald <pmeerw@...erw.net>

> ---
>  drivers/iio/light/tsl2563.c |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
> index 5e5d9de..2be6df3 100644
> --- a/drivers/iio/light/tsl2563.c
> +++ b/drivers/iio/light/tsl2563.c
> @@ -460,10 +460,14 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev,
>  {
>  	struct tsl2563_chip *chip = iio_priv(indio_dev);
>  
> -	if (chan->channel == IIO_MOD_LIGHT_BOTH)
> +	if (mask != IIO_CHAN_INFO_CALIBSCALE)
> +		return -EINVAL;
> +	if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
>  		chip->calib0 = calib_from_sysfs(val);
> -	else
> +	else if (chan->channel2 == IIO_MOD_LIGHT_IR)
>  		chip->calib1 = calib_from_sysfs(val);
> +	else
> +		return -EINVAL;
>  
>  	return 0;
>  }
> @@ -472,14 +476,14 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
>  			    struct iio_chan_spec const *chan,
>  			    int *val,
>  			    int *val2,
> -			    long m)
> +			    long mask)
>  {
>  	int ret = -EINVAL;
>  	u32 calib0, calib1;
>  	struct tsl2563_chip *chip = iio_priv(indio_dev);
>  
>  	mutex_lock(&chip->lock);
> -	switch (m) {
> +	switch (mask) {
>  	case IIO_CHAN_INFO_RAW:
>  	case IIO_CHAN_INFO_PROCESSED:
>  		switch (chan->type) {
> @@ -498,7 +502,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
>  			ret = tsl2563_get_adc(chip);
>  			if (ret)
>  				goto error_ret;
> -			if (chan->channel == 0)
> +			if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
>  				*val = chip->data0;
>  			else
>  				*val = chip->data1;
> @@ -510,7 +514,7 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
>  		break;
>  
>  	case IIO_CHAN_INFO_CALIBSCALE:
> -		if (chan->channel == 0)
> +		if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
>  			*val = calib_to_sysfs(chip->calib0);
>  		else
>  			*val = calib_to_sysfs(chip->calib1);
> 

-- 

Peter Meerwald
+43-664-2444418 (mobile)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ