Revert "serial:serial_core: Allow use of CTS for PPS line discipline"
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Oct 2018 16:57:23 +0000 (09:57 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Oct 2018 16:57:45 +0000 (09:57 -0700)
This reverts commit c550f01c810f2197c98e6e3103f81797f5e063be.

Turns out the samsung tty driver is mucking around in the "unused" port
fields and this patch breaks that code :(

So we need to fix that driver up before this can be accepted.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/ABI/testing/sysfs-tty
drivers/tty/serial/serial_core.c
include/linux/serial_core.h

index 441105a75d1f6b8cc955a15c345a2b8561d47c68..9eb3c2b6b0406eeec340f31a47f837ea4f542258 100644 (file)
@@ -154,12 +154,3 @@ Description:
                 device specification. For example, when user sets 7bytes on
                 16550A, which has 1/4/8/14 bytes trigger, the RX trigger is
                 automatically changed to 4 bytes.
-
-What:          /sys/class/tty/ttyS0/pps_4wire
-Date:          September 2018
-Contact:       Steve Sakoman <steve@sakoman.com>
-Description:
-                Shows/sets "4 wire" mode for the PPS input to the serial driver.
-                For fully implemented serial ports PPS is normally provided
-                on the DCD line. For partial "4 wire" implementations CTS is
-                used instead of DCD.
index 0a4e6eeb5ff3d98d101bd2f4b78f5c2c622d267f..70402cdb4d8ccc1c8b0491841f7fd4173e3e70d0 100644 (file)
@@ -2724,57 +2724,6 @@ static ssize_t uart_get_attr_iomem_reg_shift(struct device *dev,
        return snprintf(buf, PAGE_SIZE, "%d\n", tmp.iomem_reg_shift);
 }
 
-static ssize_t pps_4wire_show(struct device *dev,
-       struct device_attribute *attr, char *buf)
-{
-       struct tty_port *port = dev_get_drvdata(dev);
-       struct uart_state *state = container_of(port, struct uart_state, port);
-       struct uart_port *uport;
-       int mode = 0;
-
-       mutex_lock(&port->mutex);
-       uport = uart_port_check(state);
-       if (!uport)
-               goto out;
-
-       mode = uport->pps_4wire;
-
-out:
-       mutex_unlock(&port->mutex);
-       return sprintf(buf, mode ? "yes\n" : "no\n");
-}
-
-static ssize_t pps_4wire_store(struct device *dev,
-       struct device_attribute *attr, const char *buf, size_t count)
-{
-       struct tty_port *port = dev_get_drvdata(dev);
-       struct uart_state *state = container_of(port, struct uart_state, port);
-       struct uart_port *uport;
-       bool mode;
-       int ret;
-
-       if (!count)
-               return -EINVAL;
-
-       ret = kstrtobool(buf, &mode);
-       if (ret < 0)
-               return ret;
-
-       mutex_lock(&port->mutex);
-       uport = uart_port_check(state);
-       if (!uport)
-               goto out;
-
-       spin_lock_irq(&uport->lock);
-       uport->pps_4wire = mode;
-       spin_unlock_irq(&uport->lock);
-
-out:
-       mutex_unlock(&port->mutex);
-       return count;
-}
-static DEVICE_ATTR_RW(pps_4wire);
-
 static DEVICE_ATTR(type, S_IRUSR | S_IRGRP, uart_get_attr_type, NULL);
 static DEVICE_ATTR(line, S_IRUSR | S_IRGRP, uart_get_attr_line, NULL);
 static DEVICE_ATTR(port, S_IRUSR | S_IRGRP, uart_get_attr_port, NULL);
@@ -2803,7 +2752,6 @@ static struct attribute *tty_dev_attrs[] = {
        &dev_attr_io_type.attr,
        &dev_attr_iomem_base.attr,
        &dev_attr_iomem_reg_shift.attr,
-       &dev_attr_pps_4wire.attr,
        NULL,
        };
 
@@ -2860,9 +2808,6 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
                goto out;
        }
 
-       /* assert that pps handling is done via DCD as default */
-       uport->pps_4wire = 0;
-
        /*
         * If this port is a console, then the spinlock is already
         * initialised.
@@ -3038,7 +2983,7 @@ void uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
 
        lockdep_assert_held_once(&uport->lock);
 
-       if (tty && !uport->pps_4wire) {
+       if (tty) {
                ld = tty_ldisc_ref(tty);
                if (ld) {
                        if (ld->ops->dcd_change)
@@ -3067,21 +3012,8 @@ EXPORT_SYMBOL_GPL(uart_handle_dcd_change);
  */
 void uart_handle_cts_change(struct uart_port *uport, unsigned int status)
 {
-       struct tty_port *port = &uport->state->port;
-       struct tty_struct *tty = port->tty;
-       struct tty_ldisc *ld;
-
        lockdep_assert_held_once(&uport->lock);
 
-       if (tty && uport->pps_4wire) {
-               ld = tty_ldisc_ref(tty);
-               if (ld) {
-                       if (ld->ops->dcd_change)
-                               ld->ops->dcd_change(tty, status);
-                       tty_ldisc_deref(ld);
-               }
-       }
-
        uport->icount.cts++;
 
        if (uart_softcts_mode(uport)) {
index 4e2ba4894dcc389317fb4e17d6ee296f4d5ae470..047fa67d039bedfc505f1c4be4574beb2db58ca5 100644 (file)
@@ -257,8 +257,7 @@ struct uart_port {
        struct device           *dev;                   /* parent device */
        unsigned char           hub6;                   /* this should be in the 8250 driver */
        unsigned char           suspended;
-       unsigned char           pps_4wire;              /* CTS instead of DCD */
-       unsigned char           unused;
+       unsigned char           unused[2];
        const char              *name;                  /* port name */
        struct attribute_group  *attr_group;            /* port specific attributes */
        const struct attribute_group **tty_groups;      /* all attributes (serial core use only) */