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:   Thu, 11 Aug 2022 14:25:18 +0100
From:   Jonathan Cameron <Jonathan.Cameron@...wei.com>
To:     Shreeya Patel <shreeya.patel@...labora.com>
CC:     <jic23@...nel.org>, <lars@...afoo.de>, <linux-iio@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <krisman@...labora.com>,
        <kernel@...labora.com>, <alvaro.soliverez@...labora.com>
Subject: Re: [PATCH] iio: light: Add raw attribute

On Thu, 11 Aug 2022 15:44:43 +0530
Shreeya Patel <shreeya.patel@...labora.com> wrote:

> Add IIO_CHAN_INFO_RAW to the mask to be able to read raw values
> from the light sensor.

Why is this useful?  It's rare to support _PROCESSED and _RAW for the same channel.
Normally occurred to avoid breaking ABI.

Jonathan

> 
> Signed-off-by: Shreeya Patel <shreeya.patel@...labora.com>
> ---
>  drivers/iio/light/ltrf216a.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/iio/light/ltrf216a.c b/drivers/iio/light/ltrf216a.c
> index e6e24e70d2b9..a717bf99bd2a 100644
> --- a/drivers/iio/light/ltrf216a.c
> +++ b/drivers/iio/light/ltrf216a.c
> @@ -93,6 +93,7 @@ static const struct iio_chan_spec ltrf216a_channels[] = {
>  	{
>  		.type = IIO_LIGHT,
>  		.info_mask_separate =
> +			BIT(IIO_CHAN_INFO_RAW) |
>  			BIT(IIO_CHAN_INFO_PROCESSED) |
>  			BIT(IIO_CHAN_INFO_INT_TIME),
>  		.info_mask_separate_available =
> @@ -259,6 +260,18 @@ static int ltrf216a_read_raw(struct iio_dev *indio_dev,
>  	int ret;
>  
>  	switch (mask) {
> +	case IIO_CHAN_INFO_RAW:
> +		ret = ltrf216a_set_power_state(data, true);
> +		if (ret)
> +			return ret;
> +		mutex_lock(&data->lock);
> +		ret = ltrf216a_read_data(data, LTRF216A_ALS_DATA_0);
> +		mutex_unlock(&data->lock);
> +		if (ret < 0)
> +			return ret;
> +		*val = ret;
> +		ltrf216a_set_power_state(data, false);
> +		return IIO_VAL_INT;
>  	case IIO_CHAN_INFO_PROCESSED:
>  		mutex_lock(&data->lock);
>  		ret = ltrf216a_get_lux(data);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ