linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] tty: n_gsm: use DEFINE_SPINLOCK() for spinlock
@ 2021-04-06 11:56 Huang Guobin
  2021-04-07  5:23 ` Jiri Slaby
  0 siblings, 1 reply; 3+ messages in thread
From: Huang Guobin @ 2021-04-06 11:56 UTC (permalink / raw)
  To: huangguobin4, Greg Kroah-Hartman, Jiri Slaby
  Cc: linux-kernel, kernel-janitors

From: Guobin Huang <huangguobin4@huawei.com>

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

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Guobin Huang <huangguobin4@huawei.com>
---
 drivers/tty/n_gsm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 9e12f9cb1a98..d60cffc70a0c 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -266,7 +266,7 @@ struct gsm_mux {
 
 #define MAX_MUX		4			/* 256 minors */
 static struct gsm_mux *gsm_mux[MAX_MUX];	/* GSM muxes */
-static spinlock_t gsm_mux_lock;
+static DEFINE_SPINLOCK(gsm_mux_lock);
 
 static struct tty_driver *gsm_tty_driver;
 
@@ -3257,8 +3257,6 @@ static int __init gsm_init(void)
 	gsm_tty_driver->init_termios.c_lflag &= ~ECHO;
 	tty_set_operations(gsm_tty_driver, &gsmtty_ops);
 
-	spin_lock_init(&gsm_mux_lock);
-
 	if (tty_register_driver(gsm_tty_driver)) {
 		put_tty_driver(gsm_tty_driver);
 		tty_unregister_ldisc(N_GSM0710);


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

* Re: [PATCH -next] tty: n_gsm: use DEFINE_SPINLOCK() for spinlock
  2021-04-06 11:56 [PATCH -next] tty: n_gsm: use DEFINE_SPINLOCK() for spinlock Huang Guobin
@ 2021-04-07  5:23 ` Jiri Slaby
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2021-04-07  5:23 UTC (permalink / raw)
  To: Huang Guobin, Greg Kroah-Hartman; +Cc: linux-kernel, kernel-janitors

On 06. 04. 21, 13:56, Huang Guobin wrote:
> From: Guobin Huang <huangguobin4@huawei.com>
> 
> spinlock can be initialized automatically with DEFINE_SPINLOCK()
> rather than explicitly calling spin_lock_init().
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Guobin Huang <huangguobin4@huawei.com>

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

> ---
>   drivers/tty/n_gsm.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
> index 9e12f9cb1a98..d60cffc70a0c 100644
> --- a/drivers/tty/n_gsm.c
> +++ b/drivers/tty/n_gsm.c
> @@ -266,7 +266,7 @@ struct gsm_mux {
>   
>   #define MAX_MUX		4			/* 256 minors */
>   static struct gsm_mux *gsm_mux[MAX_MUX];	/* GSM muxes */
> -static spinlock_t gsm_mux_lock;
> +static DEFINE_SPINLOCK(gsm_mux_lock);
>   
>   static struct tty_driver *gsm_tty_driver;
>   
> @@ -3257,8 +3257,6 @@ static int __init gsm_init(void)
>   	gsm_tty_driver->init_termios.c_lflag &= ~ECHO;
>   	tty_set_operations(gsm_tty_driver, &gsmtty_ops);
>   
> -	spin_lock_init(&gsm_mux_lock);
> -
>   	if (tty_register_driver(gsm_tty_driver)) {
>   		put_tty_driver(gsm_tty_driver);
>   		tty_unregister_ldisc(N_GSM0710);
> 


-- 
js

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

* [PATCH -next] tty: n_gsm: Use DEFINE_SPINLOCK() for spinlock
@ 2020-12-23 14:14 Zheng Yongjun
  0 siblings, 0 replies; 3+ messages in thread
From: Zheng Yongjun @ 2020-12-23 14:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: 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/tty/n_gsm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 25f3152089c2..e22d766621a4 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -266,7 +266,7 @@ struct gsm_mux {
 
 #define MAX_MUX		4			/* 256 minors */
 static struct gsm_mux *gsm_mux[MAX_MUX];	/* GSM muxes */
-static spinlock_t gsm_mux_lock;
+static DEFINE_SPINLOCK(gsm_mux_lock);
 
 static struct tty_driver *gsm_tty_driver;
 
@@ -3258,8 +3258,6 @@ static int __init gsm_init(void)
 	gsm_tty_driver->init_termios.c_lflag &= ~ECHO;
 	tty_set_operations(gsm_tty_driver, &gsmtty_ops);
 
-	spin_lock_init(&gsm_mux_lock);
-
 	if (tty_register_driver(gsm_tty_driver)) {
 		put_tty_driver(gsm_tty_driver);
 		tty_unregister_ldisc(N_GSM0710);
-- 
2.22.0


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

end of thread, other threads:[~2021-04-07  5:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 11:56 [PATCH -next] tty: n_gsm: use DEFINE_SPINLOCK() for spinlock Huang Guobin
2021-04-07  5:23 ` Jiri Slaby
  -- strict thread matches above, loose matches on Subject: below --
2020-12-23 14:14 [PATCH -next] tty: n_gsm: Use " Zheng Yongjun

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