Re: [PATCH 8/9] Fixed indentation violation in switch statement : Aligned the "switch" and its subordinate "case" labels in the same column instead of "double-intending" the "case" labels.

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

 



On Sat, 17 Jan 2015 17:23:45 +0530
Shailendra Verma <shailendra.capricorn@xxxxxxxxx> wrote:

> 
> Signed-off-by: Shailendra Verma <shailendra.capricorn@xxxxxxxxx>
> ---
>  drivers/input/evdev.c    |   30 ++++++++++++++++++++----------
>  drivers/input/mousedev.c |   18 ++++++++++++------
>  2 files changed, 32 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> index 18d4b2c..85ee594 100644
> --- a/drivers/input/evdev.c
> +++ b/drivers/input/evdev.c
> @@ -667,16 +667,26 @@ static int handle_eviocgbit(struct input_dev *dev,
>  
>  	switch (type) {
>  
> -	case      0: bits = dev->evbit;  len = EV_MAX;  break;
> -	case EV_KEY: bits = dev->keybit; len = KEY_MAX; break;
> -	case EV_REL: bits = dev->relbit; len = REL_MAX; break;
> -	case EV_ABS: bits = dev->absbit; len = ABS_MAX; break;
> -	case EV_MSC: bits = dev->mscbit; len = MSC_MAX; break;
> -	case EV_LED: bits = dev->ledbit; len = LED_MAX; break;
> -	case EV_SND: bits = dev->sndbit; len = SND_MAX; break;
> -	case EV_FF:  bits = dev->ffbit;  len = FF_MAX;  break;
> -	case EV_SW:  bits = dev->swbit;  len = SW_MAX;  break;
> -	default: return -EINVAL;

I have the feeling this formatting was deliberate, to make comparing the
lines easier, see the alignment after colons and semicolons.

> +	case      0:
> +		bits = dev->evbit;  len = EV_MAX;  break;
> +	case EV_KEY:
> +		bits = dev->keybit; len = KEY_MAX; break;
> +	case EV_REL:
> +		bits = dev->relbit; len = REL_MAX; break;
> +	case EV_ABS:
> +		bits = dev->absbit; len = ABS_MAX; break;
> +	case EV_MSC:
> +		bits = dev->mscbit; len = MSC_MAX; break;
> +	case EV_LED:
> +		bits = dev->ledbit; len = LED_MAX; break;
> +	case EV_SND:
> +		bits = dev->sndbit; len = SND_MAX; break;
> +	case EV_FF:
> +		bits = dev->ffbit;  len = FF_MAX;  break;
> +	case EV_SW:
> +		bits = dev->swbit;  len = SW_MAX;  break;
> +	default:
> +		return -EINVAL;
>  	}
>

Now, this is a mixed style, multiple statements are still on the same
line which is also somewhat against the code style.

FWIW I'd leave the code current code untouched.

>  	return bits_to_user(bits, len, size, p, compat_mode);
> diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
> index b604564..a9857dd 100644
> --- a/drivers/input/mousedev.c
> +++ b/drivers/input/mousedev.c
> @@ -230,25 +230,31 @@ static void mousedev_key_event(struct mousedev *mousedev,
>  
>  	case BTN_TOUCH:
>  	case BTN_0:
> -	case BTN_LEFT:		index = 0; break;
> +	case BTN_LEFT:
> +		index = 0; break;
>

This makes more sense indeed but the break is still on the same line of
the assignment, if you change the style fix it for good and put the
break on its own line.

>  	case BTN_STYLUS:
>  	case BTN_1:
> -	case BTN_RIGHT:		index = 1; break;
> +	case BTN_RIGHT:
> +		index = 1; break;
>  
>  	case BTN_2:
>  	case BTN_FORWARD:
>  	case BTN_STYLUS2:
> -	case BTN_MIDDLE:	index = 2; break;
> +	case BTN_MIDDLE:
> +		index = 2; break;
>  
>  	case BTN_3:
>  	case BTN_BACK:
> -	case BTN_SIDE:		index = 3; break;
> +	case BTN_SIDE:
> +		index = 3; break;
>  
>  	case BTN_4:
> -	case BTN_EXTRA:		index = 4; break;
> +	case BTN_EXTRA:
> +		index = 4; break;
>  
> -	default:		return;
> +	default:
> +		return;
>  	}
>  
>  	if (value) {
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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