linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] fpga: Use DEFINE_SPINLOCK() for spinlock
@ 2020-12-28 13:51 Zheng Yongjun
  2021-01-09 22:08 ` Tom Rix
  0 siblings, 1 reply; 3+ messages in thread
From: Zheng Yongjun @ 2020-12-28 13:51 UTC (permalink / raw)
  To: mdf, linux-fpga, linux-kernel; +Cc: trix, Zheng Yongjun

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 drivers/fpga/fpga-bridge.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
index 2deccacc3aa7..e9266b2a357f 100644
--- a/drivers/fpga/fpga-bridge.c
+++ b/drivers/fpga/fpga-bridge.c
@@ -17,7 +17,7 @@ static DEFINE_IDA(fpga_bridge_ida);
 static struct class *fpga_bridge_class;
 
 /* Lock for adding/removing bridges to linked lists*/
-static spinlock_t bridge_list_lock;
+static DEFINE_SPINLOCK(bridge_list_lock);
 
 /**
  * fpga_bridge_enable - Enable transactions on the bridge
@@ -479,8 +479,6 @@ static void fpga_bridge_dev_release(struct device *dev)
 
 static int __init fpga_bridge_dev_init(void)
 {
-	spin_lock_init(&bridge_list_lock);
-
 	fpga_bridge_class = class_create(THIS_MODULE, "fpga_bridge");
 	if (IS_ERR(fpga_bridge_class))
 		return PTR_ERR(fpga_bridge_class);
-- 
2.22.0


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

* Re: [PATCH -next] fpga: Use DEFINE_SPINLOCK() for spinlock
  2020-12-28 13:51 [PATCH -next] fpga: Use DEFINE_SPINLOCK() for spinlock Zheng Yongjun
@ 2021-01-09 22:08 ` Tom Rix
  2021-01-10 19:07   ` Moritz Fischer
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rix @ 2021-01-09 22:08 UTC (permalink / raw)
  To: Zheng Yongjun, mdf, linux-fpga, linux-kernel


On 12/28/20 5:51 AM, Zheng Yongjun wrote:
> spinlock can be initialized automatically with DEFINE_SPINLOCK()
> rather than explicitly calling spin_lock_init().
>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>

This looks fine.

Reviewed-by: Tom Rix <trix@redhat.com>

> ---
>  drivers/fpga/fpga-bridge.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
> index 2deccacc3aa7..e9266b2a357f 100644
> --- a/drivers/fpga/fpga-bridge.c
> +++ b/drivers/fpga/fpga-bridge.c
> @@ -17,7 +17,7 @@ static DEFINE_IDA(fpga_bridge_ida);
>  static struct class *fpga_bridge_class;
>  
>  /* Lock for adding/removing bridges to linked lists*/
> -static spinlock_t bridge_list_lock;
> +static DEFINE_SPINLOCK(bridge_list_lock);
>  
>  /**
>   * fpga_bridge_enable - Enable transactions on the bridge
> @@ -479,8 +479,6 @@ static void fpga_bridge_dev_release(struct device *dev)
>  
>  static int __init fpga_bridge_dev_init(void)
>  {
> -	spin_lock_init(&bridge_list_lock);
> -
>  	fpga_bridge_class = class_create(THIS_MODULE, "fpga_bridge");
>  	if (IS_ERR(fpga_bridge_class))
>  		return PTR_ERR(fpga_bridge_class);


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

* Re: [PATCH -next] fpga: Use DEFINE_SPINLOCK() for spinlock
  2021-01-09 22:08 ` Tom Rix
@ 2021-01-10 19:07   ` Moritz Fischer
  0 siblings, 0 replies; 3+ messages in thread
From: Moritz Fischer @ 2021-01-10 19:07 UTC (permalink / raw)
  To: Tom Rix; +Cc: Zheng Yongjun, mdf, linux-fpga, linux-kernel

On Sat, Jan 09, 2021 at 02:08:53PM -0800, Tom Rix wrote:
> 
> On 12/28/20 5:51 AM, Zheng Yongjun wrote:
> > spinlock can be initialized automatically with DEFINE_SPINLOCK()
> > rather than explicitly calling spin_lock_init().
> >
> > Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> 
> This looks fine.
> 
> Reviewed-by: Tom Rix <trix@redhat.com>
> 
> > ---
> >  drivers/fpga/fpga-bridge.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
> > index 2deccacc3aa7..e9266b2a357f 100644
> > --- a/drivers/fpga/fpga-bridge.c
> > +++ b/drivers/fpga/fpga-bridge.c
> > @@ -17,7 +17,7 @@ static DEFINE_IDA(fpga_bridge_ida);
> >  static struct class *fpga_bridge_class;
> >  
> >  /* Lock for adding/removing bridges to linked lists*/
> > -static spinlock_t bridge_list_lock;
> > +static DEFINE_SPINLOCK(bridge_list_lock);
> >  
> >  /**
> >   * fpga_bridge_enable - Enable transactions on the bridge
> > @@ -479,8 +479,6 @@ static void fpga_bridge_dev_release(struct device *dev)
> >  
> >  static int __init fpga_bridge_dev_init(void)
> >  {
> > -	spin_lock_init(&bridge_list_lock);
> > -
> >  	fpga_bridge_class = class_create(THIS_MODULE, "fpga_bridge");
> >  	if (IS_ERR(fpga_bridge_class))
> >  		return PTR_ERR(fpga_bridge_class);
> 

Applied,

Thanks

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

end of thread, other threads:[~2021-01-10 19:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-28 13:51 [PATCH -next] fpga: Use DEFINE_SPINLOCK() for spinlock Zheng Yongjun
2021-01-09 22:08 ` Tom Rix
2021-01-10 19:07   ` Moritz Fischer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).