Hi, One more point for your devicetree conversions,
On Mon, Apr 29, 2013 at 01:30:01PM +0530, Prabhakar Lad wrote: > From: Lad, Prabhakar <prabhakar.cse...@gmail.com> > > add OF support for the mt9p031 sensor driver. > > +static struct mt9p031_platform_data > + *mt9p031_get_pdata(struct i2c_client *client) > + > +{ > + if (!client->dev.platform_data && client->dev.of_node) { > + struct device_node *np; > + struct mt9p031_platform_data *pdata; > + int ret; > + > + np = v4l2_of_get_next_endpoint(client->dev.of_node, NULL); > + if (!np) > + return NULL; > + > + pdata = devm_kzalloc(&client->dev, > + sizeof(struct mt9p031_platform_data), > + GFP_KERNEL); > + if (!pdata) { > + pr_warn("mt9p031 failed allocate memeory\n"); > + return NULL; > + } > + ret = of_property_read_u32(np, "reset", &pdata->reset); > + if (ret == -EINVAL) > + pdata->reset = -1; > + else if (ret == -ENODATA) > + return NULL; > + > + if (of_property_read_u32(np, "ext_freq", &pdata->ext_freq)) > + return NULL; > + > + if (of_property_read_u32(np, "target_freq", > + &pdata->target_freq)) > + return NULL; > + > + return pdata; > + } I don't know how the others see this, but IMO it would be cleaner to first add a duplicate of the members of pdata in struct mt9p031 and then initialize them either from pdata or from devicetree data. The (artificial) creation of platform_data for the devicetree case adds a new level of indirection. This may not be a problem here, but there are cases where there is no 1:1 transcription between pdata and devicetree possible. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html