public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Liang He" <windhl@126.com>
To: "Bart Van Assche" <bvanassche@acm.org>
Cc: jejb@linux.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org
Subject: Re:Re: [PATCH v2] ufs: host: ufschd-pltfrm: Hold reference returned by of_parse_phandle()
Date: Mon, 18 Jul 2022 16:30:50 +0800 (CST)	[thread overview]
Message-ID: <17e51061.2bac.182106e747f.Coremail.windhl@126.com> (raw)
In-Reply-To: <6e005dc0-720e-41b1-10df-cc088245bccb@acm.org>



At 2022-07-17 22:58:45, "Bart Van Assche" <bvanassche@acm.org> wrote:
>On 7/16/22 20:03, Liang He wrote:
>> At 2022-07-16 21:50:08, "Bart Van Assche" <bvanassche@acm.org> wrote:
>>> On 7/14/22 17:17, Liang He wrote:
>>>> +static bool phandle_exists(const struct device_node *np,
>>>> +						const char *phandle_name,
>>>> +						int index)
>>>
>>> Indentation of the arguments now looks really odd :-(
>> 
>> Yes, Bart, I also wonder this coding style, however I learned that
>> from the definition of 'of_parse_phandle' in of.h.
>> 
>> Is it OK if I put all of them in one line?
>
>No. From Documentation/process/coding-style.rst (please read that 
>document in its entirety): "The preferred limit on the length of a 
>single line is 80 columns. [...] A very commonly used style
>is to align descendants to a function open parenthesis."
>
>Consider to use the following formatting:
>
>static bool phandle_exists(const struct device_node *np,
>			   const char *phandle_name, int index)
>{
>	[ ... ]
>}
>

Thanks very much, Bart,

I will follow your advice and I will read carefully the Documentation/process/coding-style.rst

Liang

>>>> +{
>>>> +	struct device_node *parse_np = of_parse_phandle(np, phandle_name, index);
>>>> +	bool ret = false;
>>>> +
>>>> +	if (parse_np) {
>>>> +		ret = true;
>>>> +		of_node_put(parse_np);
>>>> +	}
>>>> +
>>>> +	return ret;
>>>> +}
>>>
>>> The 'ret' variable is not necessary. If "return ret" is changed into
>>> "return parse_np" then the variable 'ret' can be left out.
>>>
>> 
>> OK, I will use 'return parse_np' in new version when you confirm above coding style.
>
>You may want to use "return parse_np != NULL" if you want to be sure 
>that nobody else will complain about an implicit conversion of a pointer 
>to a boolean type.
>
OK, I think 'return parse_np != NULL' is better.

I will prepare new version patch soon.

>Thanks,
>
>Bart.

Thanks, 
Liang

  reply	other threads:[~2022-07-18  8:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15  0:17 [PATCH v2] ufs: host: ufschd-pltfrm: Hold reference returned by of_parse_phandle() Liang He
2022-07-16 13:50 ` Bart Van Assche
2022-07-17  3:03   ` Liang He
2022-07-17 14:58     ` Bart Van Assche
2022-07-18  8:30       ` Liang He [this message]
2022-07-19  2:46       ` Liang He
2022-07-19 18:12         ` Bart Van Assche
2022-07-20  0:48           ` Liang He

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=17e51061.2bac.182106e747f.Coremail.windhl@126.com \
    --to=windhl@126.com \
    --cc=bvanassche@acm.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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