Re: [PATCH] surface pro 3: Add support driver for Surface Pro 3 buttons

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

 



On Thu, 2015-08-06 at 13:16 +0800, Chen Yu wrote:
> Since Surface Pro 3 does not follow the specs of "Windows ACPI Design
> Guide for SoC Platform", code in drivers/input/misc/soc_array.c can
> not detect these buttons on it.

style trivia:

> diff --git a/drivers/platform/x86/surfacepro3_button.c b/drivers/platform/x86/surfacepro3_button.c
[]
> +static void surface_button_notify(struct acpi_device *device, u32 event)
> +{
[]
> +	switch (event) {
> +	case SURFACE_BUTTON_NOTIFY_PRESS_POWER:
> +		pressed = true;
> +		/*go through*/

/* fall through */ is more common

> +	case SURFACE_BUTTON_NOTIFY_PRESS_HOME:
> +		pressed = true;
> +	case SURFACE_BUTTON_NOTIFY_RELEASE_HOME:
> +		key_code = KEY_LEFTMETA;
> +		break;

It may be better to add a comment about the style or
maybe add a macro like

#define HANDLE_SURFACE_BUTTON_NOTIFY(type, code)	\
	case SURFACE_BUTTON_NOTIFY_PRESS_##type:	\
		pressed = true;	/* and fall-through */	\
	case SURFACE_BUTTON_NOTIFY_RELEASE_##type:	\
		key_code = code;			\
		break;

> +	case SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_UP:
> +		pressed = true;
> +	case SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_UP:
> +		key_code = KEY_VOLUMEUP;
> +		break;

> +	case SURFACE_BUTTON_NOTIFY_PRESS_VOLUME_DOWN:
> +		pressed = true;
> +	case SURFACE_BUTTON_NOTIFY_RELEASE_VOLUME_DOWN:
> +		key_code = KEY_VOLUMEDOWN;
> +		break;
> +	default:
> +		dev_info(&device->dev,
> +				  "Unsupported event [0x%x]\n", event);

It might be useful to ratelimit this


--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux