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] [day] [month] [year] [list]
Message-ID: <20231028143230.1a6f3187@jic23-huawei>
Date:   Sat, 28 Oct 2023 14:33:10 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@....com>
Cc:     Bragatheswaran Manickavel <bragathemanick0908@...il.com>,
        "lars@...afoo.de" <lars@...afoo.de>,
        "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] iio/imu: inv_icm42600: Use max() helper macros

On Fri, 27 Oct 2023 15:19:49 +0000
Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@....com> wrote:

> Hello,
> 
> thanks for the patch, looks good.
> 
> Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@....com>

Interestingly b4 isn't finding this tag.  I'm too lazy to look into why but
seems your email didn't reach patchwork either.
Applied it by hand whilst applying the patch to the togreg branch of iio.git
which given timing will be rebase on rc1 once available.  For now I'll just
push it out as testing to give 0-day a head start.


Jonathan

> 
> Thanks,
> JB
> 
> From: Bragatheswaran Manickavel <bragathemanick0908@...il.com>
> Sent: Friday, October 27, 2023 11:44
> To: Jean-Baptiste Maneyrol <Jean-Baptiste.Maneyrol@....com>; jic23@...nel.org <jic23@...nel.org>; lars@...afoo.de <lars@...afoo.de>
> Cc: Bragatheswaran Manickavel <bragathemanick0908@...il.com>; linux-iio@...r.kernel.org <linux-iio@...r.kernel.org>; linux-kernel@...r.kernel.org <linux-kernel@...r.kernel.org>
> Subject: [PATCH v2] 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@...il.com>
> ---
> V1 -> V2: Adding similar changes to inv_icm42600_gyro & inv_icm42600_buffer
> 
>  drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c  | 5 +----
>  drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c | 5 +----
>  drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c   | 5 +----
>  3 files changed, 3 insertions(+), 12 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;
> diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
> index 6ef1df9d60b7..b52f328fd26c 100644
> --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
> +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c
> @@ -424,10 +424,7 @@ static int inv_icm42600_buffer_postdisable(struct iio_dev *indio_dev)
>  	mutex_unlock(&st->lock);
>  
>  	/* sleep maximum required time */
> -	if (sleep_sensor > sleep_temp)
> -		sleep = sleep_sensor;
> -	else
> -		sleep = sleep_temp;
> +	sleep = max(sleep_sensor, sleep_temp);
>  	if (sleep)
>  		msleep(sleep);
>  
> diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c
> index 3bf946e56e1d..3df0a715e885 100644
> --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c
> +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c
> @@ -137,10 +137,7 @@ static int inv_icm42600_gyro_update_scan_mode(struct iio_dev *indio_dev,
>  out_unlock:
>  	mutex_unlock(&st->lock);
>  	/* sleep maximum required time */
> -	if (sleep_gyro > sleep_temp)
> -		sleep = sleep_gyro;
> -	else
> -		sleep = sleep_temp;
> +	sleep = max(sleep_gyro, sleep_temp);
>  	if (sleep)
>  		msleep(sleep);
>  	return ret;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ