Skip to content

Commit ca3943c

Browse files
committed
Merge tag 'linux-can-fixes-for-4.17-20180510' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
Marc Kleine-Budde says: ==================== this is a pull request for net/master consisting of 2 patches. Both patches are from Lukas Wunner and fix two problems found in the hi311x CAN driver under high load situations. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 2fdae03 + 32bee8f commit ca3943c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/net/can/spi/hi311x.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
#define HI3110_STAT_BUSOFF BIT(2)
9292
#define HI3110_STAT_ERRP BIT(3)
9393
#define HI3110_STAT_ERRW BIT(4)
94+
#define HI3110_STAT_TXMTY BIT(7)
9495

9596
#define HI3110_BTR0_SJW_SHIFT 6
9697
#define HI3110_BTR0_BRP_SHIFT 0
@@ -427,8 +428,10 @@ static int hi3110_get_berr_counter(const struct net_device *net,
427428
struct hi3110_priv *priv = netdev_priv(net);
428429
struct spi_device *spi = priv->spi;
429430

431+
mutex_lock(&priv->hi3110_lock);
430432
bec->txerr = hi3110_read(spi, HI3110_READ_TEC);
431433
bec->rxerr = hi3110_read(spi, HI3110_READ_REC);
434+
mutex_unlock(&priv->hi3110_lock);
432435

433436
return 0;
434437
}
@@ -735,10 +738,7 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id)
735738
}
736739
}
737740

738-
if (intf == 0)
739-
break;
740-
741-
if (intf & HI3110_INT_TXCPLT) {
741+
if (priv->tx_len && statf & HI3110_STAT_TXMTY) {
742742
net->stats.tx_packets++;
743743
net->stats.tx_bytes += priv->tx_len - 1;
744744
can_led_event(net, CAN_LED_EVENT_TX);
@@ -748,6 +748,9 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id)
748748
}
749749
netif_wake_queue(net);
750750
}
751+
752+
if (intf == 0)
753+
break;
751754
}
752755
mutex_unlock(&priv->hi3110_lock);
753756
return IRQ_HANDLED;

0 commit comments

Comments
 (0)