mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/7] mci: make mci device a pure device
Date: Mon, 27 May 2013 10:52:50 +0200	[thread overview]
Message-ID: <1369644775-29887-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1369644775-29887-1-git-send-email-s.hauer@pengutronix.de>

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-05-27  8:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-27  8:52 [PATCH] MCI patches Sascha Hauer
2013-05-27  8:52 ` [PATCH 1/7] driver: Attach info callback to device, not to driver Sascha Hauer
2013-05-27  8:52 ` Sascha Hauer [this message]
2013-05-27  8:52 ` [PATCH 3/7] mci: embed mci device into struct mci Sascha Hauer
2013-05-27  8:52 ` [PATCH 4/7] mci: set name of mci device to same name as the filename Sascha Hauer
2013-05-27  8:52 ` [PATCH 5/7] of: Add of_alias_get function Sascha Hauer
2013-05-27  8:52 ` [PATCH 6/7] mci: imx-esdhc: allow to specify devicename via OF alias Sascha Hauer
2013-05-27  8:52 ` [PATCH 7/7] ARM: i.MX51: Add aliases for MMC controllers Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369644775-29887-3-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox