Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1714665 > unrolled thread

Re: [PATCH 5/5] Use __func__ instead of function name

Started byMichal Suchánek <msuchanek@suse.de>
First post2017-08-18 10:10 +0200
Last post2017-08-18 13:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 5/5] Use __func__ instead of function name Michal Suchánek <msuchanek@suse.de> - 2017-08-18 10:10 +0200
    Re: [PATCH 5/5] Use __func__ instead of function name Michael Ellerman <mpe@ellerman.id.au> - 2017-08-18 13:30 +0200

#1714665 — Re: [PATCH 5/5] Use __func__ instead of function name

FromMichal Suchánek <msuchanek@suse.de>
Date2017-08-18 10:10 +0200
SubjectRe: [PATCH 5/5] Use __func__ instead of function name
Message-ID<ufKvT-Mj-13@gated-at.bofh.it>
On 2017-07-29 09:24, SZ Lin wrote:
> Fix following checkpatch.pl warning:
> WARNING: Prefer using '"%s...", __func__' to using
> the function's name, in a string
> 
> Signed-off-by: SZ Lin <sz.lin@moxa.com>
> ---
>  drivers/char/tpm/tpm_ibmvtpm.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_ibmvtpm.c 
> b/drivers/char/tpm/tpm_ibmvtpm.c
> index e75a674b44ac..2d33acc43e25 100644
> --- a/drivers/char/tpm/tpm_ibmvtpm.c
> +++ b/drivers/char/tpm/tpm_ibmvtpm.c
> @@ -151,7 +151,7 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip,
> u8 *buf, size_t count)
>  	rc = ibmvtpm_send_crq(ibmvtpm->vdev, be64_to_cpu(word[0]),
>  			      be64_to_cpu(word[1]));
>  	if (rc != H_SUCCESS) {
> -		dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
> +		dev_err(ibmvtpm->dev, "%s failed rc=%d\n", __func__, rc);

Can function name contain a %?

I would prefer dev_err(ibmvtpm->dev, __func__ " failed rc=%d\n", rc);

It's not what checkpatch advises in the above message, though.

Presumably with many messages from the same function using %s would
save space but that is not the usual case.

Thanks

Michal

[toc] | [next] | [standalone]


#1714808

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-08-18 13:30 +0200
Message-ID<ufNDs-30g-15@gated-at.bofh.it>
In reply to#1714665
Michal Suchánek <msuchanek@suse.de> writes:

> On 2017-07-29 09:24, SZ Lin wrote:
>> Fix following checkpatch.pl warning:
>> WARNING: Prefer using '"%s...", __func__' to using
>> the function's name, in a string
>> 
>> Signed-off-by: SZ Lin <sz.lin@moxa.com>
>> ---
>>  drivers/char/tpm/tpm_ibmvtpm.c | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/char/tpm/tpm_ibmvtpm.c 
>> b/drivers/char/tpm/tpm_ibmvtpm.c
>> index e75a674b44ac..2d33acc43e25 100644
>> --- a/drivers/char/tpm/tpm_ibmvtpm.c
>> +++ b/drivers/char/tpm/tpm_ibmvtpm.c
>> @@ -151,7 +151,7 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip,
>> u8 *buf, size_t count)
>>  	rc = ibmvtpm_send_crq(ibmvtpm->vdev, be64_to_cpu(word[0]),
>>  			      be64_to_cpu(word[1]));
>>  	if (rc != H_SUCCESS) {
>> -		dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
>> +		dev_err(ibmvtpm->dev, "%s failed rc=%d\n", __func__, rc);
>
> Can function name contain a %?

Let's hope not.

$ git grep "%s.*__func__" | wc -l
16937

cheers

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web