[PATCH v3] arm/tegra: emc: convert tegra2_emc to a platform driver
From: Olof Johansson <hidden>
Date: 2012-01-06 01:36:46
Also in:
linux-tegra
On Thu, Jan 5, 2012 at 2:14 PM, Stephen Warren [off-list ref] wrote:
Olof Johansson wrote at Wednesday, January 04, 2012 11:01 PM:quoted
This is the first step in making it device-tree aware and get rid of the in-kernel EMC tables (of which there are none in mainline, thankfully). Changes since v2: * D'oh -- missed a couple of variables that were added, never used and then ? later removed in a later patch. Changes since v1: * Fixed messed up indentation * Removed code that should be gone (was added here and removed later in series) Signed-off-by: Olof Johansson <redacted>...quoted
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c...quoted
+static int __devinit tegra_emc_probe(struct platform_device *pdev)...quoted
+ ? ? if (!request_mem_region(res->start, resource_size(res), "tegra_emc")) { + ? ? ? ? ? ? dev_err(&pdev->dev, "failed to request register region\n"); + ? ? ? ? ? ? return -EBUSY; + ? ? } + + ? ? emc_regbase = ioremap(res->start, resource_size(res));Don't you need to error-check the ioremap() result, and undo the request_mem_region() too? Or, use the devm variant to request the region. The rest of the code checks emc_pdev!=NULL which won't detect this failure. Isn't there a get_resource && request && remap function now; I think I recall a patch that wraps all that into one function, but it might have been DT-only.
Nope, it's there -- devm_request_and_ioremap(). I'll move it over to that and repost, it's a good idea. -Olof