diff mbox series

i2c: busses: replace spin_lock_irqsave by spin_lock in hard IRQ

Message ID 20200909041001.5612-1-song.bao.hua@hisilicon.com (mailing list archive)
State New, archived
Headers show
Series i2c: busses: replace spin_lock_irqsave by spin_lock in hard IRQ | expand

Commit Message

Song Bao Hua (Barry Song) Sept. 9, 2020, 4:10 a.m. UTC
The code has been in a irq-disabled context since it is hard IRQ. There
is no necessity to do it again.

Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Akash Asthana <akashast@codeaurora.org>
Cc: Mukesh Savaliya <msavaliy@codeaurora.org>
Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
---
 drivers/i2c/busses/i2c-mv64xxx.c   | 5 ++---
 drivers/i2c/busses/i2c-owl.c       | 5 ++---
 drivers/i2c/busses/i2c-qcom-geni.c | 5 ++---
 3 files changed, 6 insertions(+), 9 deletions(-)

Comments

Akash Asthana Sept. 10, 2020, 11:40 a.m. UTC | #1
On 9/9/2020 9:40 AM, Barry Song wrote:
> The code has been in a irq-disabled context since it is hard IRQ. There
> is no necessity to do it again.
>
> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> Cc: "Andreas Färber" <afaerber@suse.de>
> Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Cc: Akash Asthana <akashast@codeaurora.org>
> Cc: Mukesh Savaliya <msavaliy@codeaurora.org>
> Cc: Andy Gross <agross@kernel.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
> ---
Reviewed-by: Akash Asthana <akashast@codeaurora.org>
>   drivers/i2c/busses/i2c-mv64xxx.c   | 5 ++---
>   drivers/i2c/busses/i2c-owl.c       | 5 ++---
>   drivers/i2c/busses/i2c-qcom-geni.c | 5 ++---
>   3 files changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> index 8d9d4ffdcd24..e0e45fc19b8f 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -496,11 +496,10 @@ static irqreturn_t
>   mv64xxx_i2c_intr(int irq, void *dev_id)
>   {
>   	struct mv64xxx_i2c_data	*drv_data = dev_id;
> -	unsigned long	flags;
>   	u32		status;
>   	irqreturn_t	rc = IRQ_NONE;
>   
> -	spin_lock_irqsave(&drv_data->lock, flags);
> +	spin_lock(&drv_data->lock);
>   
>   	if (drv_data->offload_enabled)
>   		rc = mv64xxx_i2c_intr_offload(drv_data);
> @@ -517,7 +516,7 @@ mv64xxx_i2c_intr(int irq, void *dev_id)
>   
>   		rc = IRQ_HANDLED;
>   	}
> -	spin_unlock_irqrestore(&drv_data->lock, flags);
> +	spin_unlock(&drv_data->lock);
>   
>   	return rc;
>   }
> diff --git a/drivers/i2c/busses/i2c-owl.c b/drivers/i2c/busses/i2c-owl.c
> index 672f1f239bd6..618d3013d0b6 100644
> --- a/drivers/i2c/busses/i2c-owl.c
> +++ b/drivers/i2c/busses/i2c-owl.c
> @@ -165,10 +165,9 @@ static irqreturn_t owl_i2c_interrupt(int irq, void *_dev)
>   {
>   	struct owl_i2c_dev *i2c_dev = _dev;
>   	struct i2c_msg *msg = i2c_dev->msg;
> -	unsigned long flags;
>   	unsigned int stat, fifostat;
>   
> -	spin_lock_irqsave(&i2c_dev->lock, flags);
> +	spin_lock(&i2c_dev->lock);
>   
>   	i2c_dev->err = 0;
>   
> @@ -208,7 +207,7 @@ static irqreturn_t owl_i2c_interrupt(int irq, void *_dev)
>   			   OWL_I2C_STAT_IRQP, true);
>   
>   	complete_all(&i2c_dev->msg_complete);
> -	spin_unlock_irqrestore(&i2c_dev->lock, flags);
> +	spin_unlock(&i2c_dev->lock);
>   
>   	return IRQ_HANDLED;
>   }
> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index dead5db3315a..8b4c35f47a70 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> @@ -210,9 +210,8 @@ static irqreturn_t geni_i2c_irq(int irq, void *dev)
>   	u32 dma;
>   	u32 val;
>   	struct i2c_msg *cur;
> -	unsigned long flags;
>   
> -	spin_lock_irqsave(&gi2c->lock, flags);
> +	spin_lock(&gi2c->lock);
>   	m_stat = readl_relaxed(base + SE_GENI_M_IRQ_STATUS);
>   	rx_st = readl_relaxed(base + SE_GENI_RX_FIFO_STATUS);
>   	dm_tx_st = readl_relaxed(base + SE_DMA_TX_IRQ_STAT);
> @@ -294,7 +293,7 @@ static irqreturn_t geni_i2c_irq(int irq, void *dev)
>   	    dm_rx_st & RX_DMA_DONE || dm_rx_st & RX_RESET_DONE)
>   		complete(&gi2c->done);
>   
> -	spin_unlock_irqrestore(&gi2c->lock, flags);
> +	spin_unlock(&gi2c->lock);
>   
>   	return IRQ_HANDLED;
>   }
Mukesh, Savaliya Sept. 10, 2020, 6:18 p.m. UTC | #2
On 9/9/2020 9:40 AM, Barry Song wrote:
> The code has been in a irq-disabled context since it is hard IRQ. There
> is no necessity to do it again.
>
> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> Cc: "Andreas Färber" <afaerber@suse.de>
> Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Cc: Akash Asthana <akashast@codeaurora.org>
> Cc: Mukesh Savaliya <msavaliy@codeaurora.org>
> Cc: Andy Gross <agross@kernel.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
> ---
Reviewed-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
>   drivers/i2c/busses/i2c-mv64xxx.c   | 5 ++---
>   drivers/i2c/busses/i2c-owl.c       | 5 ++---
>   drivers/i2c/busses/i2c-qcom-geni.c | 5 ++---
>   3 files changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> index 8d9d4ffdcd24..e0e45fc19b8f 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -496,11 +496,10 @@ static irqreturn_t
>   mv64xxx_i2c_intr(int irq, void *dev_id)
>   {
>   	struct mv64xxx_i2c_data	*drv_data = dev_id;
> -	unsigned long	flags;
>   	u32		status;
>   	irqreturn_t	rc = IRQ_NONE;
>   
> -	spin_lock_irqsave(&drv_data->lock, flags);
> +	spin_lock(&drv_data->lock);
>   
>   	if (drv_data->offload_enabled)
>   		rc = mv64xxx_i2c_intr_offload(drv_data);
> @@ -517,7 +516,7 @@ mv64xxx_i2c_intr(int irq, void *dev_id)
>   
>   		rc = IRQ_HANDLED;
>   	}
> -	spin_unlock_irqrestore(&drv_data->lock, flags);
> +	spin_unlock(&drv_data->lock);
>   
>   	return rc;
>   }
> diff --git a/drivers/i2c/busses/i2c-owl.c b/drivers/i2c/busses/i2c-owl.c
> index 672f1f239bd6..618d3013d0b6 100644
> --- a/drivers/i2c/busses/i2c-owl.c
> +++ b/drivers/i2c/busses/i2c-owl.c
> @@ -165,10 +165,9 @@ static irqreturn_t owl_i2c_interrupt(int irq, void *_dev)
>   {
>   	struct owl_i2c_dev *i2c_dev = _dev;
>   	struct i2c_msg *msg = i2c_dev->msg;
> -	unsigned long flags;
>   	unsigned int stat, fifostat;
>   
> -	spin_lock_irqsave(&i2c_dev->lock, flags);
> +	spin_lock(&i2c_dev->lock);
>   
>   	i2c_dev->err = 0;
>   
> @@ -208,7 +207,7 @@ static irqreturn_t owl_i2c_interrupt(int irq, void *_dev)
>   			   OWL_I2C_STAT_IRQP, true);
>   
>   	complete_all(&i2c_dev->msg_complete);
> -	spin_unlock_irqrestore(&i2c_dev->lock, flags);
> +	spin_unlock(&i2c_dev->lock);
>   
>   	return IRQ_HANDLED;
>   }
> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index dead5db3315a..8b4c35f47a70 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> @@ -210,9 +210,8 @@ static irqreturn_t geni_i2c_irq(int irq, void *dev)
>   	u32 dma;
>   	u32 val;
>   	struct i2c_msg *cur;
> -	unsigned long flags;
>   
> -	spin_lock_irqsave(&gi2c->lock, flags);
> +	spin_lock(&gi2c->lock);
>   	m_stat = readl_relaxed(base + SE_GENI_M_IRQ_STATUS);
>   	rx_st = readl_relaxed(base + SE_GENI_RX_FIFO_STATUS);
>   	dm_tx_st = readl_relaxed(base + SE_DMA_TX_IRQ_STAT);
> @@ -294,7 +293,7 @@ static irqreturn_t geni_i2c_irq(int irq, void *dev)
>   	    dm_rx_st & RX_DMA_DONE || dm_rx_st & RX_RESET_DONE)
>   		complete(&gi2c->done);
>   
> -	spin_unlock_irqrestore(&gi2c->lock, flags);
> +	spin_unlock(&gi2c->lock);
>   
>   	return IRQ_HANDLED;
>   }
Wolfram Sang Sept. 21, 2020, 9:34 a.m. UTC | #3
On Thu, Sep 10, 2020 at 05:10:20PM +0530, Akash Asthana wrote:
> 
> On 9/9/2020 9:40 AM, Barry Song wrote:
> > The code has been in a irq-disabled context since it is hard IRQ. There
> > is no necessity to do it again.
> > 
> > Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> > Cc: "Andreas Färber" <afaerber@suse.de>
> > Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > Cc: Akash Asthana <akashast@codeaurora.org>
> > Cc: Mukesh Savaliya <msavaliy@codeaurora.org>
> > Cc: Andy Gross <agross@kernel.org>
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
> > ---
> Reviewed-by: Akash Asthana <akashast@codeaurora.org>

Thanks! Did you review the whole patch or only the qcom-geni part?
(and please don't include the full message when you only reply to a part
of it).
Wolfram Sang Sept. 21, 2020, 9:39 a.m. UTC | #4
On Thu, Sep 10, 2020 at 11:48:02PM +0530, Mukesh, Savaliya wrote:
> 
> On 9/9/2020 9:40 AM, Barry Song wrote:
> > The code has been in a irq-disabled context since it is hard IRQ. There
> > is no necessity to do it again.
> > 
> > Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> > Cc: "Andreas Färber" <afaerber@suse.de>
> > Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > Cc: Akash Asthana <akashast@codeaurora.org>
> > Cc: Mukesh Savaliya <msavaliy@codeaurora.org>
> > Cc: Andy Gross <agross@kernel.org>
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
> > ---
> Reviewed-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>

Thanks! Did you review the whole patch or only the qcom-geni part?
(and please don't include the full message when you only reply to a part
of it).
Akash Asthana Sept. 21, 2020, 11:44 a.m. UTC | #5
Hi Wolfram,

On 9/21/2020 3:04 PM, Wolfram Sang wrote:
> On Thu, Sep 10, 2020 at 05:10:20PM +0530, Akash Asthana wrote:
>> On 9/9/2020 9:40 AM, Barry Song wrote:
>>> The code has been in a irq-disabled context since it is hard IRQ. There
>>> is no necessity to do it again.
>>>
>>> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
>>> Cc: "Andreas Färber" <afaerber@suse.de>
>>> Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>>> Cc: Akash Asthana <akashast@codeaurora.org>
>>> Cc: Mukesh Savaliya <msavaliy@codeaurora.org>
>>> Cc: Andy Gross <agross@kernel.org>
>>> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
>>> Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
>>> ---
>> Reviewed-by: Akash Asthana <akashast@codeaurora.org>
> Thanks! Did you review the whole patch or only the qcom-geni part?
I reviewed the whole patch.
> (and please don't include the full message when you only reply to a part
> of it).

Sure thanks.

Regards,

Akash
Wolfram Sang Sept. 29, 2020, 7:42 p.m. UTC | #6
On Wed, Sep 09, 2020 at 04:10:01PM +1200, Barry Song wrote:
> The code has been in a irq-disabled context since it is hard IRQ. There
> is no necessity to do it again.
> 
> Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
> Cc: "Andreas Färber" <afaerber@suse.de>
> Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Cc: Akash Asthana <akashast@codeaurora.org>
> Cc: Mukesh Savaliya <msavaliy@codeaurora.org>
> Cc: Andy Gross <agross@kernel.org>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 8d9d4ffdcd24..e0e45fc19b8f 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -496,11 +496,10 @@  static irqreturn_t
 mv64xxx_i2c_intr(int irq, void *dev_id)
 {
 	struct mv64xxx_i2c_data	*drv_data = dev_id;
-	unsigned long	flags;
 	u32		status;
 	irqreturn_t	rc = IRQ_NONE;
 
-	spin_lock_irqsave(&drv_data->lock, flags);
+	spin_lock(&drv_data->lock);
 
 	if (drv_data->offload_enabled)
 		rc = mv64xxx_i2c_intr_offload(drv_data);
@@ -517,7 +516,7 @@  mv64xxx_i2c_intr(int irq, void *dev_id)
 
 		rc = IRQ_HANDLED;
 	}
-	spin_unlock_irqrestore(&drv_data->lock, flags);
+	spin_unlock(&drv_data->lock);
 
 	return rc;
 }
diff --git a/drivers/i2c/busses/i2c-owl.c b/drivers/i2c/busses/i2c-owl.c
index 672f1f239bd6..618d3013d0b6 100644
--- a/drivers/i2c/busses/i2c-owl.c
+++ b/drivers/i2c/busses/i2c-owl.c
@@ -165,10 +165,9 @@  static irqreturn_t owl_i2c_interrupt(int irq, void *_dev)
 {
 	struct owl_i2c_dev *i2c_dev = _dev;
 	struct i2c_msg *msg = i2c_dev->msg;
-	unsigned long flags;
 	unsigned int stat, fifostat;
 
-	spin_lock_irqsave(&i2c_dev->lock, flags);
+	spin_lock(&i2c_dev->lock);
 
 	i2c_dev->err = 0;
 
@@ -208,7 +207,7 @@  static irqreturn_t owl_i2c_interrupt(int irq, void *_dev)
 			   OWL_I2C_STAT_IRQP, true);
 
 	complete_all(&i2c_dev->msg_complete);
-	spin_unlock_irqrestore(&i2c_dev->lock, flags);
+	spin_unlock(&i2c_dev->lock);
 
 	return IRQ_HANDLED;
 }
diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index dead5db3315a..8b4c35f47a70 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -210,9 +210,8 @@  static irqreturn_t geni_i2c_irq(int irq, void *dev)
 	u32 dma;
 	u32 val;
 	struct i2c_msg *cur;
-	unsigned long flags;
 
-	spin_lock_irqsave(&gi2c->lock, flags);
+	spin_lock(&gi2c->lock);
 	m_stat = readl_relaxed(base + SE_GENI_M_IRQ_STATUS);
 	rx_st = readl_relaxed(base + SE_GENI_RX_FIFO_STATUS);
 	dm_tx_st = readl_relaxed(base + SE_DMA_TX_IRQ_STAT);
@@ -294,7 +293,7 @@  static irqreturn_t geni_i2c_irq(int irq, void *dev)
 	    dm_rx_st & RX_DMA_DONE || dm_rx_st & RX_RESET_DONE)
 		complete(&gi2c->done);
 
-	spin_unlock_irqrestore(&gi2c->lock, flags);
+	spin_unlock(&gi2c->lock);
 
 	return IRQ_HANDLED;
 }