Revert part of last change

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1285 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-11-19 02:39:21 +00:00
parent fb68f83244
commit 0f4896d7b8
8 changed files with 34 additions and 36 deletions

View File

@ -54,7 +54,7 @@
static ssize_t devconsole_read(struct file *, char *, size_t);
static ssize_t devconsole_write(struct file *, const char *, size_t);
#ifndef CONFIG_DISABLE_POLL
static int devconsole_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup);
static int devconsole_poll(FAR struct file *filep, FAR struct pollfd *fds);
#endif
/****************************************************************************
@ -85,7 +85,7 @@ static ssize_t devconsole_write(struct file *filp, const char *buffer, size_t le
}
#ifndef CONFIG_DISABLE_POLL
static int devconsole_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup)
static int devconsole_poll(FAR struct file *filep, FAR struct pollfd *fds)
{
return OK;
}

View File

@ -56,7 +56,7 @@
static ssize_t devnull_read(FAR struct file *, FAR char *, size_t);
static ssize_t devnull_write(FAR struct file *, FAR const char *, size_t);
#ifndef CONFIG_DISABLE_POLL
static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds, boolean setup);
static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds);
#endif
/****************************************************************************
@ -103,9 +103,9 @@ static ssize_t devnull_write(FAR struct file *filp, FAR const char *buffer, size
****************************************************************************/
#ifndef CONFIG_DISABLE_POLL
static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds, boolean setup)
static int devnull_poll(FAR struct file *filp, FAR struct pollfd *fds)
{
if (setup)
if (fds)
{
fds->revents |= (fds->events & (POLLIN|POLLOUT));
if (fds->revents != 0)

View File

@ -56,7 +56,7 @@
static ssize_t devzero_read(FAR struct file *, FAR char *, size_t);
static ssize_t devzero_write(FAR struct file *, FAR const char *, size_t);
#ifndef CONFIG_DISABLE_POLL
static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds, boolean setup);
static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds);
#endif
/****************************************************************************
@ -104,9 +104,9 @@ static ssize_t devzero_write(FAR struct file *filp, FAR const char *buffer, size
****************************************************************************/
#ifndef CONFIG_DISABLE_POLL
static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds, boolean setup)
static int devzero_poll(FAR struct file *filp, FAR struct pollfd *fds)
{
if (setup)
if (fds)
{
fds->revents |= (fds->events & (POLLIN|POLLOUT));
if (fds->revents != 0)

View File

@ -517,7 +517,7 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t
****************************************************************************/
#ifndef CONFIG_DISABLE_POLL
int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup)
int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds)
{
FAR struct inode *inode = filep->f_inode;
FAR struct pipe_dev_s *dev = inode->i_private;
@ -547,14 +547,14 @@ int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setu
if (dev->d_fds[i] == filep->f_priv)
{
dev->d_fds[i] = (setup ? fds : NULL);
dev->d_fds[i] = fds;
break;
}
}
if (i >= CONFIG_DEV_PIPE_NPOLLWAITERS)
{
DEBUGASSERT(setup);
DEBUGASSERT(fds != NULL);
return -EBUSY;
}
@ -562,16 +562,13 @@ int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setu
* private data.
*/
filep->f_priv = NULL; /* Assume teardown */
if (setup)
filep->f_priv = fds;
/* Check if we should immediately notify on any of the requested events */
if (fds)
{
/* Set the poll event structure reference in the 'struct file' private data. */
filep->f_priv = fds;
/* Check if we should immediately notify on any of the requested events. First,
* Determine how many bytes are in the buffer
*/
/* Determine how many bytes are in the buffer */
if (dev->d_wrndx >= dev->d_rdndx)
{

View File

@ -123,7 +123,7 @@ EXTERN int pipecommon_close(FAR struct file *filep);
EXTERN ssize_t pipecommon_read(FAR struct file *, FAR char *, size_t);
EXTERN ssize_t pipecommon_write(FAR struct file *, FAR const char *, size_t);
#ifndef CONFIG_DISABLE_POLL
EXTERN int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup);
EXTERN int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds);
#endif
#undef EXTERN

View File

@ -79,7 +79,7 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen
static ssize_t uart_write(FAR struct file *filep, FAR const char *buffer, size_t buflen);
static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
#ifndef CONFIG_DISABLE_POLL
static int uart_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup);
static int uart_poll(FAR struct file *filep, FAR struct pollfd *fds);
#endif
/************************************************************************************
@ -400,7 +400,7 @@ static int uart_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
****************************************************************************/
#ifndef CONFIG_DISABLE_POLL
int uart_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup)
int uart_poll(FAR struct file *filep, FAR struct pollfd *fds)
{
FAR struct inode *inode = filep->f_inode;
FAR uart_dev_t *dev = inode->i_private;
@ -430,14 +430,14 @@ int uart_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup)
if (dev->fds[i] == filep->f_priv)
{
dev->fds[i] = (setup ? fds : NULL);
dev->fds[i] = fds;
break;
}
}
if (i >= CONFIG_DEV_CONSOLE_NPOLLWAITERS)
{
DEBUGASSERT(setup);
DEBUGASSERT(fds != NULL);
return -EBUSY;
}
@ -445,12 +445,13 @@ int uart_poll(FAR struct file *filep, FAR struct pollfd *fds, boolean setup)
* private data.
*/
filep->f_priv = NULL; /* Assume teardown */
if (setup)
filep->f_priv = fds;
/* Check if we should immediately notify on any of the requested events */
if (fds)
{
/* Check if we should immediately notify on any of the requested events.
* First, check if the xmit buffer is full.
*/
/* Check if the xmit buffer is full. */
eventset = 0;

View File

@ -93,7 +93,7 @@ static void poll_semtake(FAR sem_t *sem)
****************************************************************************/
#if CONFIG_NFILE_DESCRIPTORS > 0
static int poll_fdsetup(int fd, FAR struct pollfd *fds, boolean setup)
static int poll_fdsetup(int fd, FAR struct pollfd *fds)
{
FAR struct filelist *list;
FAR struct file *this_file;
@ -109,7 +109,7 @@ static int poll_fdsetup(int fd, FAR struct pollfd *fds, boolean setup)
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS+CONFIG_NSOCKET_DESCRIPTORS))
{
return net_poll(fds->fd, fds, setup);
return net_poll(fd, fds);
}
else
#endif
@ -137,7 +137,7 @@ static int poll_fdsetup(int fd, FAR struct pollfd *fds, boolean setup)
{
/* Yes, then setup the poll */
ret = (int)inode->u.i_ops->poll(this_file, fds, setup);
ret = (int)inode->u.i_ops->poll(this_file, fds);
}
return ret;
}
@ -168,7 +168,7 @@ static inline int poll_setup(FAR struct pollfd *fds, nfds_t nfds, sem_t *sem)
/* Set up the poll */
ret = poll_fdsetup(fds[i].fd, &fds[i], TRUE);
ret = poll_fdsetup(fds[i].fd, &fds[i]);
if (ret < 0)
{
return ret;
@ -201,7 +201,7 @@ static inline int poll_teardown(FAR struct pollfd *fds, nfds_t nfds, int *count)
{
/* Teardown the poll */
status = poll_fdsetup(fds[i].fd, &fds[i], FALSE);
status = poll_fdsetup(fds[i].fd, NULL);
if (status < 0)
{
ret = status;

View File

@ -76,7 +76,7 @@ struct file_operations
off_t (*seek)(FAR struct file *filp, off_t offset, int whence);
int (*ioctl)(FAR struct file *filp, int cmd, unsigned long arg);
#ifndef CONFIG_DISABLE_POLL
int (*poll)(FAR struct file *filp, struct pollfd *fds, boolean setup);
int (*poll)(FAR struct file *filp, struct pollfd *fds);
#endif
/* The two structures need not be common after this point */