[PATCH 4/5] net i.MX fec: embed ethernet device into priv

Sascha Hauer s.hauer at pengutronix.de
Thu Jul 28 06:08:31 EDT 2011


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

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 6886ccc..72f7faa 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -605,9 +605,9 @@ static int fec_probe(struct device_d *dev)
 #ifdef CONFIG_ARCH_IMX27
 	PCCR0 |= PCCR0_FEC_EN;
 #endif
-	edev = (struct eth_device *)xzalloc(sizeof(struct eth_device));
+	fec = xzalloc(sizeof(*fec));
+	edev = &fec->edev;
 	dev->type_data = edev;
-	fec = (struct fec_priv *)xzalloc(sizeof(*fec));
 	edev->priv = fec;
 	edev->open = fec_open;
 	edev->init = fec_init;
diff --git a/drivers/net/fec_imx.h b/drivers/net/fec_imx.h
index e07071a..19f4709 100644
--- a/drivers/net/fec_imx.h
+++ b/drivers/net/fec_imx.h
@@ -144,6 +144,7 @@ struct buffer_descriptor {
  * @brief i.MX27-FEC private structure
  */
 struct fec_priv {
+	struct eth_device edev;
 	void __iomem *regs;
 	xceiver_type xcv_type;			/* transceiver type          */
 	struct buffer_descriptor __iomem *rbd_base;	/* RBD ring                  */
-- 
1.7.5.4




More information about the barebox mailing list