All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michal Suchánek" <msuchanek@suse.de>
To: SZ Lin <sz.lin@moxa.com>
Cc: ashleydlai@gmail.com, linux-kernel@vger.kernel.org,
	jarkko.sakkinen@linux.intel.com, jgunthorpe@obsidianresearch.com,
	tpmdd-devel@lists.sourceforge.net, paulus@samba.org,
	peterhuewe@gmx.de, linuxppc-dev@lists.ozlabs.org,
	tpmdd@selhorst.ne,
	Linuxppc-dev
	<linuxppc-dev-bounces+msuchanek=suse.de@lists.ozlabs.org>
Subject: Re: [PATCH 5/5] Use __func__ instead of function name
Date: Fri, 18 Aug 2017 10:03:17 +0200	[thread overview]
Message-ID: <0e2d9ac4f5ee02e9df98610ed07eaec9@suse.de> (raw)
In-Reply-To: <20170729072433.13194-6-sz.lin@moxa.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: "Michal Suchánek" <msuchanek-l3A5Bk7waGM@public.gmane.org>
To: SZ Lin <sz.lin-D4fb9hXD9d4@public.gmane.org>
Cc: Linuxppc-dev
	<linuxppc-dev-bounces+msuchanek=suse.de-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org,
	ashleydlai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	tpmdd-yWjUBOtONeeDGRHsOpWV0g@public.gmane.org
Subject: Re: [PATCH 5/5] Use __func__ instead of function name
Date: Fri, 18 Aug 2017 10:03:17 +0200	[thread overview]
Message-ID: <0e2d9ac4f5ee02e9df98610ed07eaec9@suse.de> (raw)
In-Reply-To: <20170729072433.13194-6-sz.lin-D4fb9hXD9d4@public.gmane.org>

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-D4fb9hXD9d4@public.gmane.org>
> ---
>  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



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

  reply	other threads:[~2017-08-18  8:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-29  7:24 [PATCH 0/5] tpm: tpm_ibmvtpm: - style fix SZ Lin
2017-02-24 19:35 ` [RFT PATCH] tpm: ibmvtpm: simplify crq initialization and document crq format Michal Suchanek
2017-02-24 19:35   ` Michal Suchanek
2017-08-17 22:21   ` msuchanek
2017-08-19 17:18     ` Jarkko Sakkinen
2017-08-19 17:18       ` Jarkko Sakkinen
2017-08-19 17:24       ` Jarkko Sakkinen
2017-08-19 17:24         ` Jarkko Sakkinen
2017-07-29  7:24 ` [PATCH 1/5] Fix packed and aligned attribute warnings SZ Lin
2017-07-31 13:27   ` David Laight
2017-07-31 13:27     ` David Laight
2017-07-29  7:24 ` [PATCH 2/5] Fix "ERROR: code indent should use tabs where possible" SZ Lin
2017-07-31 10:25   ` Michael Ellerman
2017-07-31 10:25     ` Michael Ellerman
2017-07-29  7:24 ` [PATCH 3/5] Fix 'void function return statements are not generally useful' warning SZ Lin
2017-07-29  7:24 ` [PATCH 4/5] Remove unneccessary 'out of memory' message SZ Lin
2017-07-29  7:24 ` [PATCH 5/5] Use __func__ instead of function name SZ Lin
2017-08-18  8:03   ` Michal Suchánek [this message]
2017-08-18  8:03     ` Michal Suchánek
2017-08-18 11:25     ` Michael Ellerman
2017-08-18 11:25       ` Michael Ellerman
2017-08-18 11:25       ` Michael Ellerman
2017-08-19  7:58   ` 김동현
2017-08-02 12:36 ` [PATCH 0/5] tpm: tpm_ibmvtpm: - style fix Jarkko Sakkinen

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=0e2d9ac4f5ee02e9df98610ed07eaec9@suse.de \
    --to=msuchanek@suse.de \
    --cc=ashleydlai@gmail.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev-bounces+msuchanek=suse.de@lists.ozlabs.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=peterhuewe@gmx.de \
    --cc=sz.lin@moxa.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.ne \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.