Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions arch/arm/src/imx9/imx9_flexcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ struct imx9_driver_s
struct flexcan_timeseg data_timing; /* Timing for data phase */

const struct flexcan_config_s *config;
spinlock_t lock;

#ifdef CONFIG_NET_CAN_RAW_TX_DEADLINE
struct txmbstats txmb[TXMBCOUNT];
Expand Down Expand Up @@ -811,7 +812,8 @@ static int imx9_txpoll(struct net_driver_s *dev)
* the field d_len is set to a value > 0.
*/

flags = spin_lock_irqsave(NULL);
flags = spin_lock_irqsave(&priv->lock);
Comment thread
xiaoxiang781216 marked this conversation as resolved.
sched_lock();

if (priv->dev.d_len > 0)
{
Expand All @@ -827,12 +829,14 @@ static int imx9_txpoll(struct net_driver_s *dev)

if (imx9_txringfull(priv))
{
spin_unlock_irqrestore(NULL, flags);
sched_unlock();
spin_unlock_irqrestore(&priv->lock, flags);
return -EBUSY;
}
}

spin_unlock_irqrestore(NULL, flags);
sched_unlock();
spin_unlock_irqrestore(&priv->lock, flags);

/* If zero is returned, the polling will continue until all connections
* have been examined.
Expand Down Expand Up @@ -1642,7 +1646,7 @@ static int imx9_init_eccram(struct imx9_driver_s *priv)
uint32_t regval;
irqstate_t flags;

flags = enter_critical_section();
flags = spin_lock_irqsave(&priv->lock);

regval = getreg32(priv->base + IMX9_CAN_CTRL2_OFFSET);

Expand All @@ -1668,7 +1672,7 @@ static int imx9_init_eccram(struct imx9_driver_s *priv)

regval &= ~CAN_CTRL2_WRMFRZ;

leave_critical_section(flags);
spin_unlock_irqrestore(&priv->lock, flags);

return 0;
}
Expand Down Expand Up @@ -2105,6 +2109,7 @@ int imx9_caninitialize(int intf)
priv->dev.d_ioctl = imx9_ioctl; /* Support CAN ioctl() calls */
#endif
priv->dev.d_private = (void *)priv; /* Used to recover private state from dev */
spin_lock_init(&priv->lock);

/* Put the interface in the down state. This usually amounts to resetting
* the device and/or calling imx9_ifdown().
Expand Down
3 changes: 1 addition & 2 deletions boards/arm/at32/at32f437-mini/src/at32_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@
* Private Data
****************************************************************************/

static spinlock_t g_ethmac_lock = SP_UNLOCKED;

#ifdef HAVE_NETMONITOR
static spinlock_t g_ethmac_lock = SP_UNLOCKED;
static xcpt_t g_ethmac_handler;
static void *g_ethmac_arg;
#endif
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/imxrt/imxrt1020-evk/src/imxrt_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
* Private Data
****************************************************************************/

#ifdef GPIO_ENET_IRQ
static spinlock_t g_phy_lock = SP_UNLOCKED;
#endif

/****************************************************************************
* Private Functions
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/imxrt/imxrt1050-evk/src/imxrt_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@
* Private Data
****************************************************************************/

#ifdef CONFIG_IMXRT_GPIO1_0_15_IRQ
static spinlock_t g_phy_lock = SP_UNLOCKED;
#endif

/****************************************************************************
* Private Functions
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/imxrt/imxrt1060-evk/src/imxrt_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@
* Private Data
****************************************************************************/

#ifdef CONFIG_IMXRT_GPIO1_0_15_IRQ
static spinlock_t g_phy_lock = SP_UNLOCKED;
#endif

/****************************************************************************
* Private Functions
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/imxrt/imxrt1064-evk/src/imxrt_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@
* Private Data
****************************************************************************/

#ifdef CONFIG_IMXRT_GPIO1_0_15_IRQ
static spinlock_t g_phy_lock = SP_UNLOCKED;
#endif

/****************************************************************************
* Private Functions
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/imxrt/teensy-4.x/src/imxrt_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@
* Private Data
****************************************************************************/

#ifdef CONFIG_IMXRT_GPIO1_0_15_IRQ
static spinlock_t g_phy_lock = SP_UNLOCKED;
#endif

/****************************************************************************
* Private Functions
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/sama5/sama5d2-xult/src/sam_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@
* Private Data
****************************************************************************/

#ifdef CONFIG_SAMA5_PIOE_IRQ
static spinlock_t g_phy_lock = SP_UNLOCKED;
#endif

/****************************************************************************
* Private Functions
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/sama5/sama5d3x-ek/src/sam_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@
* Private Data
****************************************************************************/

#ifdef CONFIG_SAMA5_PIOE_IRQ
static spinlock_t g_phy_lock = SP_UNLOCKED;
#endif

/****************************************************************************
* Private Functions
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/samv7/same70-xplained/src/sam_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
* Private Data
****************************************************************************/

#ifdef CONFIG_SAMV7_GPIOA_IRQ
static spinlock_t g_phy_lock = SP_UNLOCKED;
#endif

/****************************************************************************
* Private Functions
Expand Down
2 changes: 2 additions & 0 deletions boards/arm/samv7/samv71-xult/src/sam_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
* Private Data
****************************************************************************/

#ifdef CONFIG_SAMV7_GPIOA_IRQ
static spinlock_t g_phy_lock = SP_UNLOCKED;
#endif

/****************************************************************************
* Private Functions
Expand Down
3 changes: 1 addition & 2 deletions boards/arm/stm32/stm32f4discovery/src/stm32_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@
* Private Data
****************************************************************************/

static spinlock_t g_phy_lock = SP_UNLOCKED;

#ifdef HAVE_NETMONITOR
static spinlock_t g_phy_lock = SP_UNLOCKED;
static xcpt_t g_ethmac_handler;
static void *g_ethmac_arg;
#endif
Expand Down