nuttx/drivers: Remove explicity references to errno. That is a problem from within the kernel for certain configurations

This commit is contained in:
Gregory Nutt 2014-08-28 16:59:06 -06:00
parent 220216cc38
commit 98cf3b06e5
8 changed files with 34 additions and 34 deletions

View File

@ -139,7 +139,7 @@ static int can_open(FAR struct file *filep)
if (sem_wait(&dev->cd_closesem) != OK)
{
ret = -errno;
ret = -get_errno();
}
else
{
@ -211,7 +211,7 @@ static int can_close(FAR struct file *filep)
if (sem_wait(&dev->cd_closesem) != OK)
{
ret = -errno;
ret = -get_errno();
}
else
{
@ -310,7 +310,7 @@ static ssize_t can_read(FAR struct file *filep, FAR char *buffer, size_t buflen)
ret = sem_wait(&dev->cd_recv.rx_sem);
if (ret < 0)
{
ret = -errno;
ret = -get_errno();
goto return_with_irqdisabled;
}
}
@ -514,9 +514,9 @@ static ssize_t can_write(FAR struct file *filep, FAR const char *buffer, size_t
ret = sem_wait(&fifo->tx_sem);
dev->cd_ntxwaiters--;
if (ret < 0 && errno != EINTR)
if (ret < 0 && get_errno() != EINTR)
{
ret = -errno;
ret = -get_errno();
goto return_with_irqdisabled;
}
}

View File

@ -134,7 +134,7 @@ static void loop_semtake(FAR struct loop_struct_s *dev)
* the wait was awakened by a signal.
*/
ASSERT(errno == EINTR);
ASSERT(get_errno() == EINTR);
}
}
@ -234,7 +234,7 @@ static ssize_t loop_read(FAR struct inode *inode, unsigned char *buffer,
ret = lseek(dev->fd, offset, SEEK_SET);
if (ret == (off_t)-1)
{
dbg("Seek failed for offset=%d: %d\n", (int)offset, errno);
dbg("Seek failed for offset=%d: %d\n", (int)offset, get_errno());
return -EIO;
}
@ -243,10 +243,10 @@ static ssize_t loop_read(FAR struct inode *inode, unsigned char *buffer,
do
{
nbytesread = read(dev->fd, buffer, nsectors * dev->sectsize);
if (nbytesread < 0 && errno != EINTR)
if (nbytesread < 0 && get_errno() != EINTR)
{
dbg("Read failed: %d\n", errno);
return -errno;
dbg("Read failed: %d\n", get_errno());
return -get_errno();
}
}
while (nbytesread < 0);
@ -281,7 +281,7 @@ static ssize_t loop_write(FAR struct inode *inode, const unsigned char *buffer,
ret = lseek(dev->fd, offset, SEEK_SET);
if (ret == (off_t)-1)
{
dbg("Seek failed for offset=%d: %d\n", (int)offset, errno);
dbg("Seek failed for offset=%d: %d\n", (int)offset, get_errno());
}
/* Then write the requested number of sectors to that position */
@ -289,10 +289,10 @@ static ssize_t loop_write(FAR struct inode *inode, const unsigned char *buffer,
do
{
nbyteswritten = write(dev->fd, buffer, nsectors * dev->sectsize);
if (nbyteswritten < 0 && errno != EINTR)
if (nbyteswritten < 0 && get_errno() != EINTR)
{
dbg("Write failed: %d\n", errno);
return -errno;
dbg("Write failed: %d\n", get_errno());
return -get_errno();
}
}
while (nbyteswritten < 0);
@ -367,8 +367,8 @@ int losetup(const char *devname, const char *filename, uint16_t sectsize,
ret = stat(filename, &sb);
if (ret < 0)
{
dbg("Failed to stat %s: %d\n", filename, errno);
return -errno;
dbg("Failed to stat %s: %d\n", filename, get_errno());
return -get_errno();
}
/* Check if the file system is big enough for one block */
@ -421,8 +421,8 @@ int losetup(const char *devname, const char *filename, uint16_t sectsize,
dev->fd = open(filename, O_RDWR);
if (dev->fd < 0)
{
dbg("Failed to open %s: %d\n", filename, errno);
ret = -errno;
dbg("Failed to open %s: %d\n", filename, get_errno());
ret = -get_errno();
goto errout_with_dev;
}
}

View File

@ -279,7 +279,7 @@ errout_with_dev:
errout_with_pipe:
pipe_free(pipeno);
errout:
errno = err;
set_errno(err);
return ERROR;
}

View File

@ -106,7 +106,7 @@ static void pipecommon_semtake(sem_t *sem)
* awakened by a signal.
*/
ASSERT(errno == EINTR);
ASSERT(get_errno() == EINTR);
}
}
@ -203,9 +203,9 @@ int pipecommon_open(FAR struct file *filep)
ret = sem_wait(&dev->d_bfsem);
if (ret != OK)
{
fdbg("sem_wait failed: %d\n", errno);
DEBUGASSERT(errno > 0);
return -errno;
fdbg("sem_wait failed: %d\n", get_errno());
DEBUGASSERT(get_errno() > 0);
return -get_errno();
}
/* If this the first reference on the device, then allocate the buffer */
@ -265,9 +265,9 @@ int pipecommon_open(FAR struct file *filep)
* a signal.
*/
fdbg("sem_wait failed: %d\n", errno);
DEBUGASSERT(errno > 0);
ret = -errno;
fdbg("sem_wait failed: %d\n", get_errno());
DEBUGASSERT(get_errno() > 0);
ret = -get_errno();
/* Immediately close the pipe that we just opened */

View File

@ -157,7 +157,7 @@ static int pwm_open(FAR struct file *filep)
ret = sem_wait(&upper->exclsem);
if (ret < 0)
{
ret = -errno;
ret = -get_errno();
goto errout;
}
@ -226,7 +226,7 @@ static int pwm_close(FAR struct file *filep)
ret = sem_wait(&upper->exclsem);
if (ret < 0)
{
ret = -errno;
ret = -get_errno();
goto errout;
}
@ -348,7 +348,7 @@ static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags)
*/
int tmp = sem_wait(&upper->waitsem);
DEBUGASSERT(tmp == OK || errno == EINTR);
DEBUGASSERT(tmp == OK || get_errno() == EINTR);
}
}
else

View File

@ -100,7 +100,7 @@ static void rwb_semtake(sem_t *sem)
* the wait was awakened by a signal.
*/
ASSERT(errno == EINTR);
ASSERT(get_errno() == EINTR);
}
}

View File

@ -148,7 +148,7 @@ static int timer_open(FAR struct file *filep)
ret = 1; //sem_wait(&upper->exclsem);
if (ret < 0)
{
ret = -errno;
ret = -get_errno();
goto errout;
}
@ -199,7 +199,7 @@ static int timer_close(FAR struct file *filep)
ret = 1; //sem_wait(&upper->exclsem);
if (ret < 0)
{
ret = -errno;
ret = -get_errno();
goto errout;
}

View File

@ -147,7 +147,7 @@ static int wdog_open(FAR struct file *filep)
ret = sem_wait(&upper->exclsem);
if (ret < 0)
{
ret = -errno;
ret = -get_errno();
goto errout;
}
@ -198,7 +198,7 @@ static int wdog_close(FAR struct file *filep)
ret = sem_wait(&upper->exclsem);
if (ret < 0)
{
ret = -errno;
ret = -get_errno();
goto errout;
}