On 2022/3/23 04:49, Rob Herring wrote:
+/*
+ * ls7a_gpio_i2c_set - set the state of a gpio pin indicated by mask
+ * @mask: gpio pin mask
+ */
+static void ls7a_gpio_i2c_set(struct lsdc_i2c * const li2c, int mask, int state)
+{
+ unsigned long flags;
+ u8 val;
+
+ spin_lock_irqsave(&li2c->reglock, flags);
What are you protecting? Doesn't the caller serialize calls to these
functions?
This driver is ported from my work from my downstream work.
Maxime also ask this question before, but i did not answer.
He is right, protect single register access is not necessary.
uncached access have done the job itself.
so i remove it in V11 of my patch set.
There are two way GPIO emulated i2c, I want the code between
spin_lock_irqsave(&li2c->reglock, flags) and spin_unlock_irqrestore(&li2c->reglock, flags);
finished in a atomic way, without any disruption.
The two i2c should not have any influence each other.
I write it by gut feeling, and luckily it works very well in practice.