[PATCH 09/30] leon, apbuart: Assign proper device name

Daniel Hellstrom daniel at gaisler.com
Thu Apr 13 19:31:18 UTC 2017


From: Martin Aberg <maberg at gaisler.com>

Always assign a device/file system name.
Use device unique name for ISR.
---
 c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
index e6cbd82..1547e78 100644
--- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
+++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
@@ -307,8 +307,6 @@ int apbuart_init1(struct drvmgr_dev *dev)
 			priv->condev.flags &= ~CONSOLE_FLAG_SYSCON;
 	}
 
-	priv->condev.fsname = NULL;
-
 	/* Select 0=Polled, 1=IRQ, 2=Task-Driven UART Mode */
 	value = drvmgr_dev_key_get(priv->dev, "mode", DRVMGR_KT_INT);
 	if (value)
@@ -324,6 +322,7 @@ int apbuart_init1(struct drvmgr_dev *dev)
 		priv->condev.handler = &handler_polled;
 	}
 
+	priv->condev.fsname = NULL;
 	/* Get Filesystem name prefix */
 	prefix[0] = '\0';
 	if (drvmgr_get_dev_prefix(dev, prefix)) {
@@ -332,6 +331,8 @@ int apbuart_init1(struct drvmgr_dev *dev)
 		 */
 		sprintf(priv->devName, "/dev/%sapbuart%d", prefix, dev->minor_bus);
 		priv->condev.fsname = priv->devName;
+	} else {
+		sprintf(priv->devName, "/dev/apbuart%d", dev->minor_drv);
 	}
 
 	/* Register it as a console device, the console driver will register
@@ -453,7 +454,7 @@ static bool first_open(
 
 		/* Register interrupt and enable it */
 		ret = drvmgr_interrupt_register(
-			uart->dev, 0, "apbuart", apbuart_cons_isr, tty
+			uart->dev, 0, uart->devName, apbuart_cons_isr, tty
 		);
 		if (ret) {
 			return false;
-- 
2.7.4




More information about the devel mailing list