diff options
| author | Grissiom <[email protected]> | 2013-10-25 21:23:15 +0800 |
|---|---|---|
| committer | Grissiom <[email protected]> | 2013-10-25 21:23:15 +0800 |
| commit | 6bb2c0f2ead16ac7c46b582f67e354bedbcf87a1 (patch) | |
| tree | c031a9979667b58ad15850195431b696a90c2874 | |
| parent | 166531168de3e906098531f9d8c9cac71a89177a (diff) | |
Revert "serial: set the errno if and only if in thread context"
This reverts commit 07bd09fc0fc256e5c53ad3c6157802fd94c9910c.
The validation of the context is done with in `rt_set_errno`. So it's
safe to call it here.
| -rw-r--r-- | components/drivers/serial/serial.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index c4a7ac6980..5e7a8ec814 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -257,8 +257,8 @@ static rt_size_t rt_serial_read(struct rt_device *dev, } read_nbytes = (rt_uint32_t)ptr - (rt_uint32_t)buffer; - /* set error code if and only if in thread context */ - if (read_nbytes == 0 && !rt_interrupt_get_nest()) + /* set error code */ + if (read_nbytes == 0) { rt_set_errno(-RT_EEMPTY); } @@ -349,8 +349,7 @@ static rt_size_t rt_serial_write(struct rt_device *dev, } write_nbytes = (rt_uint32_t)ptr - (rt_uint32_t)buffer; - /* set error code if and only if in thread context */ - if (write_nbytes == 0 && !rt_interrupt_get_nest()) + if (write_nbytes == 0) { rt_set_errno(-RT_EFULL); } |
