Re: [PATCH RESEND v2 2/2] Input: touchscreen: ads7846: add device tree bindings
From: Daniel Mack <zonque@gmail.com>
Date: 2013-07-01 06:51:54
From: Daniel Mack <zonque@gmail.com>
Date: 2013-07-01 06:51:54
Hi Dmirty, On 01.07.2013 03:35, Dmitry Torokhov wrote:
On Sun, Jun 30, 2013 at 11:09:15PM +0200, Daniel Mack wrote:quoted
+static struct ads7846_platform_data *ads7846_probe_dt(struct device *dev) +{ + struct ads7846_platform_data *pdata = NULL; + const struct of_device_id *match; + u32 val; + + match = of_match_device(ads7846_dt_ids, dev); + if (!match) + return NULL; + + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return NULL; + + pdata->model = (unsigned int) match->data;The pointer is long so this conversion does generate compile warnings.quoted
+ + if (of_property_read_u32(dev->of_node, "ti,vref-delay-usecs", &val) == 0) + pdata->vref_delay_usecs = val;Why don't we use u16 properties to match the platform data? How about the version of the patch below?
Yes, that should work as well, and it looks cleaner. Feel free to commit your version :) As I said - I don't have access to the hardware anymore, so I can't give it a real test right now. Thanks, Daniel