The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2] iio: light: al3010: read both ALS ADC registers again
@ 2026-05-23 11:44 Alexander A. Klimov
  2026-05-23 11:44 ` [PATCH v2] iio: light: al3320a: " Alexander A. Klimov
  2026-05-26 14:52 ` [PATCH v2] iio: light: al3010: " Jonathan Cameron
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander A. Klimov @ 2026-05-23 11:44 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Alexander A. Klimov, David Heidelberg,
	open list:IIO SUBSYSTEM AND DRIVERS, open list

al3010_read_raw() used to read two adjacent registers
until the driver was modernized using the regmap framework.
That cleanup accidentally replaced the 16-bit word read
with a single byte read. I'm reverting latter.

Fixes: 0e5e21e23dd6 ("iio: light: al3010: Implement regmap support")
Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
---
 v2: use __le16, not uint16_t

 drivers/iio/light/al3010.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/light/al3010.c b/drivers/iio/light/al3010.c
index 0932fa2b49fa..1800776d725e 100644
--- a/drivers/iio/light/al3010.c
+++ b/drivers/iio/light/al3010.c
@@ -111,7 +111,8 @@ static int al3010_read_raw(struct iio_dev *indio_dev,
 			   int *val2, long mask)
 {
 	struct al3010_data *data = iio_priv(indio_dev);
-	int ret, gain, raw;
+	int ret, gain;
+	__le16 raw;
 
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
@@ -120,11 +121,12 @@ static int al3010_read_raw(struct iio_dev *indio_dev,
 		 * - low byte of output is stored at AL3010_REG_DATA_LOW
 		 * - high byte of output is stored at AL3010_REG_DATA_LOW + 1
 		 */
-		ret = regmap_read(data->regmap, AL3010_REG_DATA_LOW, &raw);
+		ret = regmap_bulk_read(data->regmap, AL3010_REG_DATA_LOW,
+				       &raw, sizeof(raw));
 		if (ret)
 			return ret;
 
-		*val = raw;
+		*val = le16_to_cpu(raw);
 
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_SCALE:
-- 
2.54.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2] iio: light: al3320a: read both ALS ADC registers again
  2026-05-23 11:44 [PATCH v2] iio: light: al3010: read both ALS ADC registers again Alexander A. Klimov
@ 2026-05-23 11:44 ` Alexander A. Klimov
  2026-05-26 14:52   ` Jonathan Cameron
  2026-05-26 14:52 ` [PATCH v2] iio: light: al3010: " Jonathan Cameron
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander A. Klimov @ 2026-05-23 11:44 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Alexander A. Klimov, David Heidelberg,
	open list:IIO SUBSYSTEM AND DRIVERS, open list

al3320a_read_raw() used to read two adjacent registers
until the driver was modernized using the regmap framework.
That cleanup accidentally replaced the 16-bit word read
with a single byte read. I'm reverting latter.

Fixes: 1850e6ae7f91 ("iio: light: al3320a: Implement regmap support")
Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
---
 v2: use __le16, not uint16_t

 drivers/iio/light/al3320a.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/light/al3320a.c b/drivers/iio/light/al3320a.c
index 63f5a85912fc..f40b8b36f22d 100644
--- a/drivers/iio/light/al3320a.c
+++ b/drivers/iio/light/al3320a.c
@@ -135,7 +135,8 @@ static int al3320a_read_raw(struct iio_dev *indio_dev,
 			    int *val2, long mask)
 {
 	struct al3320a_data *data = iio_priv(indio_dev);
-	int ret, gain, raw;
+	int ret, gain;
+	__le16 raw;
 
 	switch (mask) {
 	case IIO_CHAN_INFO_RAW:
@@ -144,11 +145,12 @@ static int al3320a_read_raw(struct iio_dev *indio_dev,
 		 * - low byte of output is stored at AL3320A_REG_DATA_LOW
 		 * - high byte of output is stored at AL3320A_REG_DATA_LOW + 1
 		 */
-		ret = regmap_read(data->regmap, AL3320A_REG_DATA_LOW, &raw);
+		ret = regmap_bulk_read(data->regmap, AL3320A_REG_DATA_LOW,
+				       &raw, sizeof(raw));
 		if (ret)
 			return ret;
 
-		*val = raw;
+		*val = le16_to_cpu(raw);
 
 		return IIO_VAL_INT;
 	case IIO_CHAN_INFO_SCALE:
-- 
2.54.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iio: light: al3010: read both ALS ADC registers again
  2026-05-23 11:44 [PATCH v2] iio: light: al3010: read both ALS ADC registers again Alexander A. Klimov
  2026-05-23 11:44 ` [PATCH v2] iio: light: al3320a: " Alexander A. Klimov
@ 2026-05-26 14:52 ` Jonathan Cameron
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2026-05-26 14:52 UTC (permalink / raw)
  To: Alexander A. Klimov
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, David Heidelberg,
	open list:IIO SUBSYSTEM AND DRIVERS, open list

On Sat, 23 May 2026 13:44:57 +0200
"Alexander A. Klimov" <grandmaster@al2klimov.de> wrote:

> al3010_read_raw() used to read two adjacent registers
> until the driver was modernized using the regmap framework.
> That cleanup accidentally replaced the 16-bit word read
> with a single byte read. I'm reverting latter.
> 
> Fixes: 0e5e21e23dd6 ("iio: light: al3010: Implement regmap support")
> Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iio: light: al3320a: read both ALS ADC registers again
  2026-05-23 11:44 ` [PATCH v2] iio: light: al3320a: " Alexander A. Klimov
@ 2026-05-26 14:52   ` Jonathan Cameron
  2026-05-26 18:14     ` Alexander A. Klimov
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Cameron @ 2026-05-26 14:52 UTC (permalink / raw)
  To: Alexander A. Klimov
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, David Heidelberg,
	open list:IIO SUBSYSTEM AND DRIVERS, open list

On Sat, 23 May 2026 13:44:58 +0200
"Alexander A. Klimov" <grandmaster@al2klimov.de> wrote:

> al3320a_read_raw() used to read two adjacent registers
> until the driver was modernized using the regmap framework.
> That cleanup accidentally replaced the 16-bit word read
> with a single byte read. I'm reverting latter.
> 
> Fixes: 1850e6ae7f91 ("iio: light: al3320a: Implement regmap support")
> Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
For future reference, be careful not to send new threads in reply to
old ones.
- confuses tools
- hides email threads in people's clients.

Anyhow applied and marked for stable

Thanks,

Jonathan

> ---
>  v2: use __le16, not uint16_t
> 
>  drivers/iio/light/al3320a.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/light/al3320a.c b/drivers/iio/light/al3320a.c
> index 63f5a85912fc..f40b8b36f22d 100644
> --- a/drivers/iio/light/al3320a.c
> +++ b/drivers/iio/light/al3320a.c
> @@ -135,7 +135,8 @@ static int al3320a_read_raw(struct iio_dev *indio_dev,
>  			    int *val2, long mask)
>  {
>  	struct al3320a_data *data = iio_priv(indio_dev);
> -	int ret, gain, raw;
> +	int ret, gain;
> +	__le16 raw;
>  
>  	switch (mask) {
>  	case IIO_CHAN_INFO_RAW:
> @@ -144,11 +145,12 @@ static int al3320a_read_raw(struct iio_dev *indio_dev,
>  		 * - low byte of output is stored at AL3320A_REG_DATA_LOW
>  		 * - high byte of output is stored at AL3320A_REG_DATA_LOW + 1
>  		 */
> -		ret = regmap_read(data->regmap, AL3320A_REG_DATA_LOW, &raw);
> +		ret = regmap_bulk_read(data->regmap, AL3320A_REG_DATA_LOW,
> +				       &raw, sizeof(raw));
>  		if (ret)
>  			return ret;
>  
> -		*val = raw;
> +		*val = le16_to_cpu(raw);
>  
>  		return IIO_VAL_INT;
>  	case IIO_CHAN_INFO_SCALE:


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] iio: light: al3320a: read both ALS ADC registers again
  2026-05-26 14:52   ` Jonathan Cameron
@ 2026-05-26 18:14     ` Alexander A. Klimov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander A. Klimov @ 2026-05-26 18:14 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, David Heidelberg,
	open list:IIO SUBSYSTEM AND DRIVERS, open list



On 5/26/26 16:52, Jonathan Cameron wrote:
> On Sat, 23 May 2026 13:44:58 +0200
> "Alexander A. Klimov" <grandmaster@al2klimov.de> wrote:
> 
>> al3320a_read_raw() used to read two adjacent registers
>> until the driver was modernized using the regmap framework.
>> That cleanup accidentally replaced the 16-bit word read
>> with a single byte read. I'm reverting latter.
>>
>> Fixes: 1850e6ae7f91 ("iio: light: al3320a: Implement regmap support")
>> Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
> For future reference, be careful not to send new threads in reply to
> old ones.

You mean I shall send v2 in the same thread as v1?
Strange...

"please make new threads for everything you send"
  -- greg k-h

https://lore.kernel.org/all/2026052249-shrank-trophy-14ff@gregkh/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-28 18:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-23 11:44 [PATCH v2] iio: light: al3010: read both ALS ADC registers again Alexander A. Klimov
2026-05-23 11:44 ` [PATCH v2] iio: light: al3320a: " Alexander A. Klimov
2026-05-26 14:52   ` Jonathan Cameron
2026-05-26 18:14     ` Alexander A. Klimov
2026-05-26 14:52 ` [PATCH v2] iio: light: al3010: " Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox