[zircon][uart] remove unnecessary valid check for uart_base
The uart_base has been checked in function xxx_uart_init_early, and
pdev_uart_ops will not be registered if uart_base was not valid. So
there is no need to check uart_base in functions of pdev_uart_ops.
Change-Id: Ie82cc9a541294885985530e7eaabfbbc814ff953
diff --git a/zircon/kernel/dev/uart/amlogic_s905/uart.cc b/zircon/kernel/dev/uart/amlogic_s905/uart.cc
index b71bfb0..0bef94a 100644
--- a/zircon/kernel/dev/uart/amlogic_s905/uart.cc
+++ b/zircon/kernel/dev/uart/amlogic_s905/uart.cc
@@ -190,10 +190,6 @@
/* panic-time getc/putc */
static void s905_uart_pputc(char c) {
- if (!s905_uart_base) {
- return;
- }
-
/* spin while fifo is full */
while (UARTREG(s905_uart_base, S905_UART_STATUS) & S905_UART_STATUS_TXFULL)
;
@@ -201,10 +197,6 @@
}
static int s905_uart_pgetc() {
- if (!s905_uart_base) {
- return 0;
- }
-
if ((UARTREG(s905_uart_base, S905_UART_STATUS) & S905_UART_STATUS_RXEMPTY) == 0) {
return UARTREG(s905_uart_base, S905_UART_RFIFO);
} else {
@@ -213,10 +205,6 @@
}
static int s905_uart_getc(bool wait) {
- if (!s905_uart_base) {
- return -1;
- }
-
if (initialized) {
// do cbuf stuff here
char c;
@@ -243,9 +231,6 @@
spin_lock_saved_state_t state;
bool copied_CR = false;
- if (!s905_uart_base) {
- return;
- }
if (!uart_tx_irq_enabled) {
block = false;
}
diff --git a/zircon/kernel/dev/uart/dw8250/uart.cc b/zircon/kernel/dev/uart/dw8250/uart.cc
index bc20cf0..af9365b 100644
--- a/zircon/kernel/dev/uart/dw8250/uart.cc
+++ b/zircon/kernel/dev/uart/dw8250/uart.cc
@@ -134,10 +134,6 @@
/* panic-time getc/putc */
static void dw8250_uart_pputc(char c) {
- if (!uart_base) {
- return;
- }
-
// spin while fifo is full
while (!(UARTREG(UART_LSR) & UART_LSR_THRE))
;
@@ -145,10 +141,6 @@
}
static int dw8250_uart_pgetc() {
- if (!uart_base) {
- return ZX_ERR_NOT_SUPPORTED;
- }
-
// spin while fifo is empty
while (!(UARTREG(UART_LSR) & UART_LSR_DR))
;
@@ -156,10 +148,6 @@
}
static int dw8250_uart_getc(bool wait) {
- if (!uart_base) {
- return ZX_ERR_NOT_SUPPORTED;
- }
-
if (initialized) {
char c;
if (cbuf_read_char(&uart_rx_buf, &c, wait) == 1) {
@@ -176,9 +164,6 @@
spin_lock_saved_state_t state;
bool copied_CR = false;
- if (!uart_base) {
- return;
- }
if (!uart_tx_irq_enabled) {
block = false;
}
diff --git a/zircon/kernel/dev/uart/msm/uart.cc b/zircon/kernel/dev/uart/msm/uart.cc
index 45cf06e..acfc59f 100644
--- a/zircon/kernel/dev/uart/msm/uart.cc
+++ b/zircon/kernel/dev/uart/msm/uart.cc
@@ -130,10 +130,6 @@
// panic-time getc/putc
static void msm_pputc(char c) {
- if (!uart_base) {
- return;
- }
-
// spin while fifo is full
while (!(uart_read(UART_DM_SR) & UART_DM_SR_TXEMT)) {
yield();
@@ -278,9 +274,6 @@
spin_lock_saved_state_t state;
bool copied_CR = false;
- if (!uart_base) {
- return;
- }
if (!uart_tx_irq_enabled) {
block = false;
}
diff --git a/zircon/kernel/dev/uart/mt8167/uart.cc b/zircon/kernel/dev/uart/mt8167/uart.cc
index 96964921..6e066804 100644
--- a/zircon/kernel/dev/uart/mt8167/uart.cc
+++ b/zircon/kernel/dev/uart/mt8167/uart.cc
@@ -135,10 +135,6 @@
// panic-time getc/putc
static void mt8167_uart_pputc(char c) {
- if (!uart_base) {
- return;
- }
-
// spin while fifo is full
while (!(UARTREG(UART_LSR) & UART_LSR_THRE))
;
@@ -146,10 +142,6 @@
}
static int mt8167_uart_pgetc() {
- if (!uart_base) {
- return ZX_ERR_NOT_SUPPORTED;
- }
-
// spin while fifo is empty
while (!(UARTREG(UART_LSR) & UART_LSR_DR))
;
@@ -157,10 +149,6 @@
}
static int mt8167_uart_getc(bool wait) {
- if (!uart_base) {
- return ZX_ERR_NOT_SUPPORTED;
- }
-
if (initialized) {
char c;
if (cbuf_read_char(&uart_rx_buf, &c, wait) == 1) {
@@ -177,9 +165,6 @@
spin_lock_saved_state_t state;
bool copied_CR = false;
- if (!uart_base) {
- return;
- }
if (!uart_tx_irq_enabled) {
block = false;
}
diff --git a/zircon/kernel/dev/uart/nxp-imx/uart.cc b/zircon/kernel/dev/uart/nxp-imx/uart.cc
index 1a6e597..8212ed4 100644
--- a/zircon/kernel/dev/uart/nxp-imx/uart.cc
+++ b/zircon/kernel/dev/uart/nxp-imx/uart.cc
@@ -104,10 +104,6 @@
/* panic-time getc/putc */
static void imx_uart_pputc(char c) {
- if (!uart_base) {
- return;
- }
-
/* spin while fifo is full */
while (UARTREG(MX8_UTS) & UTS_TXFULL)
;
@@ -115,10 +111,6 @@
}
static int imx_uart_pgetc() {
- if (!uart_base) {
- return ZX_ERR_NOT_SUPPORTED;
- }
-
if ((UARTREG(MX8_UTS) & UTS_RXEMPTY)) {
return ZX_ERR_INTERNAL;
}
@@ -127,10 +119,6 @@
}
static int imx_uart_getc(bool wait) {
- if (!uart_base) {
- return ZX_ERR_NOT_SUPPORTED;
- }
-
if (initialized) {
char c;
if (cbuf_read_char(&uart_rx_buf, &c, wait) == 1) {
@@ -147,9 +135,6 @@
spin_lock_saved_state_t state;
bool copied_CR = false;
- if (!uart_base) {
- return;
- }
if (!uart_tx_irq_enabled) {
block = false;
}