Thread (4 messages) 4 messages, 3 authors, 2011-08-15

Re: [PATCHv4] mtd: gpio-nand: add device tree bindings

From: Artem Bityutskiy <hidden>
Date: 2011-08-15 14:28:57

Possibly related (same subject, not in this thread)

On Tue, 2011-08-09 at 16:12 +0100, Jamie Iles wrote:
quoted hunk
-	res1 = platform_get_resource(dev, IORESOURCE_MEM, 1);
+	if (!dev->dev.of_node)
+		res1 = platform_get_resource(dev, IORESOURCE_MEM, 1);
+	else
+		res1 = gpio_nand_of_get_io_sync(&dev->dev);
+
 	if (res1) {
 		gpiomtd->io_sync = request_and_remap(res1, 4, "NAND sync", &ret);
 		if (!gpiomtd->io_sync) {
@@ -257,7 +362,16 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
 		}
 	}
 
-	memcpy(&gpiomtd->plat, dev->dev.platform_data, sizeof(gpiomtd->plat));
+	if (dev->dev.of_node)
+		kfree(res1);
+
+	if (dev->dev.platform_data)
+		memcpy(&gpiomtd->plat, dev->dev.platform_data,
+		       sizeof(gpiomtd->plat));
+	else
+		ret = gpio_nand_of_get_config(&dev->dev, &gpiomtd->plat);
+	if (ret)
+		goto err_nce;
 
So with this code you can mix platform data and DT? Say, io_sync may
come from platform data and the rest from the DT? Is this normal
practice?

-- 
Best Regards,
Artem Bityutskiy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help