* [PATCH] iio/imu: inv_icm42600: Use max() helper macros
@ 2023-10-25 11:35 Bragatheswaran Manickavel
2023-10-27 8:54 ` Jean-Baptiste Maneyrol
0 siblings, 1 reply; 3+ messages in thread
From: Bragatheswaran Manickavel @ 2023-10-25 11:35 UTC (permalink / raw)
To: jmaneyrol, jic23, lars; +Cc: Bragatheswaran Manickavel, linux-iio, linux-kernel
Use the standard max() helper macros instead of direct
variable comparison using if/else blocks or ternary
operator. Change identified using minmax.cocci
Coccinelle semantic patch.
Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>
---
drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
index b1e4fde27d25..f67bd5a39beb 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
@@ -137,10 +137,7 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev,
out_unlock:
mutex_unlock(&st->lock);
/* sleep maximum required time */
- if (sleep_accel > sleep_temp)
- sleep = sleep_accel;
- else
- sleep = sleep_temp;
+ sleep = max(sleep_accel, sleep_temp);
if (sleep)
msleep(sleep);
return ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio/imu: inv_icm42600: Use max() helper macros
2023-10-25 11:35 [PATCH] iio/imu: inv_icm42600: Use max() helper macros Bragatheswaran Manickavel
@ 2023-10-27 8:54 ` Jean-Baptiste Maneyrol
2023-10-27 9:19 ` Bragatheswaran Manickavel
0 siblings, 1 reply; 3+ messages in thread
From: Jean-Baptiste Maneyrol @ 2023-10-27 8:54 UTC (permalink / raw)
To: Bragatheswaran Manickavel, jic23@kernel.org, lars@metafoo.de
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Hello,
thanks for this patch.
The same computation is also done inside inv_icm42600_gyro. Can you do a patch that is updating both files to use max?
Thanks a lot,
JB
From: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>
Sent: Wednesday, October 25, 2023 13:35
To: Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>; jic23@kernel.org <jic23@kernel.org>; lars@metafoo.de <lars@metafoo.de>
Cc: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
Subject: [PATCH] iio/imu: inv_icm42600: Use max() helper macros
Use the standard max() helper macros instead of direct variable comparison using if/else blocks or ternary operator. Change identified using minmax. cocci Coccinelle semantic patch. Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@ gmail. com>
ZjQcmQRYFpfptBannerStart
This Message Is From an Untrusted Sender
You have not previously corresponded with this sender.
ZjQcmQRYFpfptBannerEnd
Use the standard max() helper macros instead of direct
variable comparison using if/else blocks or ternary
operator. Change identified using minmax.cocci
Coccinelle semantic patch.
Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>
---
drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
index b1e4fde27d25..f67bd5a39beb 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
@@ -137,10 +137,7 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev,
out_unlock:
mutex_unlock(&st->lock);
/* sleep maximum required time */
- if (sleep_accel > sleep_temp)
- sleep = sleep_accel;
- else
- sleep = sleep_temp;
+ sleep = max(sleep_accel, sleep_temp);
if (sleep)
msleep(sleep);
return ret;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio/imu: inv_icm42600: Use max() helper macros
2023-10-27 8:54 ` Jean-Baptiste Maneyrol
@ 2023-10-27 9:19 ` Bragatheswaran Manickavel
0 siblings, 0 replies; 3+ messages in thread
From: Bragatheswaran Manickavel @ 2023-10-27 9:19 UTC (permalink / raw)
To: Jean-Baptiste Maneyrol, jic23@kernel.org, lars@metafoo.de
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
On 27/10/23 14:24, Jean-Baptiste Maneyrol wrote:
> Hello,
>
> thanks for this patch.
>
> The same computation is also done inside inv_icm42600_gyro. Can you do a patch that is updating both files to use max?
>
> Thanks a lot,
> JB
Hi Jean,
Same computation can be included in both inv_icm42600_gyro and
inv_icm42600_buffer.
Will make those changes and send a new patch.
Thanks,
Bragathe
>
> From: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>
> Sent: Wednesday, October 25, 2023 13:35
> To: Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@tdk.com>; jic23@kernel.org <jic23@kernel.org>; lars@metafoo.de <lars@metafoo.de>
> Cc: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
> Subject: [PATCH] iio/imu: inv_icm42600: Use max() helper macros
>
> Use the standard max() helper macros instead of direct variable comparison using if/else blocks or ternary operator. Change identified using minmax. cocci Coccinelle semantic patch. Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@ gmail. com>
> ZjQcmQRYFpfptBannerStart
> This Message Is From an Untrusted Sender
> You have not previously corresponded with this sender.
>
> ZjQcmQRYFpfptBannerEnd
> Use the standard max() helper macros instead of direct
> variable comparison using if/else blocks or ternary
> operator. Change identified using minmax.cocci
> Coccinelle semantic patch.
>
> Signed-off-by: Bragatheswaran Manickavel <bragathemanick0908@gmail.com>
> ---
> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
> index b1e4fde27d25..f67bd5a39beb 100644
> --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
> +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
> @@ -137,10 +137,7 @@ static int inv_icm42600_accel_update_scan_mode(struct iio_dev *indio_dev,
> out_unlock:
> mutex_unlock(&st->lock);
> /* sleep maximum required time */
> - if (sleep_accel > sleep_temp)
> - sleep = sleep_accel;
> - else
> - sleep = sleep_temp;
> + sleep = max(sleep_accel, sleep_temp);
> if (sleep)
> msleep(sleep);
> return ret;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-27 9:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-25 11:35 [PATCH] iio/imu: inv_icm42600: Use max() helper macros Bragatheswaran Manickavel
2023-10-27 8:54 ` Jean-Baptiste Maneyrol
2023-10-27 9:19 ` Bragatheswaran Manickavel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox