tracing: uart: rename global variable named dev
MISRA-C Rule 5.3 states that identifiers in inner scope should not hide identifiers in outer scope. There is a global variable named "dev" to store which UART device is being used the tracing backend. This name collides with the parameter of same name in the ISR function. So rename the global variable. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
ac53880cef
commit
d3d2730166
1 changed files with 11 additions and 10 deletions
|
@ -14,7 +14,7 @@
|
|||
#include <tracing_buffer.h>
|
||||
#include <tracing_backend.h>
|
||||
|
||||
static struct device *dev;
|
||||
static struct device *tracing_uart_dev;
|
||||
|
||||
#ifdef CONFIG_TRACING_HANDLE_HOST_CMD
|
||||
static void uart_isr(struct device *dev)
|
||||
|
@ -62,28 +62,29 @@ static void tracing_backend_uart_output(
|
|||
uint8_t *data, uint32_t length)
|
||||
{
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
uart_poll_out(dev, data[i]);
|
||||
uart_poll_out(tracing_uart_dev, data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void tracing_backend_uart_init(void)
|
||||
{
|
||||
dev = device_get_binding(CONFIG_TRACING_BACKEND_UART_NAME);
|
||||
__ASSERT(dev, "uart backend binding failed");
|
||||
tracing_uart_dev =
|
||||
device_get_binding(CONFIG_TRACING_BACKEND_UART_NAME);
|
||||
__ASSERT(tracing_uart_dev, "uart backend binding failed");
|
||||
|
||||
#ifdef CONFIG_TRACING_HANDLE_HOST_CMD
|
||||
uart_irq_rx_disable(dev);
|
||||
uart_irq_tx_disable(dev);
|
||||
uart_irq_rx_disable(tracing_uart_dev);
|
||||
uart_irq_tx_disable(tracing_uart_dev);
|
||||
|
||||
uart_irq_callback_set(dev, uart_isr);
|
||||
uart_irq_callback_set(tracing_uart_dev, uart_isr);
|
||||
|
||||
while (uart_irq_rx_ready(dev)) {
|
||||
while (uart_irq_rx_ready(tracing_uart_dev)) {
|
||||
uint8_t c;
|
||||
|
||||
uart_fifo_read(dev, &c, 1);
|
||||
uart_fifo_read(tracing_uart_dev, &c, 1);
|
||||
}
|
||||
|
||||
uart_irq_rx_enable(dev);
|
||||
uart_irq_rx_enable(tracing_uart_dev);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue