[PATCH 2/7] mci: make mci device a pure device

Sascha Hauer s.hauer at pengutronix.de
Mon May 27 04:52:50 EDT 2013


No need to match and probe the device if all that we want is a logical
deivice for the mci.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mci/mci-core.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 5c00018..9cc6cfb 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1629,15 +1629,11 @@ on_error:
 	return rc;
 }
 
-static struct driver_d mci_driver = {
-	.name	= "mci",
-	.probe	= mci_probe,
-};
-
 static int mci_init(void)
 {
 	sector_buf = xmemalign(32, 512);
-	return platform_driver_register(&mci_driver);
+
+	return 0;
 }
 
 device_initcall(mci_init);
@@ -1649,12 +1645,28 @@ device_initcall(mci_init);
  */
 int mci_register(struct mci_host *host)
 {
+	int ret;
 	struct device_d *mci_dev = xzalloc(sizeof(struct device_d));
 
+	strcpy(mci_dev->name, "mci");
 	mci_dev->id = DEVICE_ID_DYNAMIC;
-	strcpy(mci_dev->name, mci_driver.name);
 	mci_dev->platform_data = host;
 	mci_dev->parent = host->hw_dev;
 
-	return platform_device_register(mci_dev);
+	ret = register_device(mci_dev);
+	if (ret)
+		goto err_free;
+
+	ret = mci_probe(mci_dev);
+	if (ret)
+		goto err_unregister;
+
+	return 0;
+
+err_unregister:
+	unregister_device(mci_dev);
+err_free:
+	free(mci_dev);
+
+	return ret;
 }
-- 
1.8.2.rc2




More information about the barebox mailing list