Linux IIO development
 help / color / mirror / Atom feed
* [PATCH v2] iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw
@ 2023-10-23  4:05 Su Hui
  2023-10-23 12:57 ` Jean-Baptiste Maneyrol
  0 siblings, 1 reply; 4+ messages in thread
From: Su Hui @ 2023-10-23  4:05 UTC (permalink / raw)
  To: Jonathan.Cameron, jic23, lars
  Cc: Su Hui, jean-baptiste.maneyrol, andy.shevchenko, chenhuiz,
	linux-iio, linux-kernel, kernel-janitors

inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the
true value rather than only return IIO_VAL_INT.

Signed-off-by: Su Hui <suhui@nfschina.com>
---
v2:
 - fix the error of commit title.
v1: 
 - https://lore.kernel.org/all/20231020091413.205743-2-suhui@nfschina.com/
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 29f906c884bd..a9a5fb266ef1 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -749,13 +749,13 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
 			ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset,
 						chan->channel2, val);
 			mutex_unlock(&st->lock);
-			return IIO_VAL_INT;
+			return ret;
 		case IIO_ACCEL:
 			mutex_lock(&st->lock);
 			ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset,
 						chan->channel2, val);
 			mutex_unlock(&st->lock);
-			return IIO_VAL_INT;
+			return ret;
 
 		default:
 			return -EINVAL;
-- 
2.30.2


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

* Re: [PATCH v2] iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw
  2023-10-23  4:05 Su Hui
@ 2023-10-23 12:57 ` Jean-Baptiste Maneyrol
  0 siblings, 0 replies; 4+ messages in thread
From: Jean-Baptiste Maneyrol @ 2023-10-23 12:57 UTC (permalink / raw)
  To: Su Hui, Jonathan.Cameron@Huawei.com, jic23@kernel.org,
	lars@metafoo.de
  Cc: andy.shevchenko@gmail.com, chenhuiz@axis.com,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org

Hello,

looks good for me, thanks for the fix.

Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>

Thanks,
JB

From: Su Hui <suhui@nfschina.com>
Sent: Monday, October 23, 2023 06:05
To: Jonathan.Cameron@Huawei.com <Jonathan.Cameron@Huawei.com>; jic23@kernel.org <jic23@kernel.org>; lars@metafoo.de <lars@metafoo.de>
Cc: Su Hui <suhui@nfschina.com>; Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>; andy.shevchenko@gmail.com <andy.shevchenko@gmail.com>; chenhuiz@axis.com <chenhuiz@axis.com>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; kernel-janitors@vger.kernel.org <kernel-janitors@vger.kernel.org>
Subject: [PATCH v2] iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw 
 
inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the true value rather than only return IIO_VAL_INT. Signed-off-by: Su Hui <suhui@ nfschina. com> --- v2: - fix the error of commit title. v1: - https: //urldefense. com/v3/__https: //lore. kernel. org/all/20231020091413. 205743-2-suhui@ nfschina. com/__;!!FtrhtPsWDhZ6tw!HkhoYyOc-Whx_ROmsl5laocdgPfmACC5Piff96FG_nwTqZFA4GgXeNhp7q1wVElUFbfabAcCmt6D1uuKA1LO1q5E$[lore[. ]kernel[. ]org] 
ZjQcmQRYFpfptBannerStart
This Message Is From an Untrusted Sender 
You have not previously corresponded with this sender. 
 
ZjQcmQRYFpfptBannerEnd
inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the
true value rather than only return IIO_VAL_INT.

Signed-off-by: Su Hui <suhui@nfschina.com>
---
v2:
 - fix the error of commit title.
v1: 
 - https://urldefense.com/v3/__https://lore.kernel.org/all/20231020091413.205743-2-suhui@nfschina.com/__;!!FtrhtPsWDhZ6tw!HkhoYyOc-Whx_ROmsl5laocdgPfmACC5Piff96FG_nwTqZFA4GgXeNhp7q1wVElUFbfabAcCmt6D1uuKA1LO1q5E$[lore[.]kernel[.]org]
 drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 29f906c884bd..a9a5fb266ef1 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -749,13 +749,13 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
 			ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset,
 						chan->channel2, val);
 			mutex_unlock(&st->lock);
-			return IIO_VAL_INT;
+			return ret;
 		case IIO_ACCEL:
 			mutex_lock(&st->lock);
 			ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset,
 						chan->channel2, val);
 			mutex_unlock(&st->lock);
-			return IIO_VAL_INT;
+			return ret;
 
 		default:
 			return -EINVAL;
-- 
2.30.2


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

* Re: [PATCH v2] iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw
       [not found] <20231027145949.243f03f2@jic23-huawei>
@ 2023-10-30  2:10 ` Su Hui
  2023-11-01 10:00   ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Su Hui @ 2023-10-30  2:10 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Jonathan.Cameron, lars, jean-baptiste.maneyrol, andy.shevchenko,
	chenhuiz, linux-iio, linux-kernel, kernel-janitors


On 2023/10/27 21:59, Jonathan Cameron wrote:
> On Mon, 23 Oct 2023 12:05:52 +0800
> Su Hui <suhui@nfschina.com> wrote:
>
>> inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the
>> true value rather than only return IIO_VAL_INT.
>>
>> Signed-off-by: Su Hui <suhui@nfschina.com>
> If you can figure out a fixes tag that would be great.  Just reply to this thread
> with it and I'll pick it up from here.
Oh, I just send a v3 patch, sorry....
Fixes: d5098447147c ("iio: imu: mpu6050: add calibration offset support")
>> ---
>> v2:
>>   - fix the error of commit title.
>> v1:
>>   - https://lore.kernel.org/all/20231020091413.205743-2-suhui@nfschina.com/
>>   drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
>> index 29f906c884bd..a9a5fb266ef1 100644
>> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
>> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
>> @@ -749,13 +749,13 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
>>   			ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset,
>>   						chan->channel2, val);
>>   			mutex_unlock(&st->lock);
>> -			return IIO_VAL_INT;
>> +			return ret;
>>   		case IIO_ACCEL:
>>   			mutex_lock(&st->lock);
>>   			ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset,
>>   						chan->channel2, val);
>>   			mutex_unlock(&st->lock);
>> -			return IIO_VAL_INT;
>> +			return ret;
>>   
>>   		default:
>>   			return -EINVAL;

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

* Re: [PATCH v2] iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw
  2023-10-30  2:10 ` [PATCH v2] iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw Su Hui
@ 2023-11-01 10:00   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2023-11-01 10:00 UTC (permalink / raw)
  To: Su Hui
  Cc: Jonathan Cameron, lars, jean-baptiste.maneyrol, andy.shevchenko,
	chenhuiz, linux-iio, linux-kernel, kernel-janitors

On Mon, 30 Oct 2023 10:10:05 +0800
Su Hui <suhui@nfschina.com> wrote:

> On 2023/10/27 21:59, Jonathan Cameron wrote:
> > On Mon, 23 Oct 2023 12:05:52 +0800
> > Su Hui <suhui@nfschina.com> wrote:
> >  
> >> inv_mpu6050_sensor_show() can return -EINVAL or IIO_VAL_INT. Return the
> >> true value rather than only return IIO_VAL_INT.
> >>
> >> Signed-off-by: Su Hui <suhui@nfschina.com>  
> > If you can figure out a fixes tag that would be great.  Just reply to this thread
> > with it and I'll pick it up from here.  
> Oh, I just send a v3 patch, sorry....
> Fixes: d5098447147c ("iio: imu: mpu6050: add calibration offset support")
That works too!

Thanks,

J
> >> ---
> >> v2:
> >>   - fix the error of commit title.
> >> v1:
> >>   - https://lore.kernel.org/all/20231020091413.205743-2-suhui@nfschina.com/
> >>   drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4 ++--
> >>   1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> >> index 29f906c884bd..a9a5fb266ef1 100644
> >> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> >> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> >> @@ -749,13 +749,13 @@ inv_mpu6050_read_raw(struct iio_dev *indio_dev,
> >>   			ret = inv_mpu6050_sensor_show(st, st->reg->gyro_offset,
> >>   						chan->channel2, val);
> >>   			mutex_unlock(&st->lock);
> >> -			return IIO_VAL_INT;
> >> +			return ret;
> >>   		case IIO_ACCEL:
> >>   			mutex_lock(&st->lock);
> >>   			ret = inv_mpu6050_sensor_show(st, st->reg->accl_offset,
> >>   						chan->channel2, val);
> >>   			mutex_unlock(&st->lock);
> >> -			return IIO_VAL_INT;
> >> +			return ret;
> >>   
> >>   		default:
> >>   			return -EINVAL;  
> 


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

end of thread, other threads:[~2023-11-01 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20231027145949.243f03f2@jic23-huawei>
2023-10-30  2:10 ` [PATCH v2] iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw Su Hui
2023-11-01 10:00   ` Jonathan Cameron
2023-10-23  4:05 Su Hui
2023-10-23 12:57 ` Jean-Baptiste Maneyrol

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