nuttx/drivers: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()

This commit is contained in:
Gregory Nutt
2016-02-14 07:32:58 -06:00
parent d09db96a7c
commit 2244ed46bc
45 changed files with 386 additions and 400 deletions
+4 -4
View File
@@ -861,7 +861,7 @@ static int cs89x0_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = irqsave();
flags = enter_critical_section();
up_disable_irq(CONFIG_CS89x0_IRQ);
/* Cancel the TX poll timer and TX timeout timers */
@@ -872,7 +872,7 @@ static int cs89x0_ifdown(struct net_driver_s *dev)
/* Reset the device */
cs89x0->cs_bifup = false;
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
@@ -900,7 +900,7 @@ static int cs89x0_txavail(struct net_driver_s *dev)
struct cs89x0_driver_s *cs89x0 = (struct cs89x0_driver_s *)dev->d_private;
irqstate_t flags;
flags = irqsave();
flags = enter_critical_section();
/* Ignore the notification if the interface is not yet up */
@@ -914,7 +914,7 @@ static int cs89x0_txavail(struct net_driver_s *dev)
(void)devif_poll(&cs89x0->cs_dev, cs89x0_txpoll);
}
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
+4 -4
View File
@@ -1411,7 +1411,7 @@ static int dm9x_ifdown(struct net_driver_s *dev)
/* Disable the DM9X interrupt */
flags = irqsave();
flags = enter_critical_section();
up_disable_irq(CONFIG_DM9X_IRQ);
/* Cancel the TX poll timer and TX timeout timers */
@@ -1428,7 +1428,7 @@ static int dm9x_ifdown(struct net_driver_s *dev)
putreg(DM9X_ISR, DM9X_INT_ALL); /* Clear interrupt status */
dm9x->dm_bifup = false;
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
@@ -1457,7 +1457,7 @@ static int dm9x_txavail(struct net_driver_s *dev)
irqstate_t flags;
ndbg("Polling\n");
flags = irqsave();
flags = enter_critical_section();
/* Ignore the notification if the interface is not yet up */
@@ -1475,7 +1475,7 @@ static int dm9x_txavail(struct net_driver_s *dev)
(void)devif_poll(&dm9x->dm_dev, dm9x_txpoll);
}
}
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
+4 -4
View File
@@ -847,7 +847,7 @@ static int e1000_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = irqsave();
flags = enter_critical_section();
e1000_turn_off(e1000);
@@ -866,7 +866,7 @@ static int e1000_ifdown(struct net_driver_s *dev)
/* Mark the device "down" */
e1000->bifup = false;
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
@@ -900,7 +900,7 @@ static int e1000_txavail(struct net_driver_s *dev)
* level processing.
*/
flags = irqsave();
flags = enter_critical_section();
/* Ignore the notification if the interface is not yet up */
@@ -914,7 +914,7 @@ static int e1000_txavail(struct net_driver_s *dev)
}
}
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
+5 -5
View File
@@ -55,8 +55,8 @@
#include <arpa/inet.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/wdog.h>
#include <nuttx/spi/spi.h>
#include <nuttx/wqueue.h>
@@ -2149,7 +2149,7 @@ static int enc_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = irqsave();
flags = enter_critical_section();
priv->lower->disable(priv->lower);
/* Cancel the TX poll timer and TX timeout timers */
@@ -2163,7 +2163,7 @@ static int enc_ifdown(struct net_driver_s *dev)
enc_pwrsave(priv);
priv->ifstate = ENCSTATE_DOWN;
irqrestore(flags);
leave_critical_section(flags);
/* Un-lock the SPI bus */
@@ -2201,7 +2201,7 @@ static int enc_txavail(struct net_driver_s *dev)
/* Ignore the notification if the interface is not yet up */
flags = irqsave();
flags = enter_critical_section();
if (priv->ifstate == ENCSTATE_UP)
{
/* Check if the hardware is ready to send another packet. The driver
@@ -2220,7 +2220,7 @@ static int enc_txavail(struct net_driver_s *dev)
/* Un-lock the SPI bus */
irqrestore(flags);
leave_critical_section(flags);
enc_unlock(priv);
return OK;
}
+4 -4
View File
@@ -2317,7 +2317,7 @@ static int enc_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = irqsave();
flags = enter_critical_section();
priv->lower->disable(priv->lower);
/* Cancel the TX poll timer and TX timeout timers */
@@ -2331,7 +2331,7 @@ static int enc_ifdown(struct net_driver_s *dev)
enc_pwrsave(priv);
priv->ifstate = ENCSTATE_DOWN;
irqrestore(flags);
leave_critical_section(flags);
/* Un-lock the SPI bus */
@@ -2370,7 +2370,7 @@ static int enc_txavail(struct net_driver_s *dev)
/* Ignore the notification if the interface is not yet up */
flags = irqsave();
flags = enter_critical_section();
if (priv->ifstate == ENCSTATE_RUNNING)
{
/* Check if the hardware is ready to send another packet. The driver
@@ -2389,7 +2389,7 @@ static int enc_txavail(struct net_driver_s *dev)
/* Un-lock the SPI bus */
irqrestore(flags);
leave_critical_section(flags);
enc_unlock(priv);
return OK;
+10 -10
View File
@@ -284,7 +284,7 @@ static int ftmac100_transmit(FAR struct ftmac100_driver_s *priv)
FAR struct ftmac100_txdes_s *txdes;
int len = priv->ft_dev.d_len;
//irqstate_t flags;
//flags = irqsave();
//flags = enter_critical_section();
//nvdbg("flags=%08x\n", flags);
txdes = ftmac100_current_txdes(priv);
@@ -323,7 +323,7 @@ static int ftmac100_transmit(FAR struct ftmac100_driver_s *priv)
(void)wd_start(priv->ft_txtimeout, FTMAC100_TXTIMEOUT,
ftmac100_txtimeout_expiry, 1, (wdparm_t)priv);
//irqrestore(flags);
//leave_critical_section(flags);
return OK;
}
@@ -981,11 +981,11 @@ static void ftmac100_interrupt_work(FAR void *arg)
/* Process pending Ethernet interrupts */
state = net_lock();
//flags = irqsave();
//flags = enter_critical_section();
ftmac100_interrupt_process(priv);
//irqrestore(flags);
//leave_critical_section(flags);
net_unlock(state);
/* Re-enable Ethernet interrupts */
@@ -1024,7 +1024,7 @@ static int ftmac100_interrupt(int irq, FAR void *context)
* condition here.
*/
flags = irqsave();
flags = enter_critical_section();
priv->status = getreg32 (&iobase->isr);
@@ -1055,7 +1055,7 @@ static int ftmac100_interrupt(int irq, FAR void *context)
work_queue(HPWORK, &priv->ft_work, ftmac100_interrupt_work, priv, 0);
irqrestore(flags);
leave_critical_section(flags);
#else
/* Process the interrupt now */
putreg32 (INT_MASK_ALL_DISABLED, &iobase->imr);
@@ -1374,7 +1374,7 @@ static int ftmac100_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = irqsave();
flags = enter_critical_section();
up_disable_irq(CONFIG_FTMAC100_IRQ);
/* Cancel the TX poll timer and TX timeout timers */
@@ -1392,7 +1392,7 @@ static int ftmac100_ifdown(struct net_driver_s *dev)
/* Mark the device "down" */
priv->ft_bifup = false;
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
@@ -1501,12 +1501,12 @@ static int ftmac100_txavail(struct net_driver_s *dev)
* level processing.
*/
flags = irqsave();
flags = enter_critical_section();
/* Perform the out-of-cycle poll now */
ftmac100_txavail_process(priv);
irqrestore(flags);
leave_critical_section(flags);
#endif
return OK;
+4 -4
View File
@@ -911,7 +911,7 @@ static int skel_ifdown(FAR struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = irqsave();
flags = enter_critical_section();
up_disable_irq(CONFIG_skeleton_IRQ);
/* Cancel the TX poll timer and TX timeout timers */
@@ -927,7 +927,7 @@ static int skel_ifdown(FAR struct net_driver_s *dev)
/* Mark the device "down" */
priv->sk_bifup = false;
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
@@ -1036,12 +1036,12 @@ static int skel_txavail(FAR struct net_driver_s *dev)
* level processing.
*/
flags = irqsave();
flags = enter_critical_section();
/* Perform the out-of-cycle poll now */
skel_txavail_process(priv);
irqrestore(flags);
leave_critical_section(flags);
#endif
return OK;
+4 -4
View File
@@ -584,7 +584,7 @@ static int vnet_ifdown(struct net_driver_s *dev)
/* Disable the Ethernet interrupt */
flags = irqsave();
flags = enter_critical_section();
/* Cancel the TX poll timer and TX timeout timers */
@@ -598,7 +598,7 @@ static int vnet_ifdown(struct net_driver_s *dev)
/* Mark the device "down" */
vnet->sk_bifup = false;
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
@@ -630,7 +630,7 @@ static int vnet_txavail(struct net_driver_s *dev)
* level processing.
*/
flags = irqsave();
flags = enter_critical_section();
/* Ignore the notification if the interface is not yet up */
@@ -652,7 +652,7 @@ static int vnet_txavail(struct net_driver_s *dev)
}
out:
irqrestore(flags);
leave_critical_section(flags);
return OK;
}