* [PATCH] usbip: vudc: Make use of the helper macro LIST_HEAD()
@ 2022-02-09 3:28 Cai Huoqing
2022-02-09 16:00 ` Shuah Khan
0 siblings, 1 reply; 4+ messages in thread
From: Cai Huoqing @ 2022-02-09 3:28 UTC (permalink / raw)
To: cai.huoqing
Cc: Valentina Manea, Shuah Khan, Greg Kroah-Hartman, linux-usb, linux-kernel
Replace "struct list_head head = LIST_HEAD_INIT(head)" with
"LIST_HEAD(head)" to simplify the code.
Signed-off-by: Cai Huoqing <cai.huoqing@linux.dev>
---
drivers/usb/usbip/vudc_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/usbip/vudc_main.c b/drivers/usb/usbip/vudc_main.c
index 678faa82598c..d43252b77efd 100644
--- a/drivers/usb/usbip/vudc_main.c
+++ b/drivers/usb/usbip/vudc_main.c
@@ -26,7 +26,7 @@ static struct platform_driver vudc_driver = {
},
};
-static struct list_head vudc_devices = LIST_HEAD_INIT(vudc_devices);
+static LIST_HEAD(vudc_devices);
static int __init init(void)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usbip: vudc: Make use of the helper macro LIST_HEAD()
2022-02-09 3:28 [PATCH] usbip: vudc: Make use of the helper macro LIST_HEAD() Cai Huoqing
@ 2022-02-09 16:00 ` Shuah Khan
2022-02-10 2:37 ` Cai Huoqing
0 siblings, 1 reply; 4+ messages in thread
From: Shuah Khan @ 2022-02-09 16:00 UTC (permalink / raw)
To: Cai Huoqing
Cc: Valentina Manea, Shuah Khan, Greg Kroah-Hartman, linux-usb,
linux-kernel, Shuah Khan
On 2/8/22 8:28 PM, Cai Huoqing wrote:
> Replace "struct list_head head = LIST_HEAD_INIT(head)" with
> "LIST_HEAD(head)" to simplify the code.
>
> Signed-off-by: Cai Huoqing <cai.huoqing@linux.dev>
> ---
> drivers/usb/usbip/vudc_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/usbip/vudc_main.c b/drivers/usb/usbip/vudc_main.c
> index 678faa82598c..d43252b77efd 100644
> --- a/drivers/usb/usbip/vudc_main.c
> +++ b/drivers/usb/usbip/vudc_main.c
> @@ -26,7 +26,7 @@ static struct platform_driver vudc_driver = {
> },
> };
>
> -static struct list_head vudc_devices = LIST_HEAD_INIT(vudc_devices);
> +static LIST_HEAD(vudc_devices);
>
> static int __init init(void)
> {
>
Explain why this change simplifies the code and also add a comment
above LIST_HEAD
LIST_HEAD_INIT clearly states what it does, as a result it is easier
to understand the code.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usbip: vudc: Make use of the helper macro LIST_HEAD()
2022-02-09 16:00 ` Shuah Khan
@ 2022-02-10 2:37 ` Cai Huoqing
2022-02-10 14:13 ` Shuah Khan
0 siblings, 1 reply; 4+ messages in thread
From: Cai Huoqing @ 2022-02-10 2:37 UTC (permalink / raw)
To: Shuah Khan
Cc: Valentina Manea, Shuah Khan, Greg Kroah-Hartman, linux-usb, linux-kernel
On 09 2月 22 09:00:37, Shuah Khan wrote:
> On 2/8/22 8:28 PM, Cai Huoqing wrote:
> > Replace "struct list_head head = LIST_HEAD_INIT(head)" with
> > "LIST_HEAD(head)" to simplify the code.
> >
> > Signed-off-by: Cai Huoqing <cai.huoqing@linux.dev>
> > ---
> > drivers/usb/usbip/vudc_main.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/usbip/vudc_main.c b/drivers/usb/usbip/vudc_main.c
> > index 678faa82598c..d43252b77efd 100644
> > --- a/drivers/usb/usbip/vudc_main.c
> > +++ b/drivers/usb/usbip/vudc_main.c
> > @@ -26,7 +26,7 @@ static struct platform_driver vudc_driver = {
> > },
> > };
> > -static struct list_head vudc_devices = LIST_HEAD_INIT(vudc_devices);
> > +static LIST_HEAD(vudc_devices);
> > static int __init init(void)
> > {
> >
>
> Explain why this change simplifies the code and also add a comment
> above LIST_HEAD
LIST_HEAD() help to clean up the code "struct list_head vudc_devices =
". we only to care the variable 'vudc_devices',
>
> LIST_HEAD_INIT clearly states what it does, as a result it is easier
> to understand the code.
LIST_HEAD() is defined for 17 years, lots of drivers use it
directly. It's not about code readability.
Thanks,
Cai
>
> thanks,
> -- Shuah
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usbip: vudc: Make use of the helper macro LIST_HEAD()
2022-02-10 2:37 ` Cai Huoqing
@ 2022-02-10 14:13 ` Shuah Khan
0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2022-02-10 14:13 UTC (permalink / raw)
To: Cai Huoqing
Cc: Valentina Manea, Shuah Khan, Greg Kroah-Hartman, linux-usb,
linux-kernel, Shuah Khan
On 2/9/22 7:37 PM, Cai Huoqing wrote:
> On 09 2月 22 09:00:37, Shuah Khan wrote:
>> On 2/8/22 8:28 PM, Cai Huoqing wrote:
>>> Replace "struct list_head head = LIST_HEAD_INIT(head)" with
>>> "LIST_HEAD(head)" to simplify the code.
>>>
>>> Signed-off-by: Cai Huoqing <cai.huoqing@linux.dev>
>>> ---
>>> drivers/usb/usbip/vudc_main.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/usbip/vudc_main.c b/drivers/usb/usbip/vudc_main.c
>>> index 678faa82598c..d43252b77efd 100644
>>> --- a/drivers/usb/usbip/vudc_main.c
>>> +++ b/drivers/usb/usbip/vudc_main.c
>>> @@ -26,7 +26,7 @@ static struct platform_driver vudc_driver = {
>>> },
>>> };
>>> -static struct list_head vudc_devices = LIST_HEAD_INIT(vudc_devices);
>>> +static LIST_HEAD(vudc_devices);
>>> static int __init init(void)
>>> {
>>>
>>
>> Explain why this change simplifies the code and also add a comment
>> above LIST_HEAD
> LIST_HEAD() help to clean up the code "struct list_head vudc_devices =
> ". we only to care the variable 'vudc_devices',
>>
How does LIST_HEAD() make it simpler. It does that I am sure. I am looking
for you to explain how it does in the change log.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-10 14:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 3:28 [PATCH] usbip: vudc: Make use of the helper macro LIST_HEAD() Cai Huoqing
2022-02-09 16:00 ` Shuah Khan
2022-02-10 2:37 ` Cai Huoqing
2022-02-10 14:13 ` Shuah Khan
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).