public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Cai Huoqing <cai.huoqing@linux.dev>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usbip: vudc: Make use of the helper macro LIST_HEAD()
Date: Thu, 10 Feb 2022 10:37:14 +0800	[thread overview]
Message-ID: <20220210023714.GA7791@chq-T47> (raw)
In-Reply-To: <8c8bcf5b-bbda-55e0-6a61-35bfafbafb78@linuxfoundation.org>

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

  reply	other threads:[~2022-02-10  2:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-02-10 14:13     ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220210023714.GA7791@chq-T47 \
    --to=cai.huoqing@linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=valentina.manea.m@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox