public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-arm-kernel@lists.infradead.org,
	"Suzuki K. Poulose" <suzuki.poulose@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	kernel-janitors@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM64-cpuinfo: Combine six calls for sequence output into one seq_printf() call in c_show()
Date: Mon, 17 Oct 2016 11:56:05 +0100	[thread overview]
Message-ID: <20161017105605.GB29095@leverpostej> (raw)
In-Reply-To: <83d98772-8872-1b75-a9a5-5f08b8462e18@users.sourceforge.net>

On Sun, Oct 16, 2016 at 09:03:52PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 16 Oct 2016 20:48:28 +0200
> 
> Some data were printed into a sequence by six separate function calls.
> Print the same data by a single function call instead.

... why?

Beyond simply having fewer function calls, is there an upside?

This makes it harder to see the relationship between the format strings
and their associated data, and makes the code longer.

Thanks,
Mark.

> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  arch/arm64/kernel/cpuinfo.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
> index b3d5b3e..f22687d 100644
> --- a/arch/arm64/kernel/cpuinfo.c
> +++ b/arch/arm64/kernel/cpuinfo.c
> @@ -148,14 +148,17 @@ static int c_show(struct seq_file *m, void *v)
>  				if (elf_hwcap & (1 << j))
>  					seq_printf(m, " %s", hwcap_str[j]);
>  		}
> -		seq_puts(m, "\n");
> -
> -		seq_printf(m, "CPU implementer\t: 0x%02x\n",
> -			   MIDR_IMPLEMENTOR(midr));
> -		seq_printf(m, "CPU architecture: 8\n");
> -		seq_printf(m, "CPU variant\t: 0x%x\n", MIDR_VARIANT(midr));
> -		seq_printf(m, "CPU part\t: 0x%03x\n", MIDR_PARTNUM(midr));
> -		seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr));
> +		seq_printf(m,
> +			   "\n"
> +			   "CPU implementer\t: 0x%02x\n"
> +			   "CPU architecture: 8\n"
> +			   "CPU variant\t: 0x%x\n"
> +			   "CPU part\t: 0x%03x\n"
> +			   "CPU revision\t: %d\n\n",
> +			   MIDR_IMPLEMENTOR(midr),
> +			   MIDR_VARIANT(midr),
> +			   MIDR_PARTNUM(midr),
> +			   MIDR_REVISION(midr));
>  	}
>  
>  	return 0;
> -- 
> 2.10.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

  parent reply	other threads:[~2016-10-17 10:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-16 19:03 [PATCH] ARM64-cpuinfo: Combine six calls for sequence output into one seq_printf() call in c_show() SF Markus Elfring
2016-10-17  9:37 ` Matthias Brugger
2016-10-17 10:56 ` Mark Rutland [this message]
2016-10-17 11:30   ` SF Markus Elfring
2016-10-17 12:37     ` Mark Rutland
2016-10-17 12:50       ` SF Markus Elfring
2016-10-17 13:10         ` Mark Rutland

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=20161017105605.GB29095@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=will.deacon@arm.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