driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/7] staging: most: Use spinlock_t instead of struct spinlock
       [not found] <20190704153803.12739-1-bigeasy@linutronix.de>
@ 2019-07-04 15:38 ` Sebastian Andrzej Siewior
  2019-07-06 10:02   ` Greg Kroah-Hartman
  2019-07-15 19:19   ` Greg Kroah-Hartman
  2019-07-04 15:38 ` Sebastian Andrzej Siewior
  1 sibling, 2 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-07-04 15:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: devel, Peter Zijlstra, Greg Kroah-Hartman,
	Sebastian Andrzej Siewior, Christian Gromm, tglx

For spinlocks the type spinlock_t should be used instead of "struct
spinlock".

Use spinlock_t for spinlock's definition.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Christian Gromm <christian.gromm@microchip.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/staging/most/net/net.c     | 3 +--
 drivers/staging/most/video/video.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index c8a64e2090273..09b604df45e63 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -69,7 +69,7 @@ struct net_dev_context {
 
 static struct list_head net_devices = LIST_HEAD_INIT(net_devices);
 static struct mutex probe_disc_mt; /* ch->linked = true, most_nd_open */
-static struct spinlock list_lock; /* list_head, ch->linked = false, dev_hold */
+static DEFINE_SPINLOCK(list_lock); /* list_head, ch->linked = false, dev_hold */
 static struct core_component comp;
 
 static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
@@ -507,7 +507,6 @@ static struct core_component comp = {
 
 static int __init most_net_init(void)
 {
-	spin_lock_init(&list_lock);
 	mutex_init(&probe_disc_mt);
 	return most_register_component(&comp);
 }
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index adca250062e1b..fcd9e111e8bd0 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -54,7 +54,7 @@ struct comp_fh {
 };
 
 static struct list_head video_devices = LIST_HEAD_INIT(video_devices);
-static struct spinlock list_lock;
+static DEFINE_SPINLOCK(list_lock);
 
 static inline bool data_ready(struct most_video_dev *mdev)
 {
@@ -540,7 +540,6 @@ static struct core_component comp = {
 
 static int __init comp_init(void)
 {
-	spin_lock_init(&list_lock);
 	return most_register_component(&comp);
 }
 
-- 
2.20.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 4/7] staging: most: Use spinlock_t instead of struct spinlock
       [not found] <20190704153803.12739-1-bigeasy@linutronix.de>
  2019-07-04 15:38 ` [PATCH 4/7] staging: most: Use spinlock_t instead of struct spinlock Sebastian Andrzej Siewior
@ 2019-07-04 15:38 ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-07-04 15:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: devel, Peter Zijlstra, Greg Kroah-Hartman,
	Sebastian Andrzej Siewior, Christian Gromm, tglx

For spinlocks the type spinlock_t should be used instead of "struct
spinlock".

Use spinlock_t for spinlock's definition.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Christian Gromm <christian.gromm@microchip.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/staging/most/net/net.c     | 3 +--
 drivers/staging/most/video/video.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index c8a64e2090273..09b604df45e63 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -69,7 +69,7 @@ struct net_dev_context {
 
 static struct list_head net_devices = LIST_HEAD_INIT(net_devices);
 static struct mutex probe_disc_mt; /* ch->linked = true, most_nd_open */
-static struct spinlock list_lock; /* list_head, ch->linked = false, dev_hold */
+static DEFINE_SPINLOCK(list_lock); /* list_head, ch->linked = false, dev_hold */
 static struct core_component comp;
 
 static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
@@ -507,7 +507,6 @@ static struct core_component comp = {
 
 static int __init most_net_init(void)
 {
-	spin_lock_init(&list_lock);
 	mutex_init(&probe_disc_mt);
 	return most_register_component(&comp);
 }
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index adca250062e1b..fcd9e111e8bd0 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -54,7 +54,7 @@ struct comp_fh {
 };
 
 static struct list_head video_devices = LIST_HEAD_INIT(video_devices);
-static struct spinlock list_lock;
+static DEFINE_SPINLOCK(list_lock);
 
 static inline bool data_ready(struct most_video_dev *mdev)
 {
@@ -540,7 +540,6 @@ static struct core_component comp = {
 
 static int __init comp_init(void)
 {
-	spin_lock_init(&list_lock);
 	return most_register_component(&comp);
 }
 
-- 
2.20.1

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

* [PATCH 4/7] staging: most: Use spinlock_t instead of struct spinlock
  2019-07-04 15:38 ` [PATCH 4/7] staging: most: Use spinlock_t instead of struct spinlock Sebastian Andrzej Siewior
@ 2019-07-06 10:02   ` Greg Kroah-Hartman
  2019-07-06 21:35     ` Sebastian Andrzej Siewior
  2019-07-15 19:19   ` Greg Kroah-Hartman
  1 sibling, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-06 10:02 UTC (permalink / raw)


On Thu, Jul 04, 2019@05:38:00PM +0200, Sebastian Andrzej Siewior wrote:
> For spinlocks the type spinlock_t should be used instead of "struct
> spinlock".

Why?

> Use spinlock_t for spinlock's definition.

Why?  I agree it makes the code smaller, but why is this required?

thanks,

greg k-h

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

* Re: [PATCH 4/7] staging: most: Use spinlock_t instead of struct spinlock
  2019-07-06 10:02   ` Greg Kroah-Hartman
@ 2019-07-06 21:35     ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2019-07-06 21:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Peter Zijlstra, tglx, linux-kernel, Christian Gromm

On 2019-07-06 12:02:53 [+0200], Greg Kroah-Hartman wrote:
> On Thu, Jul 04, 2019 at 05:38:00PM +0200, Sebastian Andrzej Siewior wrote:
> > For spinlocks the type spinlock_t should be used instead of "struct
> > spinlock".
> 
> Why?
> 
> > Use spinlock_t for spinlock's definition.
> 
> Why?  I agree it makes the code smaller, but why is this required?

I remember PeterZ pointing out to stick to the typedef and it is
probably better to stick with the typdef since we have it. It was like
that since it was first introduced (2.1.25 for i386).
We have a checkpatch warning for that [0]. 

This series has only 7 patches (excluding the powerpc bits) so almost
everyone else is using just the typdef.

[0] 88982fea52d01 ("checkpatch: warn when declaring "struct spinlock foo;"")
    from Dec 2012

> thanks,
> 
> greg k-h

Sebastian
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH 4/7] staging: most: Use spinlock_t instead of struct spinlock
  2019-07-04 15:38 ` [PATCH 4/7] staging: most: Use spinlock_t instead of struct spinlock Sebastian Andrzej Siewior
  2019-07-06 10:02   ` Greg Kroah-Hartman
@ 2019-07-15 19:19   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-15 19:19 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: devel, Peter Zijlstra, tglx, linux-kernel, Christian Gromm

On Thu, Jul 04, 2019 at 05:38:00PM +0200, Sebastian Andrzej Siewior wrote:
> For spinlocks the type spinlock_t should be used instead of "struct
> spinlock".
> 
> Use spinlock_t for spinlock's definition.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Christian Gromm <christian.gromm@microchip.com>
> Cc: devel@driverdev.osuosl.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/staging/most/net/net.c     | 3 +--
>  drivers/staging/most/video/video.c | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
> index c8a64e2090273..09b604df45e63 100644
> --- a/drivers/staging/most/net/net.c
> +++ b/drivers/staging/most/net/net.c
> @@ -69,7 +69,7 @@ struct net_dev_context {
>  
>  static struct list_head net_devices = LIST_HEAD_INIT(net_devices);
>  static struct mutex probe_disc_mt; /* ch->linked = true, most_nd_open */
> -static struct spinlock list_lock; /* list_head, ch->linked = false, dev_hold */
> +static DEFINE_SPINLOCK(list_lock); /* list_head, ch->linked = false, dev_hold */
>  static struct core_component comp;
>  
>  static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
> @@ -507,7 +507,6 @@ static struct core_component comp = {
>  
>  static int __init most_net_init(void)
>  {
> -	spin_lock_init(&list_lock);
>  	mutex_init(&probe_disc_mt);
>  	return most_register_component(&comp);
>  }
> diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
> index adca250062e1b..fcd9e111e8bd0 100644
> --- a/drivers/staging/most/video/video.c
> +++ b/drivers/staging/most/video/video.c
> @@ -54,7 +54,7 @@ struct comp_fh {
>  };
>  
>  static struct list_head video_devices = LIST_HEAD_INIT(video_devices);
> -static struct spinlock list_lock;
> +static DEFINE_SPINLOCK(list_lock);
>  
>  static inline bool data_ready(struct most_video_dev *mdev)
>  {
> @@ -540,7 +540,6 @@ static struct core_component comp = {
>  
>  static int __init comp_init(void)
>  {
> -	spin_lock_init(&list_lock);
>  	return most_register_component(&comp);
>  }
>  

Does not apply on top of Linus's tree right now :(

Can you rebase and resend once 5.3-rc1 is out?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2019-07-15 19:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190704153803.12739-1-bigeasy@linutronix.de>
2019-07-04 15:38 ` [PATCH 4/7] staging: most: Use spinlock_t instead of struct spinlock Sebastian Andrzej Siewior
2019-07-06 10:02   ` Greg Kroah-Hartman
2019-07-06 21:35     ` Sebastian Andrzej Siewior
2019-07-15 19:19   ` Greg Kroah-Hartman
2019-07-04 15:38 ` Sebastian Andrzej Siewior

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).