[PATCH 07/13] serial stm: fix unregister

Sascha Hauer s.hauer at pengutronix.de
Sat Feb 25 10:51:04 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/stm-serial.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/stm-serial.c b/drivers/serial/stm-serial.c
index 1563d2a..f6dcb84 100644
--- a/drivers/serial/stm-serial.c
+++ b/drivers/serial/stm-serial.c
@@ -31,6 +31,7 @@
 #include <notifier.h>
 #include <gpio.h>
 #include <io.h>
+#include <malloc.h>
 #include <mach/imx-regs.h>
 #include <mach/clock.h>
 
@@ -159,7 +160,7 @@ static int stm_serial_probe(struct device_d *dev)
 	cdev->setbrg = stm_serial_setbaudrate;
 	cdev->dev = dev;
 
-	dev->type_data = cdev;
+	dev->priv = priv;
 	priv->base = dev_request_mem_region(dev, 0);
 
 	stm_serial_init_port(priv);
@@ -177,9 +178,11 @@ static int stm_serial_probe(struct device_d *dev)
 
 static void stm_serial_remove(struct device_d *dev)
 {
-	struct console_device *cdev = dev->type_data;
+	struct stm_priv *priv = dev->priv;
 
-	stm_serial_flush(cdev);
+	stm_serial_flush(&priv->cdev);
+	console_unregister(&priv->cdev);
+	free(priv);
 }
 
 static struct driver_d stm_serial_driver = {
-- 
1.7.9.1




More information about the barebox mailing list