Thread (43 messages) flat view 43 messages, 3 authors, 2020-05-14

Re: [PATCH V5 10/19] net: ks8851: Factor out bus lock handling

From: Andrew Lunn <andrew@lunn.ch>
Date: 2020-05-14 01:20:02

On Thu, May 14, 2020 at 02:07:38AM +0200, Marek Vasut wrote:
Pull out bus access locking code into separate functions, this is done
in preparation for unifying the driver with the parallel bus one. The
parallel bus driver does not need heavy mutex locking of the bus and
works better with spinlocks, hence prepare these locking functions to
be overridden then.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <redacted>
Cc: YueHaibing <redacted>
  
+/**
+ * ks8851_lock - register access lock
+ * @ks: The chip state
+ * @flags: Spinlock flags
+ *
+ * Claim chip register access lock
+ */
+static void ks8851_lock(struct ks8851_net *ks, unsigned long *flags)
+{
+	mutex_lock(&ks->lock);
+}
Do you actually need flags? It is for spin_lock_irqsave().  Which you
use when you have a critical section inside an interrupt handler. But
a mutex cannot protect against an interrupt handler. So there should
be no need to use spin_lock_irqsave(), spin_lock() should be enough,
and that does not need flags.

   Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help