All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: remove spin_lock_irq in the irq procress
@ 2022-04-13  1:38 Li-hao Kuo
  2022-04-13 11:32 ` Mark Brown
  2022-04-13 11:45 ` Tom Rix
  0 siblings, 2 replies; 6+ messages in thread
From: Li-hao Kuo @ 2022-04-13  1:38 UTC (permalink / raw)
  To: broonie, linux-spi, linux-kernel
  Cc: wells.lu, lh.kuo, nathan, trix, Li-hao Kuo

- remove spin_lock_irq and spin_unlock_irq in the irq funciton

Signed-off-by: Li-hao Kuo <lhjeff911@gmail.com>
---
 drivers/spi/spi-sunplus-sp7021.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/spi/spi-sunplus-sp7021.c b/drivers/spi/spi-sunplus-sp7021.c
index f989f7b..120623c 100644
--- a/drivers/spi/spi-sunplus-sp7021.c
+++ b/drivers/spi/spi-sunplus-sp7021.c
@@ -199,8 +199,6 @@ static irqreturn_t sp7021_spi_master_irq(int irq, void *dev)
 	if (tx_len == 0 && total_len == 0)
 		return IRQ_NONE;
 
-	spin_lock_irq(&pspim->lock);
-
 	rx_cnt = FIELD_GET(SP7021_RX_CNT_MASK, fd_status);
 	if (fd_status & SP7021_RX_FULL_FLAG)
 		rx_cnt = pspim->data_unit;
@@ -239,7 +237,7 @@ static irqreturn_t sp7021_spi_master_irq(int irq, void *dev)
 
 	if (isrdone)
 		complete(&pspim->isr_done);
-	spin_unlock_irq(&pspim->lock);
+
 	return IRQ_HANDLED;
 }
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] spi: remove spin_lock_irq in the irq procress
  2022-04-13  1:38 [PATCH] spi: remove spin_lock_irq in the irq procress Li-hao Kuo
@ 2022-04-13 11:32 ` Mark Brown
  2022-04-14 13:18   ` 郭力豪
  2022-04-13 11:45 ` Tom Rix
  1 sibling, 1 reply; 6+ messages in thread
From: Mark Brown @ 2022-04-13 11:32 UTC (permalink / raw)
  To: Li-hao Kuo; +Cc: linux-spi, linux-kernel, wells.lu, lh.kuo, nathan, trix

[-- Attachment #1: Type: text/plain, Size: 213 bytes --]

On Wed, Apr 13, 2022 at 09:38:00AM +0800, Li-hao Kuo wrote:
> - remove spin_lock_irq and spin_unlock_irq in the irq funciton

It looks like this is the only use of the lock so the variable can be
removed as well?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] spi: remove spin_lock_irq in the irq procress
  2022-04-13  1:38 [PATCH] spi: remove spin_lock_irq in the irq procress Li-hao Kuo
  2022-04-13 11:32 ` Mark Brown
@ 2022-04-13 11:45 ` Tom Rix
  2022-04-14 13:16   ` 郭力豪
  1 sibling, 1 reply; 6+ messages in thread
From: Tom Rix @ 2022-04-13 11:45 UTC (permalink / raw)
  To: Li-hao Kuo, broonie, linux-spi, linux-kernel; +Cc: wells.lu, lh.kuo, nathan


On 4/12/22 6:38 PM, Li-hao Kuo wrote:
> - remove spin_lock_irq and spin_unlock_irq in the irq funciton

function

I was expecting a statement on why is the lock is not needed.

Could you add one ?

Tom

>
> Signed-off-by: Li-hao Kuo <lhjeff911@gmail.com>
> ---
>   drivers/spi/spi-sunplus-sp7021.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/spi/spi-sunplus-sp7021.c b/drivers/spi/spi-sunplus-sp7021.c
> index f989f7b..120623c 100644
> --- a/drivers/spi/spi-sunplus-sp7021.c
> +++ b/drivers/spi/spi-sunplus-sp7021.c
> @@ -199,8 +199,6 @@ static irqreturn_t sp7021_spi_master_irq(int irq, void *dev)
>   	if (tx_len == 0 && total_len == 0)
>   		return IRQ_NONE;
>   
> -	spin_lock_irq(&pspim->lock);
> -
>   	rx_cnt = FIELD_GET(SP7021_RX_CNT_MASK, fd_status);
>   	if (fd_status & SP7021_RX_FULL_FLAG)
>   		rx_cnt = pspim->data_unit;
> @@ -239,7 +237,7 @@ static irqreturn_t sp7021_spi_master_irq(int irq, void *dev)
>   
>   	if (isrdone)
>   		complete(&pspim->isr_done);
> -	spin_unlock_irq(&pspim->lock);
> +
>   	return IRQ_HANDLED;
>   }
>   


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] spi: remove spin_lock_irq in the irq procress
  2022-04-13 11:45 ` Tom Rix
@ 2022-04-14 13:16   ` 郭力豪
  2022-04-16 15:49     ` Tom Rix
  0 siblings, 1 reply; 6+ messages in thread
From: 郭力豪 @ 2022-04-14 13:16 UTC (permalink / raw)
  To: Tom Rix
  Cc: Mark Brown, linux-spi, linux-kernel,
	呂芳騰LuWells, lh.kuo, nathan

Hi Tom :

    This SPI driver only handles one transfer at a time.
That's why locks are not needed.


Li-hao Kuo

Tom Rix <trix@redhat.com> 於 2022年4月13日 週三 下午7:45寫道:
>
>
> On 4/12/22 6:38 PM, Li-hao Kuo wrote:
> > - remove spin_lock_irq and spin_unlock_irq in the irq funciton
>
> function
>
> I was expecting a statement on why is the lock is not needed.
>
> Could you add one ?
>
> Tom
>
> >
> > Signed-off-by: Li-hao Kuo <lhjeff911@gmail.com>
> > ---
> >   drivers/spi/spi-sunplus-sp7021.c | 4 +---
> >   1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/spi/spi-sunplus-sp7021.c b/drivers/spi/spi-sunplus-sp7021.c
> > index f989f7b..120623c 100644
> > --- a/drivers/spi/spi-sunplus-sp7021.c
> > +++ b/drivers/spi/spi-sunplus-sp7021.c
> > @@ -199,8 +199,6 @@ static irqreturn_t sp7021_spi_master_irq(int irq, void *dev)
> >       if (tx_len == 0 && total_len == 0)
> >               return IRQ_NONE;
> >
> > -     spin_lock_irq(&pspim->lock);
> > -
> >       rx_cnt = FIELD_GET(SP7021_RX_CNT_MASK, fd_status);
> >       if (fd_status & SP7021_RX_FULL_FLAG)
> >               rx_cnt = pspim->data_unit;
> > @@ -239,7 +237,7 @@ static irqreturn_t sp7021_spi_master_irq(int irq, void *dev)
> >
> >       if (isrdone)
> >               complete(&pspim->isr_done);
> > -     spin_unlock_irq(&pspim->lock);
> > +
> >       return IRQ_HANDLED;
> >   }
> >
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] spi: remove spin_lock_irq in the irq procress
  2022-04-13 11:32 ` Mark Brown
@ 2022-04-14 13:18   ` 郭力豪
  0 siblings, 0 replies; 6+ messages in thread
From: 郭力豪 @ 2022-04-14 13:18 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi, linux-kernel, 呂芳騰LuWells, lh.kuo,
	nathan, Tom Rix

Hi Mr.Mark :

I will remove the variable "psim->lock" in the next patch

Li-hao Kuo

Mark Brown <broonie@kernel.org> 於 2022年4月13日 週三 下午7:32寫道:
>
> On Wed, Apr 13, 2022 at 09:38:00AM +0800, Li-hao Kuo wrote:
> > - remove spin_lock_irq and spin_unlock_irq in the irq funciton
>
> It looks like this is the only use of the lock so the variable can be
> removed as well?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] spi: remove spin_lock_irq in the irq procress
  2022-04-14 13:16   ` 郭力豪
@ 2022-04-16 15:49     ` Tom Rix
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Rix @ 2022-04-16 15:49 UTC (permalink / raw)
  To: 郭力豪
  Cc: Mark Brown, linux-spi, linux-kernel,
	呂芳騰LuWells, lh.kuo, nathan


On 4/14/22 6:16 AM, 郭力豪 wrote:
> Hi Tom :
>
>      This SPI driver only handles one transfer at a time.
> That's why locks are not needed.

Please add this statement to the commit log.

In a commit log, not only do I look for what was changed but also why 
the change was made.

Tom

>
>
> Li-hao Kuo
>
> Tom Rix <trix@redhat.com> 於 2022年4月13日 週三 下午7:45寫道:
>>
>> On 4/12/22 6:38 PM, Li-hao Kuo wrote:
>>> - remove spin_lock_irq and spin_unlock_irq in the irq funciton
>> function
>>
>> I was expecting a statement on why is the lock is not needed.
>>
>> Could you add one ?
>>
>> Tom
>>
>>> Signed-off-by: Li-hao Kuo <lhjeff911@gmail.com>
>>> ---
>>>    drivers/spi/spi-sunplus-sp7021.c | 4 +---
>>>    1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/spi/spi-sunplus-sp7021.c b/drivers/spi/spi-sunplus-sp7021.c
>>> index f989f7b..120623c 100644
>>> --- a/drivers/spi/spi-sunplus-sp7021.c
>>> +++ b/drivers/spi/spi-sunplus-sp7021.c
>>> @@ -199,8 +199,6 @@ static irqreturn_t sp7021_spi_master_irq(int irq, void *dev)
>>>        if (tx_len == 0 && total_len == 0)
>>>                return IRQ_NONE;
>>>
>>> -     spin_lock_irq(&pspim->lock);
>>> -
>>>        rx_cnt = FIELD_GET(SP7021_RX_CNT_MASK, fd_status);
>>>        if (fd_status & SP7021_RX_FULL_FLAG)
>>>                rx_cnt = pspim->data_unit;
>>> @@ -239,7 +237,7 @@ static irqreturn_t sp7021_spi_master_irq(int irq, void *dev)
>>>
>>>        if (isrdone)
>>>                complete(&pspim->isr_done);
>>> -     spin_unlock_irq(&pspim->lock);
>>> +
>>>        return IRQ_HANDLED;
>>>    }
>>>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-16 15:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13  1:38 [PATCH] spi: remove spin_lock_irq in the irq procress Li-hao Kuo
2022-04-13 11:32 ` Mark Brown
2022-04-14 13:18   ` 郭力豪
2022-04-13 11:45 ` Tom Rix
2022-04-14 13:16   ` 郭力豪
2022-04-16 15:49     ` Tom Rix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.