This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit ff4d53a86e607cbe918576a85f0cbaa7bed5a8d2 Author: liaoao <[email protected]> AuthorDate: Fri Jun 27 13:54:27 2025 +0800 gpio.c: in case of set but not used build error Only keep the sigwork_s member and the work pointer used to cancel the notification when CONFIG_SIG_EVTHREAD is enabled, otherwise the build fails with: drivers/ioexpander/gpio.c:461:43: error: variable 'work' set but not used [-Werror=unused-but-set-variable] Signed-off-by: liaoao <[email protected]> --- drivers/ioexpander/gpio.c | 8 ++++++++ include/nuttx/ioexpander/gpio.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/drivers/ioexpander/gpio.c b/drivers/ioexpander/gpio.c index cb4e2f3aeed..2e2a40a7f8e 100644 --- a/drivers/ioexpander/gpio.c +++ b/drivers/ioexpander/gpio.c @@ -543,8 +543,12 @@ static int gpio_handler(FAR struct gpio_dev_s *dev, uint8_t pin) break; } +# ifdef CONFIG_SIG_EVTHREAD nxsig_notification(signal->gp_pid, &signal->gp_event, SI_QUEUE, &signal->gp_work); +# else + nxsig_notification(signal->gp_pid, &signal->gp_event, SI_QUEUE, NULL); +# endif } #endif @@ -898,7 +902,9 @@ static int gpio_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { if (pid == dev->gp_signals[i].gp_pid) { +# ifdef CONFIG_SIG_EVTHREAD FAR struct sigwork_s *work; +# endif for (j = i + 1; j < CONFIG_DEV_GPIO_NSIGNALS; j++) { @@ -915,10 +921,12 @@ static int gpio_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } dev->gp_signals[j].gp_pid = 0; +# ifdef CONFIG_SIG_EVTHREAD work = &dev->gp_signals[j].gp_work; spin_unlock_irqrestore(&dev->lock, flags); nxsig_cancel_notification(work); flags = spin_lock_irqsave(&dev->lock); +# endif break; } } diff --git a/include/nuttx/ioexpander/gpio.h b/include/nuttx/ioexpander/gpio.h index de656e5a21f..577a7b4b637 100644 --- a/include/nuttx/ioexpander/gpio.h +++ b/include/nuttx/ioexpander/gpio.h @@ -182,7 +182,9 @@ struct gpio_operations_s struct gpio_signal_s { struct sigevent gp_event; +#ifdef CONFIG_SIG_EVTHREAD struct sigwork_s gp_work; +#endif pid_t gp_pid; /* The task to be signaled */ };
