poll: pollsetup should notify only one fd passd by caller

since it's redundant to iterate the whole fds array in setup

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2023-11-19 19:19:53 +08:00
committed by Alin Jerpelea
parent 11b3adf17f
commit eddd90de78
84 changed files with 373 additions and 396 deletions
+4 -4
View File
@@ -3097,7 +3097,7 @@ static int cxd56_gnss_poll(struct file *filep, struct pollfd *fds,
if (priv->has_event) if (priv->has_event)
{ {
cxd56_gnss_pollnotify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -3108,9 +3108,9 @@ static int cxd56_gnss_poll(struct file *filep, struct pollfd *fds,
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
priv->has_event = false; priv->has_event = false;
} }
errout: errout:
+7 -7
View File
@@ -206,9 +206,9 @@ struct sam_tsd_s
static void sam_tsd_notify(struct sam_tsd_s *priv); static void sam_tsd_notify(struct sam_tsd_s *priv);
static int sam_tsd_sample(struct sam_tsd_s *priv, static int sam_tsd_sample(struct sam_tsd_s *priv,
struct sam_sample_s *sample); struct sam_sample_s *sample);
static int sam_tsd_waitsample(struct sam_tsd_s *priv, static int sam_tsd_waitsample(struct sam_tsd_s *priv,
struct sam_sample_s *sample); struct sam_sample_s *sample);
static void sam_tsd_bottomhalf(void *arg); static void sam_tsd_bottomhalf(void *arg);
static int sam_tsd_schedule(struct sam_tsd_s *priv); static int sam_tsd_schedule(struct sam_tsd_s *priv);
static void sam_tsd_expiry(wdparm_t arg); static void sam_tsd_expiry(wdparm_t arg);
@@ -1185,8 +1185,8 @@ static int sam_tsd_poll(struct file *filep, struct pollfd *fds, bool setup)
if (i >= CONFIG_SAMA5_TSD_NPOLLWAITERS) if (i >= CONFIG_SAMA5_TSD_NPOLLWAITERS)
{ {
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
@@ -1194,7 +1194,7 @@ static int sam_tsd_poll(struct file *filep, struct pollfd *fds, bool setup)
if (priv->penchange) if (priv->penchange)
{ {
sam_tsd_notify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -1206,8 +1206,8 @@ static int sam_tsd_poll(struct file *filep, struct pollfd *fds, bool setup)
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
+5 -5
View File
@@ -109,15 +109,15 @@ struct stm32_bbsram_s
static int stm32_bbsram_open(struct file *filep); static int stm32_bbsram_open(struct file *filep);
static int stm32_bbsram_close(struct file *filep); static int stm32_bbsram_close(struct file *filep);
static off_t stm32_bbsram_seek(struct file *filep, off_t offset, static off_t stm32_bbsram_seek(struct file *filep, off_t offset,
int whence); int whence);
static ssize_t stm32_bbsram_read(struct file *filep, char *buffer, static ssize_t stm32_bbsram_read(struct file *filep, char *buffer,
size_t len); size_t len);
static ssize_t stm32_bbsram_write(struct file *filep, static ssize_t stm32_bbsram_write(struct file *filep,
const char *buffer, size_t len); const char *buffer, size_t len);
static int stm32_bbsram_ioctl(struct file *filep, int cmd, static int stm32_bbsram_ioctl(struct file *filep, int cmd,
unsigned long arg); unsigned long arg);
static int stm32_bbsram_poll(struct file *filep, static int stm32_bbsram_poll(struct file *filep,
struct pollfd *fds, bool setup); struct pollfd *fds, bool setup);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
static int stm32_bbsram_unlink(struct inode *inode); static int stm32_bbsram_unlink(struct inode *inode);
#endif #endif
+5 -5
View File
@@ -109,15 +109,15 @@ struct stm32_bbsram_s
static int stm32_bbsram_open(struct file *filep); static int stm32_bbsram_open(struct file *filep);
static int stm32_bbsram_close(struct file *filep); static int stm32_bbsram_close(struct file *filep);
static off_t stm32_bbsram_seek(struct file *filep, off_t offset, static off_t stm32_bbsram_seek(struct file *filep, off_t offset,
int whence); int whence);
static ssize_t stm32_bbsram_read(struct file *filep, char *buffer, static ssize_t stm32_bbsram_read(struct file *filep, char *buffer,
size_t len); size_t len);
static ssize_t stm32_bbsram_write(struct file *filep, static ssize_t stm32_bbsram_write(struct file *filep,
const char *buffer, size_t len); const char *buffer, size_t len);
static int stm32_bbsram_ioctl(struct file *filep, int cmd, static int stm32_bbsram_ioctl(struct file *filep, int cmd,
unsigned long arg); unsigned long arg);
static int stm32_bbsram_poll(struct file *filep, static int stm32_bbsram_poll(struct file *filep,
struct pollfd *fds, bool setup); struct pollfd *fds, bool setup);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
static int stm32_bbsram_unlink(struct inode *inode); static int stm32_bbsram_unlink(struct inode *inode);
#endif #endif
+5 -5
View File
@@ -130,15 +130,15 @@ struct stm32_bbsram_s
static int stm32_bbsram_open(struct file *filep); static int stm32_bbsram_open(struct file *filep);
static int stm32_bbsram_close(struct file *filep); static int stm32_bbsram_close(struct file *filep);
static off_t stm32_bbsram_seek(struct file *filep, off_t offset, static off_t stm32_bbsram_seek(struct file *filep, off_t offset,
int whence); int whence);
static ssize_t stm32_bbsram_read(struct file *filep, char *buffer, static ssize_t stm32_bbsram_read(struct file *filep, char *buffer,
size_t len); size_t len);
static ssize_t stm32_bbsram_write(struct file *filep, static ssize_t stm32_bbsram_write(struct file *filep,
const char *buffer, size_t len); const char *buffer, size_t len);
static int stm32_bbsram_ioctl(struct file *filep, int cmd, static int stm32_bbsram_ioctl(struct file *filep, int cmd,
unsigned long arg); unsigned long arg);
static int stm32_bbsram_poll(struct file *filep, static int stm32_bbsram_poll(struct file *filep,
struct pollfd *fds, bool setup); struct pollfd *fds, bool setup);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
static int stm32_bbsram_unlink(struct inode *inode); static int stm32_bbsram_unlink(struct inode *inode);
#endif #endif
@@ -325,7 +325,7 @@ static int cxd5610_gnss_post_interrupt(void);
#if CONFIG_SENSORS_CXD5610_GNSS_NSIGNALRECEIVERS != 0 #if CONFIG_SENSORS_CXD5610_GNSS_NSIGNALRECEIVERS != 0
static void cxd5610_gnss_signalhandler(struct cxd5610_gnss_dev_s *priv, static void cxd5610_gnss_signalhandler(struct cxd5610_gnss_dev_s *priv,
uint8_t sigtype); uint8_t sigtype);
#endif #endif
#if CONFIG_SENSORS_CXD5610_GNSS_NPOLLWAITERS != 0 #if CONFIG_SENSORS_CXD5610_GNSS_NPOLLWAITERS != 0
@@ -2037,7 +2037,7 @@ static int cxd5610_gnss_poll(struct file *filep, struct pollfd *fds,
if (priv->has_event) if (priv->has_event)
{ {
cxd5610_gnss_pollnotify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -2048,9 +2048,9 @@ static int cxd5610_gnss_poll(struct file *filep, struct pollfd *fds,
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
priv->has_event = false; priv->has_event = false;
} }
errout: errout:
@@ -1397,8 +1397,8 @@ static int tc_poll(struct file *filep, struct pollfd *fds, bool setup)
if (i >= CONFIG_TOUCHSCREEN_NPOLLWAITERS) if (i >= CONFIG_TOUCHSCREEN_NPOLLWAITERS)
{ {
ierr("ERROR: No available slot found: %d\n", i); ierr("ERROR: No available slot found: %d\n", i);
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
@@ -1406,7 +1406,7 @@ static int tc_poll(struct file *filep, struct pollfd *fds, bool setup)
if (priv->penchange) if (priv->penchange)
{ {
tc_notify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -1418,8 +1418,8 @@ static int tc_poll(struct file *filep, struct pollfd *fds, bool setup)
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
@@ -1274,8 +1274,8 @@ static int tc_poll(struct file *filep, struct pollfd *fds, bool setup)
if (i >= CONFIG_TOUCHSCREEN_NPOLLWAITERS) if (i >= CONFIG_TOUCHSCREEN_NPOLLWAITERS)
{ {
ierr("ERROR: No available slot found: %d\n", i); ierr("ERROR: No available slot found: %d\n", i);
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
@@ -1283,7 +1283,7 @@ static int tc_poll(struct file *filep, struct pollfd *fds, bool setup)
if (priv->penchange) if (priv->penchange)
{ {
tc_notify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -1295,8 +1295,8 @@ static int tc_poll(struct file *filep, struct pollfd *fds, bool setup)
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
@@ -971,7 +971,7 @@ static int lcd_ioctl(struct file *filep, int cmd, unsigned long arg)
****************************************************************************/ ****************************************************************************/
static int lcd_poll(struct file *filep, struct pollfd *fds, static int lcd_poll(struct file *filep, struct pollfd *fds,
bool setup) bool setup)
{ {
if (setup) if (setup)
{ {
+5 -5
View File
@@ -567,8 +567,8 @@ static int adc_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
if (i >= CONFIG_ADC_NPOLLWAITERS) if (i >= CONFIG_ADC_NPOLLWAITERS)
{ {
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto return_with_irqdisabled; goto return_with_irqdisabled;
} }
@@ -576,7 +576,7 @@ static int adc_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
if (dev->ad_recv.af_head != dev->ad_recv.af_tail) if (dev->ad_recv.af_head != dev->ad_recv.af_tail)
{ {
poll_notify(dev->fds, CONFIG_ADC_NPOLLWAITERS, POLLIN); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -587,8 +587,8 @@ static int adc_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
return_with_irqdisabled: return_with_irqdisabled:
+8 -8
View File
@@ -86,9 +86,9 @@ static const struct comp_callback_s g_comp_callback =
static int comp_poll(FAR struct file *filep, FAR struct pollfd *fds, static int comp_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup) bool setup)
{ {
FAR struct inode *inode = filep->f_inode; FAR struct inode *inode = filep->f_inode;
FAR struct comp_dev_s *dev = inode->i_private; FAR struct comp_dev_s *dev = inode->i_private;
int ret = OK; int ret = OK;
int i; int i;
DEBUGASSERT(dev && fds); DEBUGASSERT(dev && fds);
@@ -123,8 +123,8 @@ static int comp_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_DEV_COMP_NPOLLWAITERS) if (i >= CONFIG_DEV_COMP_NPOLLWAITERS)
{ {
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
} }
@@ -137,15 +137,15 @@ static int comp_poll(FAR struct file *filep, FAR struct pollfd *fds,
#ifdef CONFIG_DEBUG_FEATURES #ifdef CONFIG_DEBUG_FEATURES
if (!slot) if (!slot)
{ {
ret = -EIO; ret = -EIO;
goto errout; goto errout;
} }
#endif #endif
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
+4 -4
View File
@@ -55,13 +55,13 @@ static int bch_open(FAR struct file *filep);
static int bch_close(FAR struct file *filep); static int bch_close(FAR struct file *filep);
static off_t bch_seek(FAR struct file *filep, off_t offset, int whence); static off_t bch_seek(FAR struct file *filep, off_t offset, int whence);
static ssize_t bch_read(FAR struct file *filep, FAR char *buffer, static ssize_t bch_read(FAR struct file *filep, FAR char *buffer,
size_t buflen); size_t buflen);
static ssize_t bch_write(FAR struct file *filep, FAR const char *buffer, static ssize_t bch_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen); size_t buflen);
static int bch_ioctl(FAR struct file *filep, int cmd, static int bch_ioctl(FAR struct file *filep, int cmd,
unsigned long arg); unsigned long arg);
static int bch_poll(FAR struct file *filep, FAR struct pollfd *fds, static int bch_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup); bool setup);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
static int bch_unlink(FAR struct inode *inode); static int bch_unlink(FAR struct inode *inode);
#endif #endif
+1 -1
View File
@@ -1199,7 +1199,7 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
} }
} }
poll_notify(dev->cd_fds, CONFIG_CAN_NPOLLWAITERS, eventset); poll_notify(&fds, 1, eventset);
} }
else if (fds->priv != NULL) else if (fds->priv != NULL)
{ {
+6 -6
View File
@@ -994,7 +994,7 @@ static int ads7843e_poll(FAR struct file *filep, FAR struct pollfd *fds,
inode = filep->f_inode; inode = filep->f_inode;
DEBUGASSERT(inode->i_private); DEBUGASSERT(inode->i_private);
priv = inode->i_private; priv = inode->i_private;
/* Are we setting up the poll? Or tearing it down? */ /* Are we setting up the poll? Or tearing it down? */
@@ -1034,8 +1034,8 @@ static int ads7843e_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_ADS7843E_NPOLLWAITERS) if (i >= CONFIG_ADS7843E_NPOLLWAITERS)
{ {
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
@@ -1043,7 +1043,7 @@ static int ads7843e_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->penchange) if (priv->penchange)
{ {
ads7843e_notify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -1055,8 +1055,8 @@ static int ads7843e_poll(FAR struct file *filep, FAR struct pollfd *fds,
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
+2 -2
View File
@@ -630,8 +630,8 @@ static int ajoy_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_INPUT_AJOYSTICK_NPOLLWAITERS) if (i >= CONFIG_INPUT_AJOYSTICK_NPOLLWAITERS)
{ {
ierr("ERROR: Too man poll waiters\n"); ierr("ERROR: Too man poll waiters\n");
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
} }
+2 -2
View File
@@ -710,8 +710,8 @@ static int btn_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_INPUT_BUTTONS_NPOLLWAITERS) if (i >= CONFIG_INPUT_BUTTONS_NPOLLWAITERS)
{ {
ierr("ERROR: Too many poll waiters\n"); ierr("ERROR: Too many poll waiters\n");
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
} }
+1 -3
View File
@@ -1034,9 +1034,7 @@ static int mbr3108_poll(FAR struct file *filep, FAR struct pollfd *fds,
pending = priv->int_pending; pending = priv->int_pending;
if (pending) if (pending)
{ {
poll_notify(priv->fds, poll_notify(&fds, 1, POLLIN);
CONFIG_INPUT_CYPRESS_MBR3108_NPOLLWAITERS,
POLLIN);
} }
} }
} }
+2 -2
View File
@@ -624,8 +624,8 @@ static int djoy_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_INPUT_DJOYSTICK_NPOLLWAITERS) if (i >= CONFIG_INPUT_DJOYSTICK_NPOLLWAITERS)
{ {
ierr("ERROR: Too man poll waiters\n"); ierr("ERROR: Too man poll waiters\n");
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
} }
+5 -5
View File
@@ -1013,8 +1013,8 @@ static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_FT5X06_NPOLLWAITERS) if (i >= CONFIG_FT5X06_NPOLLWAITERS)
{ {
ierr("ERROR: No available slot found: %d\n", i); ierr("ERROR: No available slot found: %d\n", i);
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
@@ -1022,7 +1022,7 @@ static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->valid) if (priv->valid)
{ {
ft5x06_notify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -1034,8 +1034,8 @@ static int ft5x06_poll(FAR struct file *filep, FAR struct pollfd *fds,
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
+1 -3
View File
@@ -813,9 +813,7 @@ static int gt9xx_poll(FAR struct file *filep, FAR struct pollfd *fds,
pending = priv->int_pending; pending = priv->int_pending;
if (pending) if (pending)
{ {
poll_notify(priv->fds, poll_notify(&fds, 1, POLLIN);
CONFIG_INPUT_GT9XX_NPOLLWAITERS,
POLLIN);
} }
} }
} }
+1 -1
View File
@@ -276,7 +276,7 @@ static int keyboard_poll(FAR struct file *filep,
if (!circbuf_is_empty(&opriv->circ)) if (!circbuf_is_empty(&opriv->circ))
{ {
poll_notify(&opriv->fds, 1, POLLIN); poll_notify(&fds, 1, POLLIN);
} }
} }
else else
+5 -5
View File
@@ -1027,8 +1027,8 @@ static int max11802_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_MAX11802_NPOLLWAITERS) if (i >= CONFIG_MAX11802_NPOLLWAITERS)
{ {
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
@@ -1036,7 +1036,7 @@ static int max11802_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->penchange) if (priv->penchange)
{ {
max11802_notify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -1048,8 +1048,8 @@ static int max11802_poll(FAR struct file *filep, FAR struct pollfd *fds,
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
+3 -2
View File
@@ -218,7 +218,8 @@ out:
* Name: mouse_poll * Name: mouse_poll
****************************************************************************/ ****************************************************************************/
static int mouse_poll(FAR struct file *filep, struct pollfd *fds, bool setup) static int mouse_poll(FAR struct file *filep,
FAR struct pollfd *fds, bool setup)
{ {
FAR struct mouse_openpriv_s *openpriv = filep->f_priv; FAR struct mouse_openpriv_s *openpriv = filep->f_priv;
pollevent_t eventset = 0; pollevent_t eventset = 0;
@@ -248,7 +249,7 @@ static int mouse_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
eventset |= POLLIN; eventset |= POLLIN;
} }
poll_notify(&openpriv->fds, 1, eventset); poll_notify(&fds, 1, eventset);
} }
else if (fds->priv) else if (fds->priv)
{ {
+19 -19
View File
@@ -212,18 +212,18 @@ struct mxt_dev_s
/* MXT register access */ /* MXT register access */
static int mxt_getreg(FAR struct mxt_dev_s *priv, uint16_t regaddr, static int mxt_getreg(FAR struct mxt_dev_s *priv, uint16_t regaddr,
FAR uint8_t *buffer, size_t buflen); FAR uint8_t *buffer, size_t buflen);
static int mxt_putreg(FAR struct mxt_dev_s *priv, uint16_t regaddr, static int mxt_putreg(FAR struct mxt_dev_s *priv, uint16_t regaddr,
FAR const uint8_t *buffer, size_t buflen); FAR const uint8_t *buffer, size_t buflen);
/* MXT object/message access */ /* MXT object/message access */
static FAR struct mxt_object_s *mxt_object(FAR struct mxt_dev_s *priv, static FAR struct mxt_object_s *mxt_object(FAR struct mxt_dev_s *priv,
uint8_t type); uint8_t type);
static int mxt_getmessage(FAR struct mxt_dev_s *priv, static int mxt_getmessage(FAR struct mxt_dev_s *priv,
FAR struct mxt_msg_s *msg); FAR struct mxt_msg_s *msg);
static int mxt_putobject(FAR struct mxt_dev_s *priv, uint8_t type, static int mxt_putobject(FAR struct mxt_dev_s *priv, uint8_t type,
uint8_t offset, uint8_t value); uint8_t offset, uint8_t value);
#if 0 /* Not used */ #if 0 /* Not used */
static int mxt_getobject(FAR struct mxt_dev_s *priv, uint8_t type, static int mxt_getobject(FAR struct mxt_dev_s *priv, uint8_t type,
uint8_t offset, FAR uint8_t *value); uint8_t offset, FAR uint8_t *value);
@@ -236,27 +236,27 @@ static void mxt_notify(FAR struct mxt_dev_s *priv);
/* Touch event waiting */ /* Touch event waiting */
static inline int mxt_checksample(FAR struct mxt_dev_s *priv); static inline int mxt_checksample(FAR struct mxt_dev_s *priv);
static inline int mxt_waitsample(FAR struct mxt_dev_s *priv); static inline int mxt_waitsample(FAR struct mxt_dev_s *priv);
/* Interrupt handling/position sampling */ /* Interrupt handling/position sampling */
#ifdef CONFIG_MXT_BUTTONS #ifdef CONFIG_MXT_BUTTONS
static void mxt_button_event(FAR struct mxt_dev_s *priv, static void mxt_button_event(FAR struct mxt_dev_s *priv,
FAR struct mxt_msg_s *msg); FAR struct mxt_msg_s *msg);
#endif #endif
static void mxt_touch_event(FAR struct mxt_dev_s *priv, static void mxt_touch_event(FAR struct mxt_dev_s *priv,
FAR struct mxt_msg_s *msg, int ndx); FAR struct mxt_msg_s *msg, int ndx);
static void mxt_worker(FAR void *arg); static void mxt_worker(FAR void *arg);
static int mxt_interrupt(FAR const struct mxt_lower_s *lower, static int mxt_interrupt(FAR const struct mxt_lower_s *lower,
FAR void *context); FAR void *context);
/* Character driver methods */ /* Character driver methods */
static int mxt_open(FAR struct file *filep); static int mxt_open(FAR struct file *filep);
static int mxt_close(FAR struct file *filep); static int mxt_close(FAR struct file *filep);
static ssize_t mxt_read(FAR struct file *filep, FAR char *buffer, static ssize_t mxt_read(FAR struct file *filep, FAR char *buffer,
size_t len); size_t len);
static int mxt_ioctl(FAR struct file *filep, int cmd, unsigned long arg); static int mxt_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int mxt_poll(FAR struct file *filep, struct pollfd *fds, bool setup); static int mxt_poll(FAR struct file *filep, struct pollfd *fds, bool setup);
@@ -1511,10 +1511,10 @@ static int mxt_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
static int mxt_poll(FAR struct file *filep, FAR struct pollfd *fds, static int mxt_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup) bool setup)
{ {
FAR struct inode *inode; FAR struct inode *inode;
FAR struct mxt_dev_s *priv; FAR struct mxt_dev_s *priv;
int ret; int ret;
int i; int i;
iinfo("setup: %d\n", (int)setup); iinfo("setup: %d\n", (int)setup);
DEBUGASSERT(fds); DEBUGASSERT(fds);
@@ -1564,8 +1564,8 @@ static int mxt_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_MXT_NPOLLWAITERS) if (i >= CONFIG_MXT_NPOLLWAITERS)
{ {
ierr("ERROR: No available slot found: %d\n", i); ierr("ERROR: No available slot found: %d\n", i);
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
@@ -1573,7 +1573,7 @@ static int mxt_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->event) if (priv->event)
{ {
mxt_notify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -1585,8 +1585,8 @@ static int mxt_poll(FAR struct file *filep, FAR struct pollfd *fds,
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
+5 -5
View File
@@ -640,8 +640,8 @@ static int spq10kbd_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_SPQ10KBD_NPOLLWAITERS) if (i >= CONFIG_SPQ10KBD_NPOLLWAITERS)
{ {
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
@@ -651,7 +651,7 @@ static int spq10kbd_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->headndx != priv->tailndx) if (priv->headndx != priv->tailndx)
{ {
poll_notify(priv->fds, CONFIG_SPQ10KBD_NPOLLWAITERS, POLLIN); poll_notify(&fds, 1, POLLIN);
} }
} }
else else
@@ -663,8 +663,8 @@ static int spq10kbd_poll(FAR struct file *filep, FAR struct pollfd *fds,
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
+5 -5
View File
@@ -677,8 +677,8 @@ static int stmpe811_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_STMPE811_NPOLLWAITERS) if (i >= CONFIG_STMPE811_NPOLLWAITERS)
{ {
ierr("ERROR: No available slot found: %d\n", i); ierr("ERROR: No available slot found: %d\n", i);
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
@@ -686,7 +686,7 @@ static int stmpe811_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->penchange) if (priv->penchange)
{ {
stmpe811_notify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -698,8 +698,8 @@ static int stmpe811_poll(FAR struct file *filep, FAR struct pollfd *fds,
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
+2 -2
View File
@@ -308,12 +308,12 @@ static int touch_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
eventset |= POLLIN; eventset |= POLLIN;
} }
poll_notify(&openpriv->fds, 1, eventset); poll_notify(&fds, 1, eventset);
} }
else if (fds->priv) else if (fds->priv)
{ {
openpriv->fds = NULL; openpriv->fds = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
+5 -5
View File
@@ -1120,8 +1120,8 @@ static int tsc2007_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (i >= CONFIG_TSC2007_NPOLLWAITERS) if (i >= CONFIG_TSC2007_NPOLLWAITERS)
{ {
ierr("ERROR: No available slot found: %d\n", i); ierr("ERROR: No available slot found: %d\n", i);
fds->priv = NULL; fds->priv = NULL;
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
@@ -1129,7 +1129,7 @@ static int tsc2007_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->penchange) if (priv->penchange)
{ {
tsc2007_notify(priv); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
@@ -1141,8 +1141,8 @@ static int tsc2007_poll(FAR struct file *filep, FAR struct pollfd *fds,
/* Remove all memory of the poll setup */ /* Remove all memory of the poll setup */
*slot = NULL; *slot = NULL;
fds->priv = NULL; fds->priv = NULL;
} }
errout: errout:
+2 -2
View File
@@ -62,7 +62,7 @@
****************************************************************************/ ****************************************************************************/
int ipcc_poll(FAR struct file *filep, FAR struct pollfd *fds, int ipcc_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup) bool setup)
{ {
FAR struct ipcc_driver_s *priv; FAR struct ipcc_driver_s *priv;
FAR struct pollfd **slot; FAR struct pollfd **slot;
@@ -144,7 +144,7 @@ int ipcc_poll(FAR struct file *filep, FAR struct pollfd *fds,
} }
#endif #endif
poll_notify(priv->fds, CONFIG_IPCC_NPOLLWAITERS, eventset); poll_notify(&fds, 1, eventset);
nxmutex_unlock(&priv->lock); nxmutex_unlock(&priv->lock);
return OK; return OK;
+2 -2
View File
@@ -53,9 +53,9 @@ int ipcc_close(FAR struct file *filep);
int ipcc_ioctl(FAR struct file *filep, int cmd, unsigned long arg); int ipcc_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
ssize_t ipcc_read(FAR struct file *filep, FAR char *buffer, size_t buflen); ssize_t ipcc_read(FAR struct file *filep, FAR char *buffer, size_t buflen);
ssize_t ipcc_write(FAR struct file *filep, FAR const char *buffer, ssize_t ipcc_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen); size_t buflen);
int ipcc_poll(FAR struct file *filep, FAR struct pollfd *fds, int ipcc_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup); bool setup);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
int ipcc_unlink(FAR struct inode *inode); int ipcc_unlink(FAR struct inode *inode);
#endif #endif
+8 -7
View File
@@ -126,25 +126,26 @@ static int tda19988_connected(FAR struct tda1988_dev_s *priv);
/* HDMI Module Helpers */ /* HDMI Module Helpers */
static int tda19988_fetch_edid_block(FAR struct tda1988_dev_s *priv, static int tda19988_fetch_edid_block(FAR struct tda1988_dev_s *priv,
FAR uint8_t *buf, int block); FAR uint8_t *buf, int block);
static int tda19988_fetch_edid(struct tda1988_dev_s *priv); static int tda19988_fetch_edid(struct tda1988_dev_s *priv);
static ssize_t tda19988_read_internal(FAR struct tda1988_dev_s *priv, static ssize_t tda19988_read_internal(FAR struct tda1988_dev_s *priv,
off_t offset, FAR uint8_t *buffer, size_t buflen); off_t offset, FAR uint8_t *buffer,
size_t buflen);
/* Character driver methods */ /* Character driver methods */
static int tda19988_open(FAR struct file *filep); static int tda19988_open(FAR struct file *filep);
static int tda19988_close(FAR struct file *filep); static int tda19988_close(FAR struct file *filep);
static ssize_t tda19988_read(FAR struct file *filep, FAR char *buffer, static ssize_t tda19988_read(FAR struct file *filep, FAR char *buffer,
size_t buflen); size_t buflen);
static ssize_t tda19988_write(FAR struct file *filep, FAR const char *buffer, static ssize_t tda19988_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen); size_t buflen);
static off_t tda19988_seek(FAR struct file *filep, off_t offset, static off_t tda19988_seek(FAR struct file *filep, off_t offset,
int whence); int whence);
static int tda19988_ioctl(FAR struct file *filep, int cmd, static int tda19988_ioctl(FAR struct file *filep, int cmd,
unsigned long arg); unsigned long arg);
static int tda19988_poll(FAR struct file *filep, FAR struct pollfd *fds, static int tda19988_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup); bool setup);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
static int tda19988_unlink(FAR struct inode *inode); static int tda19988_unlink(FAR struct inode *inode);
#endif #endif
+3 -3
View File
@@ -39,11 +39,11 @@
****************************************************************************/ ****************************************************************************/
static ssize_t devnull_read(FAR struct file *filep, FAR char *buffer, static ssize_t devnull_read(FAR struct file *filep, FAR char *buffer,
size_t buflen); size_t buflen);
static ssize_t devnull_write(FAR struct file *filep, FAR const char *buffer, static ssize_t devnull_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen); size_t buflen);
static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds, static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup); bool setup);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
+3 -3
View File
@@ -39,11 +39,11 @@
****************************************************************************/ ****************************************************************************/
static ssize_t devzero_read(FAR struct file *filep, FAR char *buffer, static ssize_t devzero_read(FAR struct file *filep, FAR char *buffer,
size_t buflen); size_t buflen);
static ssize_t devzero_write(FAR struct file *filep, FAR const char *buffer, static ssize_t devzero_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen); size_t buflen);
static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds, static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup); bool setup);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
+4 -4
View File
@@ -159,13 +159,13 @@ static void telnet_sendopt(FAR struct telnet_dev_s *priv, uint8_t option,
static int telnet_open(FAR struct file *filep); static int telnet_open(FAR struct file *filep);
static int telnet_close(FAR struct file *filep); static int telnet_close(FAR struct file *filep);
static ssize_t telnet_read(FAR struct file *filep, FAR char *buffer, static ssize_t telnet_read(FAR struct file *filep, FAR char *buffer,
size_t len); size_t len);
static ssize_t telnet_write(FAR struct file *filep, FAR const char *buffer, static ssize_t telnet_write(FAR struct file *filep, FAR const char *buffer,
size_t len); size_t len);
static int telnet_ioctl(FAR struct file *filep, int cmd, static int telnet_ioctl(FAR struct file *filep, int cmd,
unsigned long arg); unsigned long arg);
static int telnet_poll(FAR struct file *filep, FAR struct pollfd *fds, static int telnet_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup); bool setup);
/* Telnet session creation */ /* Telnet session creation */
+1 -6
View File
@@ -246,11 +246,6 @@ static void tun_pollnotify(FAR struct tun_device_s *priv,
nxsem_post(&priv->write_wait_sem); nxsem_post(&priv->write_wait_sem);
} }
if (fds == NULL)
{
return;
}
poll_notify(&fds, 1, eventset); poll_notify(&fds, 1, eventset);
} }
@@ -1186,7 +1181,7 @@ static int tun_poll(FAR struct file *filep,
eventset |= POLLIN; eventset |= POLLIN;
} }
tun_pollnotify(priv, eventset); poll_notify(&fds, 1, eventset);
} }
else else
{ {
+1 -1
View File
@@ -741,7 +741,7 @@ int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds,
eventset |= POLLERR; eventset |= POLLERR;
} }
poll_notify(dev->d_fds, CONFIG_DEV_PIPE_NPOLLWAITERS, eventset); poll_notify(&fds, 1, eventset);
} }
else else
{ {
+6 -13
View File
@@ -103,15 +103,10 @@ static const struct file_operations g_batteryops =
static int battery_charger_notify(FAR struct battery_charger_priv_s *priv, static int battery_charger_notify(FAR struct battery_charger_priv_s *priv,
uint32_t mask) uint32_t mask)
{ {
FAR struct pollfd *fd = priv->fds; FAR struct pollfd *fds = priv->fds;
int semcnt; int semcnt;
int ret; int ret;
if (!fd)
{
return OK;
}
ret = nxmutex_lock(&priv->lock); ret = nxmutex_lock(&priv->lock);
if (ret < 0) if (ret < 0)
{ {
@@ -121,7 +116,7 @@ static int battery_charger_notify(FAR struct battery_charger_priv_s *priv,
priv->mask |= mask; priv->mask |= mask;
if (priv->mask) if (priv->mask)
{ {
poll_notify(&fd, 1, POLLIN); poll_notify(&fds, 1, POLLIN);
nxsem_get_value(&priv->wait, &semcnt); nxsem_get_value(&priv->wait, &semcnt);
if (semcnt < 1) if (semcnt < 1)
@@ -433,6 +428,10 @@ static int bat_charger_poll(FAR struct file *filep,
{ {
priv->fds = fds; priv->fds = fds;
fds->priv = &priv->fds; fds->priv = &priv->fds;
if (priv->mask)
{
poll_notify(&fds, 1, POLLIN);
}
} }
else else
{ {
@@ -446,12 +445,6 @@ static int bat_charger_poll(FAR struct file *filep,
} }
nxmutex_unlock(&priv->lock); nxmutex_unlock(&priv->lock);
if (setup)
{
battery_charger_notify(priv, 0);
}
return ret; return ret;
} }
+7 -14
View File
@@ -79,7 +79,7 @@ static ssize_t bat_gauge_write(FAR struct file *filep,
static int bat_gauge_ioctl(FAR struct file *filep, int cmd, static int bat_gauge_ioctl(FAR struct file *filep, int cmd,
unsigned long arg); unsigned long arg);
static int bat_gauge_poll(FAR struct file *filep, static int bat_gauge_poll(FAR struct file *filep,
FAR struct pollfd *fds, bool setup); FAR struct pollfd *fds, bool setup);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@@ -105,15 +105,10 @@ static const struct file_operations g_batteryops =
static int battery_gauge_notify(FAR struct battery_gauge_priv_s *priv, static int battery_gauge_notify(FAR struct battery_gauge_priv_s *priv,
uint32_t mask) uint32_t mask)
{ {
FAR struct pollfd *fd = priv->fds; FAR struct pollfd *fds = priv->fds;
int semcnt; int semcnt;
int ret; int ret;
if (!fd)
{
return OK;
}
ret = nxmutex_lock(&priv->lock); ret = nxmutex_lock(&priv->lock);
if (ret < 0) if (ret < 0)
{ {
@@ -123,7 +118,7 @@ static int battery_gauge_notify(FAR struct battery_gauge_priv_s *priv,
priv->mask |= mask; priv->mask |= mask;
if (priv->mask) if (priv->mask)
{ {
poll_notify(&fd, 1, POLLIN); poll_notify(&fds, 1, POLLIN);
nxsem_get_value(&priv->wait, &semcnt); nxsem_get_value(&priv->wait, &semcnt);
if (semcnt < 1) if (semcnt < 1)
@@ -391,6 +386,10 @@ static int bat_gauge_poll(FAR struct file *filep,
{ {
priv->fds = fds; priv->fds = fds;
fds->priv = &priv->fds; fds->priv = &priv->fds;
if (priv->mask)
{
poll_notify(&fds, 1, POLLIN);
}
} }
else else
{ {
@@ -404,12 +403,6 @@ static int bat_gauge_poll(FAR struct file *filep,
} }
nxmutex_unlock(&priv->lock); nxmutex_unlock(&priv->lock);
if (setup)
{
battery_gauge_notify(priv, 0);
}
return ret; return ret;
} }
+6 -13
View File
@@ -104,15 +104,10 @@ static const struct file_operations g_batteryops =
static int battery_monitor_notify(FAR struct battery_monitor_priv_s *priv, static int battery_monitor_notify(FAR struct battery_monitor_priv_s *priv,
uint32_t mask) uint32_t mask)
{ {
FAR struct pollfd *fd = priv->fds; FAR struct pollfd *fds = priv->fds;
int semcnt; int semcnt;
int ret; int ret;
if (!fd)
{
return OK;
}
ret = nxmutex_lock(&priv->lock); ret = nxmutex_lock(&priv->lock);
if (ret < 0) if (ret < 0)
{ {
@@ -122,7 +117,7 @@ static int battery_monitor_notify(FAR struct battery_monitor_priv_s *priv,
priv->mask |= mask; priv->mask |= mask;
if (priv->mask) if (priv->mask)
{ {
poll_notify(&fd, 1, POLLIN); poll_notify(&fds, 1, POLLIN);
nxsem_get_value(&priv->wait, &semcnt); nxsem_get_value(&priv->wait, &semcnt);
if (semcnt < 1) if (semcnt < 1)
@@ -470,6 +465,10 @@ static int bat_monitor_poll(FAR struct file *filep,
{ {
priv->fds = fds; priv->fds = fds;
fds->priv = &priv->fds; fds->priv = &priv->fds;
if (priv->mask)
{
poll_notify(&fds, 1, POLLIN);
}
} }
else else
{ {
@@ -483,12 +482,6 @@ static int bat_monitor_poll(FAR struct file *filep,
} }
nxmutex_unlock(&priv->lock); nxmutex_unlock(&priv->lock);
if (setup)
{
battery_monitor_notify(priv, 0);
}
return ret; return ret;
} }
+10 -10
View File
@@ -67,7 +67,7 @@ struct lirc_fh_s
struct list_node node; /* list of open file handles */ struct list_node node; /* list of open file handles */
FAR struct lirc_lowerhalf_s *lower; /* the pointer to lirc_lowerhalf_s */ FAR struct lirc_lowerhalf_s *lower; /* the pointer to lirc_lowerhalf_s */
struct circbuf_s buffer; /* buffer for incoming IR */ struct circbuf_s buffer; /* buffer for incoming IR */
FAR struct pollfd *fd; /* poll structures of threads waiting for driver events */ FAR struct pollfd *fds; /* poll structures of threads waiting for driver events */
sem_t waitsem; /* sem of wait buffer for ready */ sem_t waitsem; /* sem of wait buffer for ready */
int carrier_low; /* when setting the carrier range, first the low end must be int carrier_low; /* when setting the carrier range, first the low end must be
* set with an ioctl and then the high end with another ioctl * set with an ioctl and then the high end with another ioctl
@@ -85,7 +85,7 @@ static int lirc_open(FAR struct file *filep);
static int lirc_close(FAR struct file *filep); static int lirc_close(FAR struct file *filep);
static int lirc_ioctl(FAR struct file *filep, int cmd, unsigned long arg); static int lirc_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int lirc_poll(FAR struct file *filep, FAR struct pollfd *fds, static int lirc_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup); bool setup);
static ssize_t lirc_write(FAR struct file *filep, FAR const char *buffer, static ssize_t lirc_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen); size_t buflen);
static ssize_t lirc_read(FAR struct file *filep, FAR char *buffer, static ssize_t lirc_read(FAR struct file *filep, FAR char *buffer,
@@ -216,21 +216,21 @@ static int lirc_poll(FAR struct file *filep,
flags = enter_critical_section(); flags = enter_critical_section();
if (setup) if (setup)
{ {
if (fh->fd) if (fh->fds)
{ {
ret = -EBUSY; ret = -EBUSY;
goto errout; goto errout;
} }
fh->fd = fds; fh->fds = fds;
fds->priv = &fh->fd; fds->priv = &fh->fds;
if (!circbuf_is_empty(&fh->buffer)) if (!circbuf_is_empty(&fh->buffer))
{ {
eventset |= POLLIN | POLLRDNORM; eventset |= POLLIN | POLLRDNORM;
} }
poll_notify(&fh->fd, 1, eventset); poll_notify(&fds, 1, eventset);
} }
else if (fds->priv != NULL) else if (fds->priv != NULL)
{ {
@@ -914,7 +914,7 @@ void lirc_raw_event(FAR struct lirc_lowerhalf_s *lower,
fh = (FAR struct lirc_fh_s *)node; fh = (FAR struct lirc_fh_s *)node;
if (circbuf_write(&fh->buffer, &gap, sizeof(int)) > 0) if (circbuf_write(&fh->buffer, &gap, sizeof(int)) > 0)
{ {
poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM); poll_notify(&fh->fds, 1, POLLIN | POLLRDNORM);
nxsem_get_value(&fh->waitsem, &semcount); nxsem_get_value(&fh->waitsem, &semcount);
if (semcount < 1) if (semcount < 1)
{ {
@@ -944,7 +944,7 @@ void lirc_raw_event(FAR struct lirc_lowerhalf_s *lower,
if (circbuf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0) if (circbuf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0)
{ {
poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM); poll_notify(&fh->fds, 1, POLLIN | POLLRDNORM);
nxsem_get_value(&fh->waitsem, &semcount); nxsem_get_value(&fh->waitsem, &semcount);
if (semcount < 1) if (semcount < 1)
{ {
@@ -988,7 +988,7 @@ void lirc_scancode_event(FAR struct lirc_lowerhalf_s *lower,
fh = (FAR struct lirc_fh_s *)node; fh = (FAR struct lirc_fh_s *)node;
if (circbuf_write(&fh->buffer, lsc, sizeof(*lsc)) > 0) if (circbuf_write(&fh->buffer, lsc, sizeof(*lsc)) > 0)
{ {
poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM); poll_notify(&fh->fds, 1, POLLIN | POLLRDNORM);
nxsem_get_value(&fh->waitsem, &semcount); nxsem_get_value(&fh->waitsem, &semcount);
if (semcount < 1) if (semcount < 1)
{ {
@@ -1034,7 +1034,7 @@ void lirc_sample_event(FAR struct lirc_lowerhalf_s *lower,
fh = (FAR struct lirc_fh_s *)node; fh = (FAR struct lirc_fh_s *)node;
if (circbuf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0) if (circbuf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0)
{ {
poll_notify(&fh->fd, 1, POLLIN | POLLRDNORM); poll_notify(&fh->fds, 1, POLLIN | POLLRDNORM);
nxsem_get_value(&fh->waitsem, &semcount); nxsem_get_value(&fh->waitsem, &semcount);
if (semcount < 1) if (semcount < 1)
{ {
+1 -1
View File
@@ -386,7 +386,7 @@ static int gps_poll(FAR struct file *filep, FAR struct pollfd *fds,
fds->priv = filep; fds->priv = filep;
if (upper->buffer.head > user->pos) if (upper->buffer.head > user->pos)
{ {
poll_notify(&user->fds, 1, POLLIN); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (user->fds) else if (user->fds)
+1 -1
View File
@@ -332,7 +332,7 @@ static int hcsr04_poll(FAR struct file *filep, FAR struct pollfd *fds,
flags = enter_critical_section(); flags = enter_critical_section();
if (hcsr04_sample(priv)) if (hcsr04_sample(priv))
{ {
poll_notify(priv->fds, CONFIG_HCSR04_NPOLLWAITERS, POLLIN); poll_notify(&fds, 1, POLLIN);
} }
leave_critical_section(flags); leave_critical_section(flags);
+1 -1
View File
@@ -1115,7 +1115,7 @@ static int hts221_poll(FAR struct file *filep, FAR struct pollfd *fds,
flags = enter_critical_section(); flags = enter_critical_section();
if (priv->int_pending || hts221_sample(priv)) if (priv->int_pending || hts221_sample(priv))
{ {
poll_notify(priv->fds, CONFIG_HTS221_NPOLLWAITERS, POLLIN); poll_notify(&fds, 1, POLLIN);
} }
leave_critical_section(flags); leave_critical_section(flags);
+18 -16
View File
@@ -108,38 +108,40 @@ static int lis2dh_open(FAR struct file *filep);
static int lis2dh_close(FAR struct file *filep); static int lis2dh_close(FAR struct file *filep);
static ssize_t lis2dh_read(FAR struct file *, FAR char *, size_t); static ssize_t lis2dh_read(FAR struct file *, FAR char *, size_t);
static ssize_t lis2dh_write(FAR struct file *filep, static ssize_t lis2dh_write(FAR struct file *filep,
FAR const char *buffer, size_t buflen); FAR const char *buffer, size_t buflen);
static int lis2dh_ioctl(FAR struct file *filep, int cmd, static int lis2dh_ioctl(FAR struct file *filep, int cmd,
unsigned long arg); unsigned long arg);
static int lis2dh_access(FAR struct lis2dh_dev_s *dev, static int lis2dh_access(FAR struct lis2dh_dev_s *dev,
uint8_t subaddr, FAR uint8_t *buf, int length); uint8_t subaddr, FAR uint8_t *buf,
int length);
static int lis2dh_get_reading(FAR struct lis2dh_dev_s *dev, static int lis2dh_get_reading(FAR struct lis2dh_dev_s *dev,
FAR struct lis2dh_vector_s *res, bool force_read); FAR struct lis2dh_vector_s *res,
bool force_read);
static int lis2dh_powerdown(FAR struct lis2dh_dev_s *dev); static int lis2dh_powerdown(FAR struct lis2dh_dev_s *dev);
static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev); static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev);
static int lis2dh_poll(FAR struct file *filep, static int lis2dh_poll(FAR struct file *filep,
FAR struct pollfd *fds, bool setup); FAR struct pollfd *fds, bool setup);
static int lis2dh_int_handler(int irq, FAR void *context, static int lis2dh_int_handler(int irq, FAR void *context,
FAR void *arg); FAR void *arg);
static int lis2dh_setup(FAR struct lis2dh_dev_s *dev, static int lis2dh_setup(FAR struct lis2dh_dev_s *dev,
FAR struct lis2dh_setup *new_setup); FAR struct lis2dh_setup *new_setup);
static inline int16_t lis2dh_raw_to_mg(uint8_t raw_hibyte, static inline int16_t lis2dh_raw_to_mg(uint8_t raw_hibyte,
uint8_t raw_lobyte, int scale); uint8_t raw_lobyte, int scale);
static int lis2dh_read_temp(FAR struct lis2dh_dev_s *dev, static int lis2dh_read_temp(FAR struct lis2dh_dev_s *dev,
FAR int16_t *temper); FAR int16_t *temper);
static int lis2dh_clear_interrupts(FAR struct lis2dh_dev_s *priv, static int lis2dh_clear_interrupts(FAR struct lis2dh_dev_s *priv,
uint8_t interrupts); uint8_t interrupts);
static unsigned int lis2dh_get_fifo_readings(FAR struct lis2dh_dev_s *priv, static unsigned int lis2dh_get_fifo_readings(FAR struct lis2dh_dev_s *priv,
FAR struct lis2dh_result *res, FAR struct lis2dh_result *res,
unsigned int readcount, unsigned int readcount,
FAR int *perr); FAR int *perr);
#ifdef CONFIG_LIS2DH_DRIVER_SELFTEST #ifdef CONFIG_LIS2DH_DRIVER_SELFTEST
static int lis2dh_handle_selftest(FAR struct lis2dh_dev_s *priv); static int lis2dh_handle_selftest(FAR struct lis2dh_dev_s *priv);
static int16_t lis2dh_raw_convert_to_12bit(uint8_t raw_hibyte, static int16_t lis2dh_raw_convert_to_12bit(uint8_t raw_hibyte,
uint8_t raw_lobyte); uint8_t raw_lobyte);
static FAR const struct lis2dh_vector_s * static FAR const struct lis2dh_vector_s *
lis2dh_get_raw_readings(FAR struct lis2dh_dev_s *dev, lis2dh_get_raw_readings(FAR struct lis2dh_dev_s *dev,
FAR int *err); FAR int *err);
#endif #endif
/**************************************************************************** /****************************************************************************
@@ -713,7 +715,7 @@ static int lis2dh_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->int_pending) if (priv->int_pending)
{ {
poll_notify(priv->fds, CONFIG_LIS2DH_NPOLLWAITERS, POLLIN); poll_notify(&fds, 1, POLLIN);
} }
} }
else if (fds->priv) else if (fds->priv)
+2 -1
View File
@@ -828,7 +828,8 @@ static int max44009_poll(FAR struct file *filep, FAR struct pollfd *fds,
if (priv->int_pending) if (priv->int_pending)
{ {
max44009_notify(priv); poll_notify(&fds, 1, POLLIN);
priv->int_pending = false;
} }
} }
else if (fds->priv) else if (fds->priv)
+1 -1
View File
@@ -936,7 +936,7 @@ static int sensor_poll(FAR struct file *filep,
eventset |= POLLPRI; eventset |= POLLPRI;
} }
sensor_pollnotify_one(user, eventset); poll_notify(&fds, 1, eventset);
} }
else else
{ {
+3 -3
View File
@@ -1617,8 +1617,8 @@ static int uart_poll(FAR struct file *filep,
{ {
/* Bind the poll structure and this slot */ /* Bind the poll structure and this slot */
dev->fds[i] = fds; dev->fds[i] = fds;
fds->priv = &dev->fds[i]; fds->priv = &dev->fds[i];
break; break;
} }
} }
@@ -1678,7 +1678,7 @@ static int uart_poll(FAR struct file *filep,
} }
#endif #endif
poll_notify(dev->fds, CONFIG_SERIAL_NPOLLWAITERS, eventset); poll_notify(&fds, 1, eventset);
} }
else if (fds->priv != NULL) else if (fds->priv != NULL)
{ {
+3 -3
View File
@@ -369,8 +369,8 @@ static int uart_bth4_poll(FAR struct file *filep, FAR struct pollfd *fds,
{ {
/* Bind the poll structure and this slot */ /* Bind the poll structure and this slot */
dev->fds[i] = fds; dev->fds[i] = fds;
fds->priv = &dev->fds[i]; fds->priv = &dev->fds[i];
break; break;
} }
} }
@@ -388,7 +388,7 @@ static int uart_bth4_poll(FAR struct file *filep, FAR struct pollfd *fds,
eventset |= POLLOUT; eventset |= POLLOUT;
uart_bth4_pollnotify(dev, eventset); poll_notify(&fds, 1, eventset);
} }
else if (fds->priv != NULL) else if (fds->priv != NULL)
{ {
+1 -1
View File
@@ -1209,7 +1209,7 @@ uart_bth5_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
nxmutex_unlock(&dev->recvlock); nxmutex_unlock(&dev->recvlock);
eventset |= POLLOUT; eventset |= POLLOUT;
uart_bth5_pollnotify(dev, eventset); poll_notify(&fds, 1, eventset);
} }
else if (fds->priv != NULL) else if (fds->priv != NULL)
{ {
+1 -1
View File
@@ -490,7 +490,7 @@ static int spi_slave_poll(FAR struct file *filep, FAR struct pollfd *fds,
eventset |= POLLOUT; eventset |= POLLOUT;
} }
poll_notify(&priv->fds, 1, eventset); poll_notify(&fds, 1, eventset);
} }
else if (fds->priv != NULL) else if (fds->priv != NULL)
{ {

Some files were not shown because too many files have changed in this diff Show More