Skip to content

Commit e3fc77f

Browse files
committed
update serial.c
1 parent a657c00 commit e3fc77f

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

components/drivers/serial/serial.c

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@ static int serial_fops_open(struct dfs_fd *fd)
7171

7272
switch (fd->flags & O_ACCMODE)
7373
{
74-
case O_RDONLY:
75-
LOG_D("fops open: O_RDONLY!");
76-
flags = RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_RDONLY;
77-
break;
78-
case O_WRONLY:
79-
LOG_D("fops open: O_WRONLY!");
80-
flags = RT_DEVICE_FLAG_WRONLY;
81-
break;
82-
case O_RDWR:
83-
LOG_D("fops open: O_RDWR!");
84-
flags = RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_RDWR;
85-
break;
86-
default:
87-
LOG_E("fops open: unknown mode - %d!", fd->flags & O_ACCMODE);
88-
break;
74+
case O_RDONLY:
75+
LOG_D("fops open: O_RDONLY!");
76+
flags = RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_RDONLY;
77+
break;
78+
case O_WRONLY:
79+
LOG_D("fops open: O_WRONLY!");
80+
flags = RT_DEVICE_FLAG_WRONLY;
81+
break;
82+
case O_RDWR:
83+
LOG_D("fops open: O_RDWR!");
84+
flags = RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_RDWR;
85+
break;
86+
default:
87+
LOG_E("fops open: unknown mode - %d!", fd->flags & O_ACCMODE);
88+
break;
8989
}
9090

9191
if ((fd->flags & O_ACCMODE) != O_WRONLY)
@@ -759,14 +759,17 @@ static rt_err_t rt_serial_close(struct rt_device *dev)
759759
#ifdef RT_SERIAL_USING_DMA
760760
else if (dev->open_flag & RT_DEVICE_FLAG_DMA_RX)
761761
{
762-
if (serial->config.bufsz == 0) {
762+
if (serial->config.bufsz == 0)
763+
{
763764
struct rt_serial_rx_dma* rx_dma;
764765

765766
rx_dma = (struct rt_serial_rx_dma*)serial->serial_rx;
766767
RT_ASSERT(rx_dma != RT_NULL);
767768

768769
rt_free(rx_dma);
769-
} else {
770+
}
771+
else
772+
{
770773
struct rt_serial_rx_fifo* rx_fifo;
771774

772775
rx_fifo = (struct rt_serial_rx_fifo*)serial->serial_rx;

0 commit comments

Comments
 (0)