On 4/16/19 6:03 AM, Greg KH wrote:
On Tue, Apr 02, 2019 at 08:20:19PM -0700, jay.dolan@xxxxxxxxxxx wrote:
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2577,6 +2577,38 @@ static unsigned char serial8250_compute_lcr(struct uart_8250_port *up,
return cval;
}
+void
+pericom_do_set_divisor(struct uart_port *port, unsigned int baud,
+ unsigned int quot, unsigned int quot_frac)
+{
+ int scr;
+ int lcr;
+ int actual_baud;
+ int tolerance;
+
+ for (scr = 5 ; scr <= 15 ; scr++) {
+ actual_baud = 921600 * 16 / scr;
+ tolerance = actual_baud / 50;
+
+ if ((baud < actual_baud + tolerance) &&
+ (baud > actual_baud - tolerance)) {
+
+ lcr = serial_port_in(port, UART_LCR);
+ serial_port_out(port, UART_LCR, lcr | 0x80);
+
+ serial_port_out(port, UART_DLL, 1);
+ serial_port_out(port, UART_DLM, 0);
+ serial_port_out(port, UART_PCM_SCR, 16 - scr);
+ serial_port_out(port, UART_LCR, lcr);
+ return;
+ } else if (baud > actual_baud) {
+ break;
+ }
+ }
+ serial8250_do_set_divisor(port, baud, quot, quot_frac);
+}
+EXPORT_SYMBOL_GPL(pericom_do_set_divisor);
Why can't this be in the other file where you call it? No need to
export something for one single module, right?
Mostly I was just following the pattern of serial8250_do_set_divisor().
I will remove the export.
thanks,
greg k-h
Thanks,
--Jay