Re: [PATCH V2 2/2] Input: spear-keyboard: add device tree bindings

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

 



Hi Viresh,

On Tue, Mar 27, 2012 at 11:08:12AM +0530, Viresh Kumar wrote:
> +	if (np) {
> +		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> +		if (!pdata) {
> +			dev_err(&pdev->dev, "DT: kzalloc failed\n");
> +			return -ENOMEM;
> +		}
> +
> +		pdev->dev.platform_data = pdata;
> +		error = spear_kbd_probe_dt(pdev);
> +		if (error) {
> +			dev_err(&pdev->dev, "DT: no platform data\n");
> +			return error;
> +		}
> +	} else {
> +		pdata = dev_get_platdata(&pdev->dev);
> +		if (!pdata || !pdata->keymap) {
> +			dev_err(&pdev->dev, "Invalid platform data\n");
> +			return -EINVAL;
> +		}
>  	}

I think the opposite order woudl make more sense - if pdata is supplied
by the platform code then we should use it, otherwise try to see if
there is OF data available instead. This way one can easily override OF
data, if needed.

Same goes for keymap data.

Thanks.

-- 
Dmitry
--
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