mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
board_button_irq: Button IRQ logic no longer returns the xcpt_t oldhandler. There value is useless and dangerous after the recent changes to interrupt argument passing.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/sam4e-ek/src/sam_buttons.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@@ -59,20 +60,11 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
|
||||
#define HAVE_IRQBUTTONS 1
|
||||
#ifndef CONFIG_SAMV7_GPIOA_IRQ
|
||||
# undef HAVE_IRQBUTTONS
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMV7_GPIOA_IRQ
|
||||
static xcpt_t g_irq_sw0;
|
||||
#endif
|
||||
# define HAVE_IRQBUTTONS 1
|
||||
# ifndef CONFIG_SAMV7_GPIOA_IRQ
|
||||
# undef HAVE_IRQBUTTONS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@@ -88,10 +80,9 @@ static xcpt_t g_irq_sw0;
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_IRQBUTTONS
|
||||
static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, xcpt_t *store, void *arg)
|
||||
static int board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, void *arg)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the following
|
||||
@@ -100,11 +91,6 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Get the old button interrupt handler and save the new one */
|
||||
|
||||
oldhandler = *store;
|
||||
*store = irqhandler;
|
||||
|
||||
/* Are we attaching or detaching? */
|
||||
|
||||
if (irqhandler != NULL)
|
||||
@@ -124,10 +110,7 @@ static xcpt_t board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
|
||||
/* Return the old button handler (so that it can be restored) */
|
||||
|
||||
return oldhandler;
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -187,17 +170,16 @@ uint8_t board_buttons(void)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
#ifdef HAVE_IRQBUTTONS
|
||||
if (id == BUTTON_SW0)
|
||||
{
|
||||
return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, &g_irq_sw0, arg);
|
||||
return board_button_irqx(GPIO_SW0, IRQ_SW0, irqhandler, arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user