Re: [PATCH v1 2/5] Input: edt-ft5x06 - refactor condition in edt_ft5x06_debugfs_mode_set()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 03, 2020 at 08:09:14PM +0200, Andy Shevchenko wrote:
> For better reading unroll nested conditions to simple if-else-if.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/input/touchscreen/edt-ft5x06.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> index d2587724c52a..cb67104c6934 100644
> --- a/drivers/input/touchscreen/edt-ft5x06.c
> +++ b/drivers/input/touchscreen/edt-ft5x06.c
> @@ -666,10 +666,10 @@ static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode)
>  
>  	mutex_lock(&tsdata->mutex);
>  
> -	if (mode != tsdata->factory_mode) {
> -		retval = mode ? edt_ft5x06_factory_mode(tsdata) :
> -				edt_ft5x06_work_mode(tsdata);
> -	}
> +	if (mode && !tsdata->factory_mode)
> +		retval = edt_ft5x06_factory_mode(tsdata);
> +	else if (!mode && tsdata->factory_mode)
> +		retval = edt_ft5x06_work_mode(tsdata);

Sorry, I find the original better, as I read it

	if mode changing then
		activate desired mode (either factory or normal mode)

Thanks.

-- 
Dmitry



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux