[PATCH 08/11] smc911x: embed eth_device into priv

Sascha Hauer s.hauer at pengutronix.de
Thu Jul 28 09:42:01 EDT 2011


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/net/smc911x.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 615fd61..8c6f9fc 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -368,6 +368,7 @@
 #define CHIP_9221	0x9221
 
 struct smc911x_priv {
+	struct eth_device edev;
 	struct mii_device miidev;
 	void __iomem *base;
 };
@@ -712,12 +713,10 @@ static int smc911x_probe(struct device_d *dev)
 
 	dev_info(dev, "detected %s controller\n", chip_ids[i].name);
 
-	edev = xzalloc(sizeof(struct eth_device) +
-			sizeof(struct smc911x_priv));
+	priv = xzalloc(sizeof(*priv));
+	edev = &priv->edev;
 	dev->type_data = edev;
-	edev->priv = (struct smc911x_priv *)(edev + 1);
-
-	priv = edev->priv;
+	edev->priv = priv;
 
 	edev->init = smc911x_init_dev;
 	edev->open = smc911x_eth_open;
-- 
1.7.5.4




More information about the barebox mailing list