From: Ilkka Koskinen <ilkka@os.amperecomputing.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: will@kernel.org, mark.rutland@arm.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] perf/arm-cmn: Improve format attr printing
Date: Thu, 5 Sep 2024 13:12:13 -0700 (PDT) [thread overview]
Message-ID: <85762d20-f615-9a77-3f1a-ce664a2e4f22@os.amperecomputing.com> (raw)
In-Reply-To: <50459f2d48fc62310a566863dbf8a7c14361d363.1725474584.git.robin.murphy@arm.com>
On Wed, 4 Sep 2024, Robin Murphy wrote:
> Take full advantage of our formats being stored in bitfield form, and
> make the printing even more robust and simple by letting printk do all
> the hard work of formatting bitlists.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
--Ilkka
> ---
> drivers/perf/arm-cmn.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index 62d4782da7e4..397a46410f7c 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -1280,15 +1280,11 @@ static ssize_t arm_cmn_format_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> struct arm_cmn_format_attr *fmt = container_of(attr, typeof(*fmt), attr);
> - int lo = __ffs(fmt->field), hi = __fls(fmt->field);
> -
> - if (lo == hi)
> - return sysfs_emit(buf, "config:%d\n", lo);
>
> if (!fmt->config)
> - return sysfs_emit(buf, "config:%d-%d\n", lo, hi);
> + return sysfs_emit(buf, "config:%*pbl\n", 64, &fmt->field);
>
> - return sysfs_emit(buf, "config%d:%d-%d\n", fmt->config, lo, hi);
> + return sysfs_emit(buf, "config%d:%*pbl\n", fmt->config, 64, &fmt->field);
> }
>
> #define _CMN_FORMAT_ATTR(_name, _cfg, _fld) \
> --
> 2.39.2.101.g768bb238c484.dirty
next prev parent reply other threads:[~2024-09-05 20:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 18:41 [PATCH 1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check Robin Murphy
2024-09-04 18:41 ` [PATCH 2/2] perf/arm-cmn: Improve format attr printing Robin Murphy
2024-09-05 20:12 ` Ilkka Koskinen [this message]
2024-09-06 12:29 ` [PATCH 1/2] perf/arm-cmn: Clean up unnecessary NUMA_NO_NODE check Will Deacon
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=85762d20-f615-9a77-3f1a-ce664a2e4f22@os.amperecomputing.com \
--to=ilkka@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/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
all inboxes | Powered by JetHome®