[PATCH 1/7] mci: embed mci_dev into mci_host instead of allocating it seperately

Sascha Hauer s.hauer at pengutronix.de
Mon Aug 15 04:46:26 EDT 2011


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mci/mci-core.c |    4 +---
 include/mci.h          |    1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index fea2691..6a29619 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1359,9 +1359,7 @@ device_initcall(mci_init);
  */
 int mci_register(struct mci_host *host)
 {
-	struct device_d *mci_dev;
-
-	mci_dev = xzalloc(sizeof(struct device_d));
+	struct device_d *mci_dev = &host->dev;
 
 	strcpy(mci_dev->name, mci_driver.name);
 	mci_dev->platform_data = (void*)host;
diff --git a/include/mci.h b/include/mci.h
index 8c669ca..69cffe8 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -194,6 +194,7 @@ struct mci_data {
 /** host information */
 struct mci_host {
 	struct device_d *hw_dev;	/**< the host MCI hardware device */
+	struct device_d dev;		/**< our device */
 	unsigned voltages;
 	unsigned host_caps;	/**< Host's interface capabilities, refer MMC_VDD_* */
 	unsigned f_min;		/**< host interface lower limit */
-- 
1.7.5.4




More information about the barebox mailing list