summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/sio/sio.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index ff32193..7f8e586 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -2753,6 +2753,18 @@ struct siocnstate {
u_char mcr;
};
+/*
+ * This is a function in order to not replicate "ttyd%d" more
+ * places than absolutely necessary.
+ */
+static void
+siocnset(struct consdev *cd, int unit)
+{
+
+ cd->cn_unit = unit;
+ sprintf(cd->cn_name, "ttyd%d", unit);
+}
+
#ifndef __alpha__
static speed_t siocngetspeed(Port_t, u_long rclk);
#endif
@@ -2976,7 +2988,7 @@ siocnprobe(cp)
splx(s);
if (COM_CONSOLE(flags) && !COM_LLCONSOLE(flags)) {
- cp->cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(cp, unit);
cp->cn_pri = COM_FORCECONSOLE(flags)
|| boothowto & RB_SERIAL
? CN_REMOTE : CN_NORMAL;
@@ -2988,7 +3000,7 @@ siocnprobe(cp)
siogdbiobase = iobase;
siogdbunit = unit;
#if DDB > 0
- gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(&gdbconsdev, unit);
gdb_arg = &gdbconsdev;
gdb_getc = siocngetc;
gdb_putc = siocnputc;
@@ -3010,7 +3022,7 @@ siocnprobe(cp)
printf("configuration file (currently sio only).\n");
siogdbiobase = siocniobase;
siogdbunit = siocnunit;
- gdbconsdev.cn_dev = makedev(CDEV_MAJOR, siocnunit);
+ siocnset(&gdbconsdev, siocnunit);
gdb_arg = &gdbconsdev;
gdb_getc = siocngetc;
gdb_putc = siocnputc;
@@ -3023,7 +3035,7 @@ static void
siocninit(cp)
struct consdev *cp;
{
- comconsole = DEV_TO_UNIT(cp->cn_dev);
+ comconsole = cp->cn_unit;
}
static void
@@ -3054,7 +3066,7 @@ siocnattach(port, speed)
siocnunit = unit;
comdefaultrate = speed;
sio_consdev.cn_pri = CN_NORMAL;
- sio_consdev.cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(&sio_consdev, unit);
s = spltty();
@@ -3098,7 +3110,7 @@ siogdbattach(port, speed)
printf("sio%d: gdb debugging port\n", unit);
siogdbunit = unit;
#if DDB > 0
- gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit);
+ sprintf(gdbconsdev, "ttyd%d", unit);
gdb_arg = &gdbconsdev;
gdb_getc = siocngetc;
gdb_putc = siocnputc;
@@ -3134,14 +3146,12 @@ static int
siocncheckc(struct consdev *cd)
{
int c;
- dev_t dev;
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
- dev = cd->cn_dev;
- if (minor(dev) == siocnunit) {
+ if (cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
@@ -3163,14 +3173,12 @@ static int
siocngetc(struct consdev *cd)
{
int c;
- dev_t dev;
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
- dev = cd->cn_dev;
- if (minor(dev) == siocnunit) {
+ if (cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
@@ -3192,13 +3200,11 @@ siocnputc(struct consdev *cd, int c)
{
int need_unlock;
int s;
- dev_t dev;
struct siocnstate sp;
Port_t iobase;
speed_t speed;
- dev = cd->cn_dev;
- if (minor(dev) == siocnunit) {
+ if (cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
OpenPOWER on IntegriCloud