[PATCH v1] RFC: WIP: serial: remove UPF_SDP_CUST & Co

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Not tested at all.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
 arch/mn10300/kernel/mn10300-serial.c | 51 ----------------------
 drivers/net/wan/z85230.h             |  2 -
 drivers/staging/fwserial/fwserial.c  |  3 +-
 drivers/tty/amiserial.c              | 46 +++++---------------
 drivers/tty/cyclades.c               | 59 ++++++-------------------
 drivers/tty/isicom.c                 | 25 -----------
 drivers/tty/moxa.c                   |  1 -
 drivers/tty/mxser.c                  | 38 +++++------------
 drivers/tty/serial/8250/8250_omap.c  | 16 -------
 drivers/tty/serial/crisv10.c         | 61 +++++---------------------
 drivers/tty/serial/crisv10.h         |  1 -
 drivers/tty/serial/samsung.c         |  2 -
 drivers/tty/serial/serial_core.c     | 83 +++++++-----------------------------
 drivers/usb/serial/ftdi_sio.c        | 29 +------------
 drivers/usb/serial/whiteheat.c       |  1 -
 include/linux/cyclades.h             |  1 -
 include/linux/serial_core.h          |  9 +---
 17 files changed, 63 insertions(+), 365 deletions(-)

diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c
index 4994b570dfd9..dffa2df397b8 100644
--- a/arch/mn10300/kernel/mn10300-serial.c
+++ b/arch/mn10300/kernel/mn10300-serial.c
@@ -1172,57 +1172,6 @@ static void mn10300_serial_change_speed(struct mn10300_serial_port *port,
 		xdiv = 2;
 	}
 
-	if (baud == 38400 &&
-	    (port->uart.flags & UPF_SPD_MASK) == UPF_SPD_CUST
-	    ) {
-		_debug("CUSTOM %u", port->uart.custom_divisor);
-
-		if (div_timer == MNSCx_DIV_TIMER_16BIT) {
-			if (port->uart.custom_divisor <= 65535) {
-				tmxmd = TM8MD_SRC_IOCLK;
-				tmxbr = port->uart.custom_divisor;
-				port->uart.uartclk = ioclk;
-				goto timer_okay;
-			}
-			if (port->uart.custom_divisor / 8 <= 65535) {
-				tmxmd = TM8MD_SRC_IOCLK_8;
-				tmxbr = port->uart.custom_divisor / 8;
-				port->uart.custom_divisor = tmxbr * 8;
-				port->uart.uartclk = ioclk / 8;
-				goto timer_okay;
-			}
-			if (port->uart.custom_divisor / 32 <= 65535) {
-				tmxmd = TM8MD_SRC_IOCLK_32;
-				tmxbr = port->uart.custom_divisor / 32;
-				port->uart.custom_divisor = tmxbr * 32;
-				port->uart.uartclk = ioclk / 32;
-				goto timer_okay;
-			}
-
-		} else if (div_timer == MNSCx_DIV_TIMER_8BIT) {
-			if (port->uart.custom_divisor <= 255) {
-				tmxmd = TM2MD_SRC_IOCLK;
-				tmxbr = port->uart.custom_divisor;
-				port->uart.uartclk = ioclk;
-				goto timer_okay;
-			}
-			if (port->uart.custom_divisor / 8 <= 255) {
-				tmxmd = TM2MD_SRC_IOCLK_8;
-				tmxbr = port->uart.custom_divisor / 8;
-				port->uart.custom_divisor = tmxbr * 8;
-				port->uart.uartclk = ioclk / 8;
-				goto timer_okay;
-			}
-			if (port->uart.custom_divisor / 32 <= 255) {
-				tmxmd = TM2MD_SRC_IOCLK_32;
-				tmxbr = port->uart.custom_divisor / 32;
-				port->uart.custom_divisor = tmxbr * 32;
-				port->uart.uartclk = ioclk / 32;
-				goto timer_okay;
-			}
-		}
-	}
-
 	switch (div_timer) {
 	case MNSCx_DIV_TIMER_16BIT:
 		port->uart.uartclk = ioclk;
diff --git a/drivers/net/wan/z85230.h b/drivers/net/wan/z85230.h
index 32ae710d4f40..ff4f0206c781 100644
--- a/drivers/net/wan/z85230.h
+++ b/drivers/net/wan/z85230.h
@@ -360,8 +360,6 @@ struct z8530_channel
 
 	int			magic;
 	int			baud_base;		/* Baud parameters */
-	int			custom_divisor;
-
 
 	unsigned char		tx_active; /* character is being xmitted */
 	unsigned char		tx_stopped; /* output is suspended */
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
index 1993b03a6f2d..f56ea4513550 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -1234,8 +1234,7 @@ static int set_serial_info(struct fwtty_port *port,
 	if (copy_from_user(&tmp, info, sizeof(tmp)))
 		return -EFAULT;
 
-	if (tmp.irq != 0 || tmp.port != 0 || tmp.custom_divisor != 0 ||
-	    tmp.baud_base != 400000000)
+	if (tmp.irq != 0 || tmp.port != 0 || tmp.baud_base != 400000000)
 		return -EPERM;
 
 	if (!capable(CAP_SYS_ADMIN)) {
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 32d7ce430b02..e9af5f12abc0 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -99,7 +99,6 @@ struct serial_state {
 	unsigned long		port;
 	int			baud_base;
 	int			xmit_fifo_size;
-	int			custom_divisor;
 	int			read_status_mask;
 	int			ignore_status_mask;
 	int			timeout;
@@ -677,15 +676,11 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
 	if (!baud)
 		baud = 9600;	/* B0 transition handled in rs_set_termios */
 	baud_base = info->baud_base;
-	if (baud == 38400 && (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
-		quot = info->custom_divisor;
-	else {
-		if (baud == 134)
-			/* Special case since 134 is really 134.5 */
-			quot = (2*baud_base / 269);
-		else if (baud)
-			quot = baud_base / baud;
-	}
+	if (baud == 134)
+		/* Special case since 134 is really 134.5 */
+		quot = (2*baud_base / 269);
+	else if (baud)
+		quot = baud_base / baud;
 	/* If the quotient is zero refuse the change */
 	if (!quot && old_termios) {
 		/* FIXME: Will need updating for new tty in the end */
@@ -694,16 +689,11 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info,
 		baud = tty_get_baud_rate(tty);
 		if (!baud)
 			baud = 9600;
-		if (baud == 38400 &&
-		    (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
-			quot = info->custom_divisor;
-		else {
-			if (baud == 134)
-				/* Special case since 134 is really 134.5 */
-				quot = (2*baud_base / 269);
-			else if (baud)
-				quot = baud_base / baud;
-		}
+		if (baud == 134)
+			/* Special case since 134 is really 134.5 */
+			quot = (2*baud_base / 269);
+		else if (baud)
+			quot = baud_base / baud;
 	}
 	/* As a last resort, if the quotient is zero, default to 9600 bps */
 	if (!quot)
@@ -1010,7 +1000,6 @@ static int get_serial_info(struct tty_struct *tty, struct serial_state *state,
 	tmp.baud_base = state->baud_base;
 	tmp.close_delay = state->tport.close_delay;
 	tmp.closing_wait = state->tport.closing_wait;
-	tmp.custom_divisor = state->custom_divisor;
 	tty_unlock(tty);
 	if (copy_to_user(retinfo,&tmp,sizeof(*retinfo)))
 		return -EFAULT;
@@ -1022,15 +1011,12 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
 {
 	struct tty_port *port = &state->tport;
 	struct serial_struct new_serial;
-	bool change_spd;
 	int 			retval = 0;
 
 	if (copy_from_user(&new_serial,new_info,sizeof(new_serial)))
 		return -EFAULT;
 
 	tty_lock(tty);
-	change_spd = ((new_serial.flags ^ port->flags) & ASYNC_SPD_MASK) ||
-		new_serial.custom_divisor != state->custom_divisor;
 	if (new_serial.irq || new_serial.port != state->port ||
 			new_serial.xmit_fifo_size != state->xmit_fifo_size) {
 		tty_unlock(tty);
@@ -1048,7 +1034,6 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
 		}
 		port->flags = ((port->flags & ~ASYNC_USR_MASK) |
 			       (new_serial.flags & ASYNC_USR_MASK));
-		state->custom_divisor = new_serial.custom_divisor;
 		goto check_and_exit;
 	}
 
@@ -1065,20 +1050,12 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
 	state->baud_base = new_serial.baud_base;
 	port->flags = ((port->flags & ~ASYNC_FLAGS) |
 			(new_serial.flags & ASYNC_FLAGS));
-	state->custom_divisor = new_serial.custom_divisor;
 	port->close_delay = new_serial.close_delay * HZ/100;
 	port->closing_wait = new_serial.closing_wait * HZ/100;
 	port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
 check_and_exit:
-	if (tty_port_initialized(port)) {
-		if (change_spd) {
-			/* warn about deprecation unless clearing */
-			if (new_serial.flags & ASYNC_SPD_MASK)
-				dev_warn_ratelimited(tty->dev, "use of SPD flags is deprecated\n");
-			change_speed(tty, state, NULL);
-		}
-	} else
+	if (!tty_port_initialized(port))
 		retval = startup(tty, state);
 	tty_unlock(tty);
 	return retval;
@@ -1680,7 +1657,6 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
 
 	state = rs_table;
 	state->port = (int)&custom.serdatr; /* Just to give it a value */
-	state->custom_divisor = 0;
 	state->icount.cts = state->icount.dsr = 
 	  state->icount.rng = state->icount.dcd = 0;
 	state->icount.rx = state->icount.tx = 0;
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index cf0bde3bb927..5bae4954f15b 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -1981,15 +1981,8 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
 
 		/* baud rate */
 		baud = tty_get_baud_rate(tty);
-		if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
-				ASYNC_SPD_CUST) {
-			if (info->custom_divisor)
-				baud_rate = info->baud / info->custom_divisor;
-			else
-				baud_rate = info->baud;
-		} else if (baud > CD1400_MAX_SPEED) {
+		if (baud > CD1400_MAX_SPEED)
 			baud = CD1400_MAX_SPEED;
-		}
 		/* find the baud index */
 		for (i = 0; i < 20; i++) {
 			if (baud == baud_table[i])
@@ -1998,31 +1991,22 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
 		if (i == 20)
 			i = 19;	/* CD1400_MAX_SPEED */
 
-		if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
-				ASYNC_SPD_CUST) {
-			cyy_baud_calc(info, baud_rate);
+		if (info->chip_rev >= CD1400_REV_J) {
+			/* It is a CD1400 rev. J or later */
+			info->tbpr = baud_bpr_60[i];	/* Tx BPR */
+			info->tco = baud_co_60[i];	/* Tx CO */
+			info->rbpr = baud_bpr_60[i];	/* Rx BPR */
+			info->rco = baud_co_60[i];	/* Rx CO */
 		} else {
-			if (info->chip_rev >= CD1400_REV_J) {
-				/* It is a CD1400 rev. J or later */
-				info->tbpr = baud_bpr_60[i];	/* Tx BPR */
-				info->tco = baud_co_60[i];	/* Tx CO */
-				info->rbpr = baud_bpr_60[i];	/* Rx BPR */
-				info->rco = baud_co_60[i];	/* Rx CO */
-			} else {
-				info->tbpr = baud_bpr_25[i];	/* Tx BPR */
-				info->tco = baud_co_25[i];	/* Tx CO */
-				info->rbpr = baud_bpr_25[i];	/* Rx BPR */
-				info->rco = baud_co_25[i];	/* Rx CO */
-			}
+			info->tbpr = baud_bpr_25[i];	/* Tx BPR */
+			info->tco = baud_co_25[i];	/* Tx CO */
+			info->rbpr = baud_bpr_25[i];	/* Rx BPR */
+			info->rco = baud_co_25[i];	/* Rx CO */
 		}
 		if (baud_table[i] == 134) {
 			/* get it right for 134.5 baud */
 			info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) +
 					2;
-		} else if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
-				ASYNC_SPD_CUST) {
-			info->timeout = (info->xmit_fifo_size * HZ * 15 /
-					baud_rate) + 2;
 		} else if (baud_table[i]) {
 			info->timeout = (info->xmit_fifo_size * HZ * 15 /
 					baud_table[i]) + 2;
@@ -2146,25 +2130,14 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
 
 		/* baud rate */
 		baud = tty_get_baud_rate(tty);
-		if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
-				ASYNC_SPD_CUST) {
-			if (info->custom_divisor)
-				baud_rate = info->baud / info->custom_divisor;
-			else
-				baud_rate = info->baud;
-		} else if (baud > CYZ_MAX_SPEED) {
+		if (baud > CYZ_MAX_SPEED)
 			baud = CYZ_MAX_SPEED;
-		}
 		cy_writel(&ch_ctrl->comm_baud, baud);
 
 		if (baud == 134) {
 			/* get it right for 134.5 baud */
 			info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) +
 					2;
-		} else if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
-				ASYNC_SPD_CUST) {
-			info->timeout = (info->xmit_fifo_size * HZ * 15 /
-					baud_rate) + 2;
 		} else if (baud) {
 			info->timeout = (info->xmit_fifo_size * HZ * 15 /
 					baud) + 2;
@@ -2271,7 +2244,6 @@ static int cy_get_serial_info(struct cyclades_port *info,
 		.close_delay = info->port.close_delay,
 		.closing_wait = info->port.closing_wait,
 		.baud_base = info->baud,
-		.custom_divisor = info->custom_divisor,
 	};
 	return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0;
 }
@@ -2304,7 +2276,6 @@ cy_set_serial_info(struct cyclades_port *info, struct tty_struct *tty,
 		info->port.flags = (info->port.flags & ~ASYNC_USR_MASK) |
 				(new_serial.flags & ASYNC_USR_MASK);
 		info->baud = new_serial.baud_base;
-		info->custom_divisor = new_serial.custom_divisor;
 		goto check_and_exit;
 	}
 
@@ -2314,7 +2285,6 @@ cy_set_serial_info(struct cyclades_port *info, struct tty_struct *tty,
 	 */
 
 	info->baud = new_serial.baud_base;
-	info->custom_divisor = new_serial.custom_divisor;
 	info->port.flags = (info->port.flags & ~ASYNC_FLAGS) |
 			(new_serial.flags & ASYNC_FLAGS);
 	info->port.close_delay = new_serial.close_delay * HZ / 100;
@@ -2322,11 +2292,6 @@ cy_set_serial_info(struct cyclades_port *info, struct tty_struct *tty,
 
 check_and_exit:
 	if (tty_port_initialized(&info->port)) {
-		if ((new_serial.flags ^ old_flags) & ASYNC_SPD_MASK) {
-			/* warn about deprecation unless clearing */
-			if (new_serial.flags & ASYNC_SPD_MASK)
-				dev_warn_ratelimited(tty->dev, "use of SPD flags is deprecated\n");
-		}
 		cy_set_line_char(info, tty);
 		ret = 0;
 	} else {
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
index bdd3027ef01b..723e7329571f 100644
--- a/drivers/tty/isicom.c
+++ b/drivers/tty/isicom.c
@@ -698,22 +698,6 @@ static void isicom_config_port(struct tty_struct *tty)
 		else
 			baud += 15;
 	}
-	if (baud == 15) {
-
-		/*  the ASYNC_SPD_HI and ASYNC_SPD_VHI options are set
-		 *  by the set_serial_info ioctl ... this is done by
-		 *  the 'setserial' utility.
-		 */
-
-		if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
-			baud++; /*  57.6 Kbps */
-		if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
-			baud += 2; /*  115  Kbps */
-		if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
-			baud += 3; /* 230 kbps*/
-		if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
-			baud += 4; /* 460 kbps*/
-	}
 	if (linuxb_to_isib[baud] == -1) {
 		/* hang up */
 		drop_dtr(port);
@@ -1095,14 +1079,11 @@ static int isicom_set_serial_info(struct tty_struct *tty,
 {
 	struct isi_port *port = tty->driver_data;
 	struct serial_struct newinfo;
-	int reconfig_port;
 
 	if (copy_from_user(&newinfo, info, sizeof(newinfo)))
 		return -EFAULT;
 
 	mutex_lock(&port->port.mutex);
-	reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) !=
-		(newinfo.flags & ASYNC_SPD_MASK));
 
 	if (!capable(CAP_SYS_ADMIN)) {
 		if ((newinfo.close_delay != port->port.close_delay) ||
@@ -1120,12 +1101,6 @@ static int isicom_set_serial_info(struct tty_struct *tty,
 		port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
 				(newinfo.flags & ASYNC_FLAGS));
 	}
-	if (reconfig_port) {
-		unsigned long flags;
-		spin_lock_irqsave(&port->card->card_lock, flags);
-		isicom_config_port(tty);
-		spin_unlock_irqrestore(&port->card->card_lock, flags);
-	}
 	mutex_unlock(&port->port.mutex);
 	return 0;
 }
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 250a19f042d7..ca6cbaec0b54 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -2057,7 +2057,6 @@ static int moxa_set_serial_info(struct moxa_port *info,
 		return -EFAULT;
 
 	if (new_serial.irq != 0 || new_serial.port != 0 ||
-			new_serial.custom_divisor != 0 ||
 			new_serial.baud_base != 921600)
 		return -EPERM;
 
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 8bc15cb67a58..c2cbebf06a8b 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -238,7 +238,6 @@ struct mxser_port {
 	unsigned char stop_rx;
 	unsigned char ldisc_stop_rx;
 
-	int custom_divisor;
 	unsigned char err_shadow;
 
 	struct async_icount icount; /* kernel counters for 4 input interrupts */
@@ -1219,7 +1218,6 @@ static int mxser_get_serial_info(struct tty_struct *tty,
 		.baud_base = info->baud_base,
 		.close_delay = info->port.close_delay,
 		.closing_wait = info->port.closing_wait,
-		.custom_divisor = info->custom_divisor,
 	};
 	if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
 		return -EFAULT;
@@ -1234,8 +1232,7 @@ static int mxser_set_serial_info(struct tty_struct *tty,
 	struct serial_struct new_serial;
 	speed_t baud;
 	unsigned long sl_flags;
-	unsigned int flags;
-	int retval = 0;
+	int retval;
 
 	if (!new_info || !info->ioaddr)
 		return -ENODEV;
@@ -1246,8 +1243,6 @@ static int mxser_set_serial_info(struct tty_struct *tty,
 			new_serial.port != info->ioaddr)
 		return -EINVAL;
 
-	flags = port->flags & ASYNC_SPD_MASK;
-
 	if (!capable(CAP_SYS_ADMIN)) {
 		if ((new_serial.baud_base != info->baud_base) ||
 				(new_serial.close_delay != info->port.close_delay) ||
@@ -1265,33 +1260,21 @@ static int mxser_set_serial_info(struct tty_struct *tty,
 		port->close_delay = new_serial.close_delay * HZ / 100;
 		port->closing_wait = new_serial.closing_wait * HZ / 100;
 		port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
-		if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST &&
-				(new_serial.baud_base != info->baud_base ||
-				new_serial.custom_divisor !=
-				info->custom_divisor)) {
-			if (new_serial.custom_divisor == 0)
-				return -EINVAL;
-			baud = new_serial.baud_base / new_serial.custom_divisor;
-			tty_encode_baud_rate(tty, baud, baud);
-		}
 	}
 
 	info->type = new_serial.type;
 
 	process_txrx_fifo(info);
 
-	if (tty_port_initialized(port)) {
-		if (flags != (port->flags & ASYNC_SPD_MASK)) {
-			spin_lock_irqsave(&info->slock, sl_flags);
-			mxser_change_speed(tty);
-			spin_unlock_irqrestore(&info->slock, sl_flags);
-		}
-	} else {
-		retval = mxser_activate(port, tty);
-		if (retval == 0)
-			tty_port_set_initialized(port, 1);
-	}
-	return retval;
+	if (tty_port_initialized(port))
+		return 0;
+
+	retval = mxser_activate(port, tty);
+	if (retval < 0)
+		return retval;
+
+	tty_port_set_initialized(port, 1);
+	return 0;
 }
 
 /*
@@ -2395,7 +2378,6 @@ static int mxser_initbrd(struct mxser_board *brd)
 
 		process_txrx_fifo(info);
 
-		info->custom_divisor = info->baud_base * 16;
 		info->port.close_delay = 5 * HZ / 10;
 		info->port.closing_wait = 30 * HZ;
 		info->normal_termios = mxvar_sdriver->init_termios;
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 4d4bd7610103..fc9d7b585d11 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -196,22 +196,6 @@ static void omap_8250_get_divisor(struct uart_port *port, unsigned int baud,
 	unsigned int div_13, div_16;
 	unsigned int abs_d13, abs_d16;
 
-	/*
-	 * Old custom speed handling.
-	 */
-	if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) {
-		priv->quot = port->custom_divisor & UART_DIV_MAX;
-		/*
-		 * I assume that nobody is using this. But hey, if somebody
-		 * would like to specify the divisor _and_ the mode then the
-		 * driver is ready and waiting for it.
-		 */
-		if (port->custom_divisor & (1 << 16))
-			priv->mdr1 = UART_OMAP_MDR1_13X_MODE;
-		else
-			priv->mdr1 = UART_OMAP_MDR1_16X_MODE;
-		return;
-	}
 	div_13 = DIV_ROUND_CLOSEST(uartclk, 13 * baud);
 	div_16 = DIV_ROUND_CLOSEST(uartclk, 16 * baud);
 
diff --git a/drivers/tty/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index c9458a033e3c..51936861ebd9 100644
--- a/drivers/tty/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
@@ -2801,53 +2801,17 @@ change_speed(struct e100_serial *info)
 	/* possibly, the tx/rx should be disabled first to do this safely */
 
 	/* change baud-rate and write it to the hardware */
-	if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) {
-		/* Special baudrate */
-		u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */
-		unsigned long alt_source =
-				IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, normal) |
-				IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, normal);
-		/* R_ALT_SER_BAUDRATE selects the source */
-		DBAUD(printk("Custom baudrate: baud_base/divisor %lu/%i\n",
-		       (unsigned long)info->baud_base, info->custom_divisor));
-		if (info->baud_base == SERIAL_PRESCALE_BASE) {
-			/* 0, 2-65535 (0=65536) */
-			u16 divisor = info->custom_divisor;
-			/* R_SERIAL_PRESCALE (upper 16 bits of R_CLOCK_PRESCALE) */
-			/* baudrate is 3.125MHz/custom_divisor */
-			alt_source =
-				IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, prescale) |
-				IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, prescale);
-			alt_source = 0x11;
-			DBAUD(printk("Writing SERIAL_PRESCALE: divisor %i\n", divisor));
-			*R_SERIAL_PRESCALE = divisor;
-			info->baud = SERIAL_PRESCALE_BASE/divisor;
-		}
-		else
-		{
-			/* Bad baudbase, we don't support using timer0
-			 * for baudrate.
-			 */
-			printk(KERN_WARNING "Bad baud_base/custom_divisor: %lu/%i\n",
-			       (unsigned long)info->baud_base, info->custom_divisor);
-		}
-		r_alt_ser_baudrate_shadow &= ~mask;
-		r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8));
-		*R_ALT_SER_BAUDRATE = r_alt_ser_baudrate_shadow;
-	} else {
-		/* Normal baudrate */
-		/* Make sure we use normal baudrate */
-		u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */
-		unsigned long alt_source =
-			IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, normal) |
-			IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, normal);
-		r_alt_ser_baudrate_shadow &= ~mask;
-		r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8));
-		*R_ALT_SER_BAUDRATE = r_alt_ser_baudrate_shadow;
-
-		info->baud = cflag_to_baud(cflag);
-		info->ioport[REG_BAUD] = cflag_to_etrax_baud(cflag);
-	}
+	/* Make sure we use normal baudrate */
+	u32 mask = 0xFF << (info->line*8); /* Each port has 8 bits */
+	unsigned long alt_source =
+		IO_STATE(R_ALT_SER_BAUDRATE, ser0_rec, normal) |
+		IO_STATE(R_ALT_SER_BAUDRATE, ser0_tr, normal);
+	r_alt_ser_baudrate_shadow &= ~mask;
+	r_alt_ser_baudrate_shadow |= (alt_source << (info->line*8));
+	*R_ALT_SER_BAUDRATE = r_alt_ser_baudrate_shadow;
+
+	info->baud = cflag_to_baud(cflag);
+	info->ioport[REG_BAUD] = cflag_to_etrax_baud(cflag);
 
 	/* start with default settings and then fill in changes */
 	local_irq_save(flags);
@@ -3223,7 +3187,6 @@ get_serial_info(struct e100_serial * info,
 	tmp.baud_base = info->baud_base;
 	tmp.close_delay = info->port.close_delay;
 	tmp.closing_wait = info->port.closing_wait;
-	tmp.custom_divisor = info->custom_divisor;
 	if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
 		return -EFAULT;
 	return 0;
@@ -3264,7 +3227,6 @@ set_serial_info(struct e100_serial *info,
 	info->baud_base = new_serial.baud_base;
 	info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) |
 		       (new_serial.flags & ASYNC_FLAGS));
-	info->custom_divisor = new_serial.custom_divisor;
 	info->type = new_serial.type;
 	info->port.close_delay = new_serial.close_delay;
 	info->port.closing_wait = new_serial.closing_wait;
@@ -4192,7 +4154,6 @@ static int __init rs_init(void)
 		info->tr_running = 0;
 		info->forced_eop = 0;
 		info->baud_base = DEF_BAUD_BASE;
-		info->custom_divisor = 0;
 		info->x_char = 0;
 		info->event = 0;
 		info->xmit.buf = NULL;
diff --git a/drivers/tty/serial/crisv10.h b/drivers/tty/serial/crisv10.h
index 79ba2bc95d3d..9795500e7765 100644
--- a/drivers/tty/serial/crisv10.h
+++ b/drivers/tty/serial/crisv10.h
@@ -80,7 +80,6 @@ struct e100_serial {
 	u8		uses_dma_out; /* Set to 1 if DMA is used */
 	u8		forced_eop;   /* a fifo eop has been forced */
 	int			baud_base;     /* For special baudrates */
-	int			custom_divisor; /* For special baudrates */
 	struct etrax_dma_descr	tr_descr;
 	struct etrax_dma_descr	rec_descr[SERIAL_RECV_DESCRIPTORS];
 	int			cur_rec_descr;
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index f9fecc5ed0ce..d8c7afe366d1 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1267,8 +1267,6 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 
 	baud = uart_get_baud_rate(port, termios, old, 0, 115200*8);
 	quot = s3c24xx_serial_getclk(ourport, baud, &clk, &clk_sel);
-	if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
-		quot = port->custom_divisor;
 	if (IS_ERR(clk))
 		return;
 
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index ae6c078290c6..beff24999980 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -352,8 +352,7 @@ EXPORT_SYMBOL(uart_update_timeout);
  *	@max: maximum acceptable baud rate
  *
  *	Decode the termios structure into a numeric baud rate,
- *	taking account of the magic 38400 baud rate (with spd_*
- *	flags), and mapping the %B0 rate to 9600 baud.
+ *	and mapping the %B0 rate to 9600 baud.
  *
  *	If the new baud rate is invalid, try the old termios setting.
  *	If it's still invalid, we try 9600 baud.
@@ -368,38 +367,11 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
 {
 	unsigned int try;
 	unsigned int baud;
-	unsigned int altbaud;
 	int hung_up = 0;
-	upf_t flags = port->flags & UPF_SPD_MASK;
-
-	switch (flags) {
-	case UPF_SPD_HI:
-		altbaud = 57600;
-		break;
-	case UPF_SPD_VHI:
-		altbaud = 115200;
-		break;
-	case UPF_SPD_SHI:
-		altbaud = 230400;
-		break;
-	case UPF_SPD_WARP:
-		altbaud = 460800;
-		break;
-	default:
-		altbaud = 38400;
-		break;
-	}
 
 	for (try = 0; try < 2; try++) {
 		baud = tty_termios_baud_rate(termios);
 
-		/*
-		 * The spd_hi, spd_vhi, spd_shi, spd_warp kludge...
-		 * Die! Die! Die!
-		 */
-		if (try == 0 && baud == 38400)
-			baud = altbaud;
-
 		/*
 		 * Special case: B0 rate.
 		 */
@@ -455,17 +427,7 @@ EXPORT_SYMBOL(uart_get_baud_rate);
 unsigned int
 uart_get_divisor(struct uart_port *port, unsigned int baud)
 {
-	unsigned int quot;
-
-	/*
-	 * Old custom speed handling.
-	 */
-	if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
-		quot = port->custom_divisor;
-	else
-		quot = DIV_ROUND_CLOSEST(port->uartclk, 16 * baud);
-
-	return quot;
+	return DIV_ROUND_CLOSEST(port->uartclk, 16 * baud);
 }
 
 EXPORT_SYMBOL(uart_get_divisor);
@@ -852,7 +814,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
 		    (new_info->xmit_fifo_size &&
 		     new_info->xmit_fifo_size != uport->fifosize) ||
 		    (((new_flags ^ old_flags) & ~UPF_USR_MASK) != 0))
-			goto exit;
+			return retval;
 		uport->flags = ((uport->flags & ~UPF_USR_MASK) |
 			       (new_flags & UPF_USR_MASK));
 		uport->custom_divisor = new_info->custom_divisor;
@@ -870,7 +832,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
 		retval = -EINVAL;
 
 	if (retval)
-		goto exit;
+		return retval;
 
 	if (change_port || change_irq) {
 		retval = -EBUSY;
@@ -879,7 +841,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
 		 * Make sure that we are the sole user of this port.
 		 */
 		if (tty_port_users(port) > 1)
-			goto exit;
+			return retval;
 
 		/*
 		 * We need to shutdown the serial port at the old
@@ -950,7 +912,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
 			}
 
 			/* Added to return the correct error -Ram Gupta */
-			goto exit;
+			return retval;
 		}
 	}
 
@@ -968,31 +930,16 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
 	port->low_latency = (uport->flags & UPF_LOW_LATENCY) ? 1 : 0;
 
  check_and_exit:
-	retval = 0;
 	if (uport->type == PORT_UNKNOWN)
-		goto exit;
-	if (tty_port_initialized(port)) {
-		if (((old_flags ^ uport->flags) & UPF_SPD_MASK) ||
-		    old_custom_divisor != uport->custom_divisor) {
-			/*
-			 * If they're setting up a custom divisor or speed,
-			 * instead of clearing it, then bitch about it.
-			 */
-			if (uport->flags & UPF_SPD_MASK) {
-				dev_notice_ratelimited(uport->dev,
-				       "%s sets custom speed on %s. This is deprecated.\n",
-				      current->comm,
-				      tty_name(port->tty));
-			}
-			uart_change_speed(tty, state, NULL);
-		}
-	} else {
-		retval = uart_startup(tty, state, 1);
-		if (retval > 0)
-			retval = 0;
-	}
- exit:
-	return retval;
+		return 0;
+	if (tty_port_initialized(port))
+		return 0;
+
+	retval = uart_startup(tty, state, 1);
+	if (retval < 0)
+		return retval;
+
+	return 0;
 }
 
 static int uart_set_info_user(struct tty_struct *tty, struct uart_state *state,
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index fc68952c994a..69e9d303ac6b 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1246,17 +1246,8 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
 	baud = tty_get_baud_rate(tty);
 	dev_dbg(dev, "%s - tty_get_baud_rate reports speed %d\n", __func__, baud);
 
-	/*
-	 * Observe deprecated async-compatible custom_divisor hack, update
-	 * baudrate if needed.
-	 */
-	if (baud == 38400 &&
-	    ((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) &&
-	     (priv->custom_divisor)) {
+	if (baud == 38400 && priv->custom_divisor)
 		baud = priv->baud_base / priv->custom_divisor;
-		dev_dbg(dev, "%s - custom divisor %d sets baud rate to %d\n",
-			__func__, priv->custom_divisor, baud);
-	}
 
 	if (!baud)
 		baud = 9600;
@@ -1479,7 +1470,6 @@ static int set_serial_info(struct tty_struct *tty,
 		}
 		priv->flags = ((priv->flags & ~ASYNC_USR_MASK) |
 			       (new_serial.flags & ASYNC_USR_MASK));
-		priv->custom_divisor = new_serial.custom_divisor;
 		goto check_and_exit;
 	}
 
@@ -1492,24 +1482,11 @@ static int set_serial_info(struct tty_struct *tty,
 
 	priv->flags = ((priv->flags & ~ASYNC_FLAGS) |
 					(new_serial.flags & ASYNC_FLAGS));
-	priv->custom_divisor = new_serial.custom_divisor;
 
 check_and_exit:
 	write_latency_timer(port);
 
-	if ((priv->flags ^ old_priv.flags) & ASYNC_SPD_MASK ||
-			((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST &&
-			 priv->custom_divisor != old_priv.custom_divisor)) {
-
-		/* warn about deprecation unless clearing */
-		if (priv->flags & ASYNC_SPD_MASK)
-			dev_warn_ratelimited(&port->dev, "use of SPD flags is deprecated\n");
-
-		change_speed(tty, port);
-		mutex_unlock(&priv->cfg_lock);
-	}
-	else
-		mutex_unlock(&priv->cfg_lock);
+	mutex_unlock(&priv->cfg_lock);
 	return 0;
 }
 
@@ -1820,7 +1797,6 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
 /* Called from usbserial:serial_probe */
 static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
 {
-	priv->flags |= ASYNC_SPD_CUST;
 	priv->custom_divisor = 77;
 	priv->force_baud = 38400;
 }
@@ -1830,7 +1806,6 @@ static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
 
 static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv)
 {
-	priv->flags |= ASYNC_SPD_CUST;
 	priv->custom_divisor = 240;
 	priv->force_baud = 38400;
 	priv->force_rtscts = 1;
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 1c7b46a8620c..2e26d099a0d3 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -456,7 +456,6 @@ static int whiteheat_ioctl(struct tty_struct *tty,
 		serstruct.line = port->minor;
 		serstruct.port = port->port_number;
 		serstruct.xmit_fifo_size = kfifo_size(&port->write_fifo);
-		serstruct.custom_divisor = 0;
 		serstruct.baud_base = 460800;
 		serstruct.close_delay = CLOSING_DELAY;
 		serstruct.closing_wait = CLOSING_DELAY;
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 05ee0f19448a..73dafe2236ea 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -142,7 +142,6 @@ struct cyclades_port {
 	int			rflow;
 	int			rtsdtr_inv;
 	int			chip_rev;
-	int			custom_divisor;
 	u8			x_char; /* to be pushed out ASAP */
 	int                     breakon;
 	int                     breakoff;
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 4c310c34ddad..1a4ca1a62cf0 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -183,15 +183,9 @@ struct uart_port {
 	 */
 #define UPF_FOURPORT		((__force upf_t) ASYNC_FOURPORT       /* 1  */ )
 #define UPF_SAK			((__force upf_t) ASYNC_SAK            /* 2  */ )
-#define UPF_SPD_HI		((__force upf_t) ASYNC_SPD_HI         /* 4  */ )
-#define UPF_SPD_VHI		((__force upf_t) ASYNC_SPD_VHI        /* 5  */ )
-#define UPF_SPD_CUST		((__force upf_t) ASYNC_SPD_CUST   /* 0x0030 */ )
-#define UPF_SPD_WARP		((__force upf_t) ASYNC_SPD_WARP   /* 0x1010 */ )
-#define UPF_SPD_MASK		((__force upf_t) ASYNC_SPD_MASK   /* 0x1030 */ )
 #define UPF_SKIP_TEST		((__force upf_t) ASYNC_SKIP_TEST      /* 6  */ )
 #define UPF_AUTO_IRQ		((__force upf_t) ASYNC_AUTO_IRQ       /* 7  */ )
 #define UPF_HARDPPS_CD		((__force upf_t) ASYNC_HARDPPS_CD     /* 11 */ )
-#define UPF_SPD_SHI		((__force upf_t) ASYNC_SPD_SHI        /* 12 */ )
 #define UPF_LOW_LATENCY		((__force upf_t) ASYNC_LOW_LATENCY    /* 13 */ )
 #define UPF_BUGGY_UART		((__force upf_t) ASYNC_BUGGY_UART     /* 14 */ )
 #define UPF_MAGIC_MULTIPLIER	((__force upf_t) ASYNC_MAGIC_MULTIPLIER /* 16 */ )
@@ -216,7 +210,7 @@ struct uart_port {
 
 #define __UPF_CHANGE_MASK	0x17fff
 #define UPF_CHANGE_MASK		((__force upf_t) __UPF_CHANGE_MASK)
-#define UPF_USR_MASK		((__force upf_t) (UPF_SPD_MASK|UPF_LOW_LATENCY))
+#define UPF_USR_MASK		((__force upf_t) UPF_LOW_LATENCY)
 
 #if __UPF_CHANGE_MASK > ASYNC_FLAGS
 #error Change mask not equivalent to userspace-visible bit defines
@@ -239,7 +233,6 @@ struct uart_port {
 	unsigned int		timeout;		/* character-based timeout */
 	unsigned int		type;			/* port type */
 	const struct uart_ops	*ops;
-	unsigned int		custom_divisor;
 	unsigned int		line;			/* port index */
 	unsigned int		minor;
 	resource_size_t		mapbase;		/* for ioremap */
-- 
2.15.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux