]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
serial: Fix upstat_t sparse warnings
authorPeter Hurley <peter@hurleysoftware.com>
Thu, 16 Oct 2014 18:19:47 +0000 (14:19 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 00:15:43 +0000 (16:15 -0800)
Commit 299245a145b2ad4cfb4c5432eb1264299f55e7e0,
serial: core: Privatize modem status enable flags, introduced
the upstat_t type and matching bit definitions. The purpose is to
produce sparse warnings if the wrong bit definitions are used
(by warning of implicit integer conversions).

Fix implicit conversion to integer return type from uart_cts_enabled()
and uart_dcd_enabled().

Fixes the following sparse warnings:
drivers/tty/serial/serial_core.c:63:30: warning: incorrect type in return expression (different base types)
drivers/tty/serial/serial_core.c:63:30:    expected int
drivers/tty/serial/serial_core.c:63:30:    got restricted upstat_t
include/linux/serial_core.h:364:30: warning: incorrect type in return expression (different base types)
include/linux/serial_core.h:364:30:    expected bool
include/linux/serial_core.h:364:30:    got restricted upstat_t
include/linux/serial_core.h:364:30: warning: incorrect type in return expression (different base types)
include/linux/serial_core.h:364:30:    expected bool
include/linux/serial_core.h:364:30:    got restricted upstat_t

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/serial_core.c
include/linux/serial_core.h

index df3a8c74358e45644765da1593d19ffd44d6664a..971103714ddd73cb02a99bee219fcc9d67fb1182 100644 (file)
@@ -61,7 +61,7 @@ static void uart_port_shutdown(struct tty_port *port);
 
 static int uart_dcd_enabled(struct uart_port *uport)
 {
-       return uport->status & UPSTAT_DCD_ENABLE;
+       return !!(uport->status & UPSTAT_DCD_ENABLE);
 }
 
 /*
index 21c2e05c1bc3cfb6841d9205af2d13664eccc5da..bccf4bac22f5b5670822d9828cbd566c136cf2b3 100644 (file)
@@ -367,7 +367,7 @@ static inline int uart_tx_stopped(struct uart_port *port)
 
 static inline bool uart_cts_enabled(struct uart_port *uport)
 {
-       return uport->status & UPSTAT_CTS_ENABLE;
+       return !!(uport->status & UPSTAT_CTS_ENABLE);
 }
 
 /*