* [PATCH] net: tundra: tsi108: use spin_lock_irqsave instead of spin_lock_irq in IRQ context
@ 2019-08-07 7:43 Fuqian Huang
2019-08-09 5:17 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Fuqian Huang @ 2019-08-07 7:43 UTC (permalink / raw)
Cc: David S . Miller, netdev, linux-kernel, Fuqian Huang
As spin_unlock_irq will enable interrupts.
Function tsi108_stat_carry is called from interrupt handler tsi108_irq.
Interrupts are enabled in interrupt handler.
Use spin_lock_irqsave/spin_unlock_irqrestore instead of spin_(un)lock_irq
in IRQ context to avoid this.
Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
---
drivers/net/ethernet/tundra/tsi108_eth.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/tundra/tsi108_eth.c b/drivers/net/ethernet/tundra/tsi108_eth.c
index 78a7de3fb622..14215979d07e 100644
--- a/drivers/net/ethernet/tundra/tsi108_eth.c
+++ b/drivers/net/ethernet/tundra/tsi108_eth.c
@@ -372,8 +372,9 @@ static void tsi108_stat_carry(struct net_device *dev)
{
struct tsi108_prv_data *data = netdev_priv(dev);
u32 carry1, carry2;
+ unsigned long flags;
- spin_lock_irq(&data->misclock);
+ spin_lock_irqsave(&data->misclock, flags);
carry1 = TSI_READ(TSI108_STAT_CARRY1);
carry2 = TSI_READ(TSI108_STAT_CARRY2);
@@ -441,7 +442,7 @@ static void tsi108_stat_carry(struct net_device *dev)
TSI108_STAT_TXPAUSEDROP_CARRY,
&data->tx_pause_drop);
- spin_unlock_irq(&data->misclock);
+ spin_unlock_irqrestore(&data->misclock, flags);
}
/* Read a stat counter atomically with respect to carries.
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: tundra: tsi108: use spin_lock_irqsave instead of spin_lock_irq in IRQ context
2019-08-07 7:43 [PATCH] net: tundra: tsi108: use spin_lock_irqsave instead of spin_lock_irq in IRQ context Fuqian Huang
@ 2019-08-09 5:17 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-08-09 5:17 UTC (permalink / raw)
To: huangfq.daxian; +Cc: netdev, linux-kernel
From: Fuqian Huang <huangfq.daxian@gmail.com>
Date: Wed, 7 Aug 2019 15:43:00 +0800
> @@ -372,8 +372,9 @@ static void tsi108_stat_carry(struct net_device *dev)
> {
> struct tsi108_prv_data *data = netdev_priv(dev);
> u32 carry1, carry2;
> + unsigned long flags;
Please preserve reverse christmas tree ordering of local variables.
Thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-09 5:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07 7:43 [PATCH] net: tundra: tsi108: use spin_lock_irqsave instead of spin_lock_irq in IRQ context Fuqian Huang
2019-08-09 5:17 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).