lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1292519639-21859-2-git-send-email-w.sang@pengutronix.de>
Date:	Thu, 16 Dec 2010 18:13:57 +0100
From:	Wolfram Sang <w.sang@...gutronix.de>
To:	devicetree-discuss@...abs.org
Cc:	linux-kernel@...r.kernel.org,
	Grant Likely <grant.likely@...retlab.ca>,
	Wolfram Sang <w.sang@...gutronix.de>
Subject: [PATCH 1/3] of: platform: introduce of_probe_platform_driver()

Introduce a function equivalent to platform_driver_probe() for of. This is
needed to keep some SoC devices in the __init section.

Signed-off-by: Wolfram Sang <w.sang@...gutronix.de>
---
 drivers/of/platform.c       |   30 +++++++++++++++++++++++++++---
 include/linux/of_platform.h |    2 ++
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 5b4a07f..511657b 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -72,7 +72,7 @@ static void platform_driver_shutdown_shim(struct platform_device *pdev)
 /**
  * of_register_platform_driver
  */
-int of_register_platform_driver(struct of_platform_driver *drv)
+int __of_register_platform_driver(struct of_platform_driver *drv, bool do_probe)
 {
 	char *of_name;
 
@@ -90,18 +90,42 @@ int of_register_platform_driver(struct of_platform_driver *drv)
 	sprintf(of_name, "of:%s", drv->driver.name);
 	drv->platform_driver.driver.name = of_name;
 
-	if (drv->probe)
-		drv->platform_driver.probe = platform_driver_probe_shim;
 	drv->platform_driver.remove = drv->remove;
 	if (drv->shutdown)
 		drv->platform_driver.shutdown = platform_driver_shutdown_shim;
 	drv->platform_driver.suspend = drv->suspend;
 	drv->platform_driver.resume = drv->resume;
 
+	if (do_probe)
+		return platform_driver_probe(&drv->platform_driver,
+					platform_driver_probe_shim);
+
+	if (drv->probe)
+		drv->platform_driver.probe = platform_driver_probe_shim;
+
 	return platform_driver_register(&drv->platform_driver);
 }
+
+int of_register_platform_driver(struct of_platform_driver *drv)
+{
+	return __of_register_platform_driver(drv, false);
+}
+
 EXPORT_SYMBOL(of_register_platform_driver);
 
+int of_probe_platform_driver(struct of_platform_driver *drv,
+		int (*probe)(struct platform_device *, const struct of_device_id *match))
+{
+	int ret;
+
+	drv->probe = probe;
+	ret = __of_register_platform_driver(drv, true);
+	drv->probe = NULL;
+
+	return ret;
+}
+EXPORT_SYMBOL(of_probe_platform_driver);
+
 void of_unregister_platform_driver(struct of_platform_driver *drv)
 {
 	platform_driver_unregister(&drv->platform_driver);
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index a68716a..c4082c7 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -53,6 +53,8 @@ extern void of_unregister_driver(struct of_platform_driver *drv);
 
 /* Platform drivers register/unregister */
 extern int of_register_platform_driver(struct of_platform_driver *drv);
+extern int of_probe_platform_driver(struct of_platform_driver *drv,
+		int (*probe)(struct platform_device *, const struct of_device_id *match));
 extern void of_unregister_platform_driver(struct of_platform_driver *drv);
 
 extern struct platform_device *of_device_alloc(struct device_node *np,
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ