Re: [PATCH v2] stmmac: Add device-tree support
From: Stefan Roese <sr@denx.de>
Date: 2012-03-13 10:29:34
Also in:
linux-devicetree
On Tuesday 13 March 2012 09:53:06 Viresh Kumar wrote:
On 3/13/2012 12:53 PM, Stefan Roese wrote:quoted
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.cb/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +#ifdef CONFIG_OF +static int __devinit stmmac_probe_config_dt(struct platform_device *pdev, + struct
plat_stmmacenet_data *plat,
quoted
+ const char **mac) +{<snip...>quoted
+} +#else +static int __devinit stmmac_probe_config_dt(struct platform_device *pdev, + struct
plat_stmmacenet_data *plat,
quoted
+ const char **mac) +{ + return ERR_PTR(-ENOSYS);why ERR_PTR()?
Thanks for spotting. Will fix in next version.
quoted
+} +#endif /* CONFIG_OF */ + /** * stmmac_pltfr_probe * @pdev: platform device pointer@@ -58,7 +101,25 @@ static int stmmac_pltfr_probe(struct platform_device*pdev) ret = -ENOMEM; goto out_release_region; } - plat_dat = pdev->dev.platform_data; + + if (pdev->dev.of_node) { + plat_dat = devm_kzalloc(&pdev->dev, + sizeof(struct
plat_stmmacenet_data),
quoted
+ GFP_KERNEL); + if (!plat_dat) { + pr_err("%s: ERROR: no memory", __func__);why don't we use dev_err here?
Consistency. pr_err is used in this driver. So I'm sticking to it with this patch as well. Thanks, Stefan