tty/serial: clean up uart_match_port
authorJiri Slaby <jslaby@suse.cz>
Wed, 19 May 2021 07:21:50 +0000 (09:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 May 2021 14:59:14 +0000 (16:59 +0200)
* make parameters const (as they are only read)
* return bool (as comparison results are returned)
* add \n before final return

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210519072153.3859-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_core.c
include/linux/serial_core.h

index 2793b1cf2d24fcbc77f212996c97672f2e292fcc..b5beb215f0627f3dd8f99a08799c442d36053888 100644 (file)
@@ -3027,26 +3027,28 @@ out:
 /*
  *     Are the two ports equivalent?
  */
-int uart_match_port(struct uart_port *port1, struct uart_port *port2)
+bool uart_match_port(const struct uart_port *port1,
+               const struct uart_port *port2)
 {
        if (port1->iotype != port2->iotype)
-               return 0;
+               return false;
 
        switch (port1->iotype) {
        case UPIO_PORT:
-               return (port1->iobase == port2->iobase);
+               return port1->iobase == port2->iobase;
        case UPIO_HUB6:
-               return (port1->iobase == port2->iobase) &&
-                      (port1->hub6   == port2->hub6);
+               return port1->iobase == port2->iobase &&
+                      port1->hub6   == port2->hub6;
        case UPIO_MEM:
        case UPIO_MEM16:
        case UPIO_MEM32:
        case UPIO_MEM32BE:
        case UPIO_AU:
        case UPIO_TSI:
-               return (port1->mapbase == port2->mapbase);
+               return port1->mapbase == port2->mapbase;
        }
-       return 0;
+
+       return false;
 }
 EXPORT_SYMBOL(uart_match_port);
 
index 7445c8fd88c0e871d280039e7863ce4931821ea0..52d7fb92a69d0eb6bd790888b7a96f9c0c824e72 100644 (file)
@@ -408,7 +408,8 @@ int uart_register_driver(struct uart_driver *uart);
 void uart_unregister_driver(struct uart_driver *uart);
 int uart_add_one_port(struct uart_driver *reg, struct uart_port *port);
 int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
-int uart_match_port(struct uart_port *port1, struct uart_port *port2);
+bool uart_match_port(const struct uart_port *port1,
+               const struct uart_port *port2);
 
 /*
  * Power Management