Merge pull request #187 from grissiom/serial-fix

Revert "serial: set the errno if and only if in thread context"
This commit is contained in:
Bernard Xiong 2013-10-25 18:11:24 -07:00
commit fac2bb2288
1 changed files with 3 additions and 4 deletions

View File

@ -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; read_nbytes = (rt_uint32_t)ptr - (rt_uint32_t)buffer;
/* set error code if and only if in thread context */ /* set error code */
if (read_nbytes == 0 && !rt_interrupt_get_nest()) if (read_nbytes == 0)
{ {
rt_set_errno(-RT_EEMPTY); 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; write_nbytes = (rt_uint32_t)ptr - (rt_uint32_t)buffer;
/* set error code if and only if in thread context */ if (write_nbytes == 0)
if (write_nbytes == 0 && !rt_interrupt_get_nest())
{ {
rt_set_errno(-RT_EFULL); rt_set_errno(-RT_EFULL);
} }