* [PATCH -next] usb: usbip: Use DEFINE_SPINLOCK() for spinlock
@ 2020-12-23 14:14 Zheng Yongjun
2021-01-15 17:57 ` Shuah Khan
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2020-12-23 14:14 UTC (permalink / raw)
To: valentina.manea.m, shuah, linux-usb, 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/usb/usbip/stub_main.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
index c1c0bbc9f8b1..77a5b3f8736a 100644
--- a/drivers/usb/usbip/stub_main.c
+++ b/drivers/usb/usbip/stub_main.c
@@ -23,7 +23,7 @@ struct kmem_cache *stub_priv_cache;
*/
#define MAX_BUSID 16
static struct bus_id_priv busid_table[MAX_BUSID];
-static spinlock_t busid_table_lock;
+static DEFINE_SPINLOCK(busid_table_lock);
static void init_busid_table(void)
{
@@ -35,8 +35,6 @@ static void init_busid_table(void)
*/
memset(busid_table, 0, sizeof(busid_table));
- spin_lock_init(&busid_table_lock);
-
for (i = 0; i < MAX_BUSID; i++)
spin_lock_init(&busid_table[i].busid_lock);
}
--
2.22.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] usb: usbip: Use DEFINE_SPINLOCK() for spinlock
2020-12-23 14:14 [PATCH -next] usb: usbip: Use DEFINE_SPINLOCK() for spinlock Zheng Yongjun
@ 2021-01-15 17:57 ` Shuah Khan
0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2021-01-15 17:57 UTC (permalink / raw)
To: Zheng Yongjun, valentina.manea.m, shuah, linux-usb, linux-kernel,
Shuah Khan
On 12/23/20 7:14 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>
> ---
> drivers/usb/usbip/stub_main.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/usb/usbip/stub_main.c b/drivers/usb/usbip/stub_main.c
> index c1c0bbc9f8b1..77a5b3f8736a 100644
> --- a/drivers/usb/usbip/stub_main.c
> +++ b/drivers/usb/usbip/stub_main.c
> @@ -23,7 +23,7 @@ struct kmem_cache *stub_priv_cache;
> */
> #define MAX_BUSID 16
> static struct bus_id_priv busid_table[MAX_BUSID];
> -static spinlock_t busid_table_lock;
> +static DEFINE_SPINLOCK(busid_table_lock);
>
> static void init_busid_table(void)
> {
> @@ -35,8 +35,6 @@ static void init_busid_table(void)
> */
> memset(busid_table, 0, sizeof(busid_table));
>
> - spin_lock_init(&busid_table_lock);
> -
> for (i = 0; i < MAX_BUSID; i++)
> spin_lock_init(&busid_table[i].busid_lock);
> }
>
Sorry for the delay on this.
Looks good to me.
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-15 17:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-23 14:14 [PATCH -next] usb: usbip: Use DEFINE_SPINLOCK() for spinlock Zheng Yongjun
2021-01-15 17:57 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox