Skip to contentSkip to conversation

: Change Sun serial major/minor numbers...

PATCH In review David Miller 2 participants 2 messages Sep 13, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Change Sun serial major/minor numbers...

[ Resending, my first send trigger'd vger filters ]

This is the non-serious patch I mentioned in my first posting which changes all of the major/minor numbers used by the Sun serial drivers in order to get out of the way of 8250's major/minor namespace.

Again, this patch isn't meant to be taken seriously at all. I'm not even willing to sign off on it :-)

Documentation/devices.txt +9 -0
index 05c8064..0d1b1f9 100644
@@ -2807,6 +2807,15 @@ Your cooperation is appreciated.
 		    ...
 		 190 = /dev/ttyUL3		Xilinx uartlite - port 3
 		 191 = /dev/xvc0		Xen virtual console - port 0
+		 192 = /dev/ttySZ0		Sun Zilog - port 0
+		    ...
+		 207 = /dev/ttySZ15		Sun Zilog - port 15
+		 208 = /dev/ttySU0		Sun SU - port 0
+		    ...
+		 215 = /dev/ttySU7		Sun SU - port 7
+		 216 = /dev/ttySB0		Sun SAB82532 - port 0
+		 217 = /dev/ttySB1		Sun SAB82532 - port 1
+		 218 = /dev/ttyHV0		Sun Hypervisor console - port 0
 
 205 char	Low-density serial ports (alternate device)
 		  0 = /dev/culu0		Callout device for ttyLU0
drivers/serial/sunhv.c +12 -5
index a94a2ab..9858b76 100644
@@ -32,6 +32,11 @@
 
 #include "suncore.h"
 
+#define SUNHV_MAJOR	204
+#define SUNHV_MINOR	218
+#define SUNHV_NR	1
+#define SUNHV_NAME	"ttyHV"
+
 #define CON_BREAK	((long)-1)
 #define CON_HUP		((long)-2)
 
@@ -393,8 +398,10 @@ static struct uart_ops sunhv_pops = {
 static struct uart_driver sunhv_reg = {
 	.owner			= THIS_MODULE,
 	.driver_name		= "sunhv",
-	.dev_name		= "ttyS",
-	.major			= TTY_MAJOR,
+	.dev_name		= SUNHV_NAME,
+	.major			= SUNHV_MAJOR,
+	.minor			= SUNHV_MINOR,
+	.nr			= SUNHV_NR,
 };
 
 static struct uart_port *sunhv_port;
@@ -561,7 +568,7 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *m
 
 	port->dev = &op->dev;
 
-	err = sunserial_register_minors(&sunhv_reg, 1);
+	err = uart_register_driver(&sunhv_reg);
 	if (err)
 		goto out_free_con_read_page;
 
@@ -584,7 +591,7 @@ out_remove_port:
 	uart_remove_one_port(&sunhv_reg, port);
 
 out_unregister_driver:
-	sunserial_unregister_minors(&sunhv_reg, 1);
+	uart_unregister_driver(&sunhv_reg);
 
 out_free_con_read_page:
 	kfree(con_read_page);
@@ -606,7 +613,7 @@ static int __devexit hv_remove(struct of_device *dev)
 
 	uart_remove_one_port(&sunhv_reg, port);
 
-	sunserial_unregister_minors(&sunhv_reg, 1);
+	uart_unregister_driver(&sunhv_reg);
 
 	kfree(port);
 	sunhv_port = NULL;
drivers/serial/sunsab.c +25 -18

85 lines not on this page · raw message

drivers/serial/sunsu.c +18 -14
index a4dc79b..68b21b8 100644
@@ -49,6 +49,11 @@
 
 #include "suncore.h"
 
+#define SUNSU_MAJOR		204
+#define SUNSU_MINOR		208
+#define SUNSU_NR		4
+#define SUNSU_NAME		"ttySU"
+
 /* We are on a NS PC87303 clocked with 24.0 MHz, which results
  * in a UART clock of 1.8462 MHz.
  */
@@ -1174,8 +1179,10 @@ out:
 static struct uart_driver sunsu_reg = {
 	.owner			= THIS_MODULE,
 	.driver_name		= "sunsu",
-	.dev_name		= "ttyS",
-	.major			= TTY_MAJOR,
+	.dev_name		= SUNSU_NAME,
+	.major			= SUNSU_MAJOR,
+	.minor			= SUNSU_MINOR,
+	.nr			= SUNSU_NR,
 };
 
 static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up)
@@ -1335,8 +1342,8 @@ static int __init sunsu_console_setup(struct console *co, char *options)
 	int parity = 'n';
 	int flow = 'n';
 
-	printk("Console: ttyS%d (SU)\n",
-	       (sunsu_reg.minor - 64) + co->index);
+	printk("Console: ttySU%d (SU)\n",
+	       (sunsu_reg.minor - SUNSU_MINOR) + co->index);
 
 	/*
 	 * Check whether an invalid uart number has been specified, and
@@ -1359,7 +1366,7 @@ static int __init sunsu_console_setup(struct console *co, char *options)
 }
 
 static struct console sunsu_console = {
-	.name	=	"ttyS",
+	.name	=	SUNSU_NAME,
 	.write	=	sunsu_console_write,
 	.device	=	uart_console_device,
 	.setup	=	sunsu_console_setup,
@@ -1549,23 +1556,20 @@ static int __init sunsu_init(void)
 		}
 	}
 
-	if (num_uart) {
-		err = sunserial_register_minors(&sunsu_reg, num_uart);
-		if (err)
-			return err;
-	}
+	err = uart_register_driver(&sunsu_reg);
+	if (err)
+		return err;
 
 	err = of_register_driver(&su_driver, &of_bus_type);
-	if (err && num_uart)
-		sunserial_unregister_minors(&sunsu_reg, num_uart);
+	if (err)
+		uart_unregister_driver(&sunsu_reg);
 
 	return err;
 }
 
 static void __exit sunsu_exit(void)
 {
-	if (sunsu_reg.nr)
-		sunserial_unregister_minors(&sunsu_reg, sunsu_reg.nr);
+	uart_unregister_driver(&sunsu_reg);
 }
 
 module_init(sunsu_init);
drivers/serial/sunzilog.c +24 -22

102 lines not on this page · raw message

#1 lore raw

Hi Dave,

Quoted 7 lines

This is the non-serious patch I mentioned in my first posting which changes all of the major/minor numbers used by the Sun serial drivers in order to get out of the way of 8250's major/minor namespace.

Again, this patch isn't meant to be taken seriously at all. I'm not even willing to sign off on it :-)

as long as you are using udev, it wouldn't that big of a problem :)

Regards

Marcel