linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] serial: Fix upstat_t sparse warnings
@ 2014-10-16 18:19 Peter Hurley
  2014-10-16 18:19 ` [PATCH 2/3] serial: Fix sparse warnings in uart_throttle()/uart_unthrottle() Peter Hurley
  2014-10-16 18:19 ` [PATCH 3/3] tty: Remove sparse lock annotations from tty_write_lock()/_unlock() Peter Hurley
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Hurley @ 2014-10-16 18:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-serial, Jiri Slaby, Peter Hurley

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>
---
 drivers/tty/serial/serial_core.c | 2 +-
 include/linux/serial_core.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index c4cc2f2..d777579 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -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);
 }
 
 /*
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 222d2e0..bb828a5 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -363,7 +363,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);
 }
 
 /*
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-16 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-16 18:19 [PATCH 1/3] serial: Fix upstat_t sparse warnings Peter Hurley
2014-10-16 18:19 ` [PATCH 2/3] serial: Fix sparse warnings in uart_throttle()/uart_unthrottle() Peter Hurley
2014-10-16 18:19 ` [PATCH 3/3] tty: Remove sparse lock annotations from tty_write_lock()/_unlock() Peter Hurley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).