[PATCH v2 1/3] Input: imx_keypad - Add device tree support

Shawn Guo shawn.guo at linaro.org
Thu Jan 3 02:11:00 EST 2013


On Tue, Jan 01, 2013 at 11:21:13AM +0800, Liu Ying wrote:
> +#ifdef CONFIG_OF
> +static inline int imx_keypad_check_dt(struct platform_device *pdev)
> +{
> +	struct device_node *np = pdev->dev.of_node;
> +
> +	if (!np)
> +		return -ENODEV;
> +
> +	return 0;
> +}
> +#else
> +static inline int imx_keypad_check_dt(struct platform_device *pdev)
> +{
> +	return -ENODEV;
> +}
> +#endif
> +
>  static int imx_keypad_probe(struct platform_device *pdev)
>  {
>  	const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data;
>  	struct imx_keypad *keypad;
>  	struct input_dev *input_dev;
>  	struct resource *res;
> -	int irq, error, i;
> +	int irq, error, i, row, col, row_shift;
>  
> -	if (keymap_data == NULL) {
> +	if (keymap_data == NULL && imx_keypad_check_dt(pdev)) {

Shouldn't the following just equally work?
	
	if (keymap_data == NULL && pdev->dev.of_node == NULL) {

Shawn

>  		dev_err(&pdev->dev, "no keymap defined\n");
>  		return -EINVAL;
>  	}




More information about the linux-arm-kernel mailing list