[PATCH 06/13] serial imx: fix unregister

Sascha Hauer s.hauer at pengutronix.de
Sat Feb 25 10:51:03 EST 2012


- Add missing console_unregister call
- use dev->priv instead of dev->type_data

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/serial/serial_imx.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index 8547f36..72771fc 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -322,9 +322,9 @@ static int imx_serial_probe(struct device_d *dev)
 
 	priv = xzalloc(sizeof(*priv));
 	cdev = &priv->cdev;
+	dev->priv = priv;
 
 	priv->regs = dev_request_mem_region(dev, 0);
-	dev->type_data = cdev;
 	cdev->dev = dev;
 	cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
 	cdev->tstc = imx_serial_tstc;
@@ -350,9 +350,11 @@ static int imx_serial_probe(struct device_d *dev)
 
 static void imx_serial_remove(struct device_d *dev)
 {
-	struct console_device *cdev = dev->type_data;
+	struct imx_serial_priv *priv = dev->priv;
 
-	imx_serial_flush(cdev);
+	imx_serial_flush(&priv->cdev);
+	console_unregister(&priv->cdev);
+	free(priv);
 }
 
 static struct driver_d imx_serial_driver = {
-- 
1.7.9.1




More information about the barebox mailing list