Thread (6 messages) flat view 6 messages, 2 authors, 2012-03-13

Re: [PATCH v2] stmmac: Add device-tree support

From: Viresh Kumar <hidden>
Date: 2012-03-13 08:53:06
Also in: netdev

On 3/13/2012 12:53 PM, Stefan Roese wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/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,
+					    const char **mac)
+{
<snip...>
+}
+#else
+static int __devinit stmmac_probe_config_dt(struct platform_device *pdev,
+					    struct plat_stmmacenet_data *plat,
+					    const char **mac)
+{
+	return ERR_PTR(-ENOSYS);
why ERR_PTR()?
+}
+#endif /* CONFIG_OF */
+
 /**
  * stmmac_pltfr_probe
  * @pdev: platform device pointer
quoted hunk ↗ jump to hunk
@@ -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),
+					GFP_KERNEL);
+		if (!plat_dat) {
+			pr_err("%s: ERROR: no memory", __func__);
why don't we use dev_err here?
+			ret = -ENOMEM;
+			goto out_unmap;
+		}
+
+		ret = stmmac_probe_config_dt(pdev, plat_dat, &mac);
+		if (ret) {
+			pr_err("%s: main dt probe failed", __func__);
here too?

-- 
viresh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help