[alsa-devel] [PATCH 5/6] ASoC: mxs: add device tree support for mxs-sgtl5000
Shawn Guo
shawn.guo at linaro.org
Thu May 10 08:20:04 EDT 2012
On Thu, May 10, 2012 at 07:16:46PM +0800, Dong Aisheng wrote:
> > +static int __devinit mxs_sgtl5000_probe_dt(struct platform_device *pdev)
> > +{
> > + struct device_node *np = pdev->dev.of_node;
> > + struct device_node *saif_np[2], *codec_np;
> > + struct platform_device *saif_pdev[2];
> > + int i, ret = 0;
> > +
> > + if (!np)
> > + return 1; /* no device tree */
> > +
> > + saif_np[0] = of_parse_phandle(np, "saif-controllers", 0);
> > + saif_np[1] = of_parse_phandle(np, "saif-controllers", 1);
> > + codec_np = of_parse_phandle(np, "audio-codec", 0);
> > + if (!saif_np[0] || !saif_np[1] || !codec_np) {
> > + dev_err(&pdev->dev, "phandle missing or invalid\n");
> > + return -EINVAL;
> > + }
> ...
>
> > +
> > + saif_pdev[0] = of_find_device_by_node(saif_np[0]);
> > + saif_pdev[1] = of_find_device_by_node(saif_np[1]);
> > + if (!saif_pdev[0] || !saif_pdev[1]) {
> > + dev_err(&pdev->dev, "failed to find saif platform device\n");
> > + ret = -EINVAL;
> > + goto out;
> > + }
> Do we really need this checking?
>
Hmm, why not? We need to ensure that the phandles are correctly
represented in device tree.
> > + card->dev = &pdev->dev;
> Repeat assignment?
>
Good catch, again. It's a rebasing error. Thanks.
Regards,
Shawn
More information about the linux-arm-kernel
mailing list