Re: [PATCH 1/4] input: mc13783: Make mc13xxx_buttons_platform_data more flexible

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

 



> Instead of define each button in separate variable, make an array
> for storing all buttons. This change will help to add support for
> other types of PMIC and add support for probing with devicetree
> in the future.
> 
> Signed-off-by: Alexander Shiyan <shc_work@xxxxxxx>
> ---
>  arch/arm/mach-imx/mach-mx31moboard.c   |  9 ++++--
>  drivers/input/misc/mc13783-pwrbutton.c | 56 +++++++++++++++++-----------------
>  include/linux/mfd/mc13xxx.h            | 28 +++++++++--------

Are all the changes in these files entangled? If there is any way to
make them orthogonal, then all the better.

<snip>

> --- a/include/linux/mfd/mc13xxx.h
> +++ b/include/linux/mfd/mc13xxx.h
> @@ -172,20 +172,22 @@ struct mc13xxx_leds_platform_data {
>  	u32 led_control[MAX_LED_CONTROL_REGS];
>  };
>  
> +#define MAX13XXX_NUM_BUTTONS	3
> +
> +struct mc13xxx_button {
> +	u16		keycode;
> +	unsigned int	flags;
> +#define MC13XXX_BUTTON_DBNC_0MS		0
> +#define MC13XXX_BUTTON_DBNC_30MS	1
> +#define MC13XXX_BUTTON_DBNC_150MS	2
> +#define MC13XXX_BUTTON_DBNC_750MS	3
> +#define MC13XXX_BUTTON_ENABLE		(1 << 2)
> +#define MC13XXX_BUTTON_POL_INVERT	(1 << 3)
> +#define MC13XXX_BUTTON_RESET_EN		(1 << 4)
> +};
> +

Please take the opportunity to remove this slab list of #defines from
the centre of the struct definition. Just above will be fine.

>  struct mc13xxx_buttons_platform_data {
> -#define MC13783_BUTTON_DBNC_0MS		0
> -#define MC13783_BUTTON_DBNC_30MS	1
> -#define MC13783_BUTTON_DBNC_150MS	2
> -#define MC13783_BUTTON_DBNC_750MS	3
> -#define MC13783_BUTTON_ENABLE		(1 << 2)
> -#define MC13783_BUTTON_POL_INVERT	(1 << 3)
> -#define MC13783_BUTTON_RESET_EN		(1 << 4)
> -	int b1on_flags;
> -	unsigned short b1on_key;
> -	int b2on_flags;
> -	unsigned short b2on_key;
> -	int b3on_flags;
> -	unsigned short b3on_key;
> +	struct mc13xxx_button	buttons[MAX13XXX_NUM_BUTTONS];
>  };
>  
>  struct mc13xxx_ts_platform_data {

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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