DMA Engine development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Logan Gunthorpe" <logang@deltatee.com>, dmaengine@vger.kernel.org
Cc: vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v5 4/4] dmaengine: switchtec-dma: add pmon sysfs attributes
Date: Tue, 24 Nov 2026 15:59:03 +0000	[thread overview]
Message-ID: <sashiko-outbox-231501@kernel.org> (raw)
In-Reply-To: <20261124155024.920403-5-logang@deltatee.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dmaengine: switchtec-dma: multi-line menu output in
  latency_selector_show()
--

commit 88f647b9334dbbed040eb8ea50d2882f9874a0c9
Author: Logan Gunthorpe <logang@deltatee.com>

dmaengine: switchtec-dma: add pmon sysfs attributes

This commit adds a "switchtec-pmon" sysfs attribute group to expose
Switchtec DMA performance monitor registers per channel.

> diff --git a/drivers/dma/switchtec_dma.c b/drivers/dma/switchtec_dma.c
> index 1ebe17095c61a..774b418330ed7 100644
> --- a/drivers/dma/switchtec_dma.c
> +++ b/drivers/dma/switchtec_dma.c
[ ... ]
> @@ -1215,8 +1222,274 @@ static const struct attribute_group switchtec_config_group = {
>  	.attrs = switchtec_config_attrs,
>  };
[ ... ]
> +static ssize_t latency_selector_show(struct device *dev,
> +				     struct device_attribute *attr, char *page)
> +{
[ ... ]
> +	len = sysfs_emit(page,
> +			 "To select a latency type, write the type number\n");
> +	len += sysfs_emit_at(page, len, "(1 ~ 5) to latency_selector\n\n");
> +
> +	len += sysfs_emit_at(page, len, "Latency Types:\n");
> +	len += sysfs_emit_at(page, len, "(1) SE Fetch latency");
> +	if (lat & SWITCHTEC_LAT_SE_FETCH)
> +		len += sysfs_emit_at(page, len, " (*)\n");
> +	else
> +		len += sysfs_emit_at(page, len, "\n");
> +
> +	len += sysfs_emit_at(page, len, "(2) VDM latency");
> +	if (lat & SWITCHTEC_LAT_VDM)
> +		len += sysfs_emit_at(page, len, " (*)\n");
> +	else
> +		len += sysfs_emit_at(page, len, "\n");
> +
> +	len += sysfs_emit_at(page, len, "(3) Read Immediate latency");
> +	if (lat & SWITCHTEC_LAT_RD_IMM)
> +		len += sysfs_emit_at(page, len, " (*)\n");
> +	else
> +		len += sysfs_emit_at(page, len, "\n");
> +
> +	len += sysfs_emit_at(page, len, "(4) SE Processing latency");
> +	if (lat & SWITCHTEC_LAT_SE_PROCESS)
> +		len += sysfs_emit_at(page, len, " (*)\n");
> +	else
> +		len += sysfs_emit_at(page, len, "\n");
> +
> +	len += sysfs_emit_at(page, len, "(5) FW NP TLP latency");
> +	if (lat & SWITCHTEC_LAT_FW_NP)
> +		len += sysfs_emit_at(page, len, " (*)\n");
> +	else
> +		len += sysfs_emit_at(page, len, "\n");
> +
> +	return len;
> +}
> +
> +static ssize_t latency_selector_store(struct device *dev,
> +				      struct device_attribute *attr,
> +				      const char *page, size_t count)
> +{
[ ... ]
> +	if (kstrtoint(page, 0, &lat_type) < 0)
> +		return -EINVAL;

[Severity: Low]
Does latency_selector_show() violate the sysfs one-value-per-file rule in
Documentation/filesystems/sysfs.rst?

Reading latency_selector emits multi-line usage instructions and a
numbered menu marking the active bit with "(*)", whereas
latency_selector_store() parses a single integer from 1 to 5 via
kstrtoint(), so the attribute's output cannot be parsed as a single value
or written back to the file.  Could latency_selector expose a single value
(or a single-line space-separated list of tokens with brackets around the
active selection, documented under Documentation/ABI/), or move the
human-formatted menu to debugfs?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124155024.920403-1-logang@deltatee.com?part=4

      reply	other threads:[~2026-11-24 15:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 15:50 [PATCH v5 0/4] Add sysfs interface to switchtec-dma Logan Gunthorpe
2026-11-24 15:50 ` [PATCH v5 1/4] dmaengine: add per-channel sysfs attribute groups via chan_groups Logan Gunthorpe
2026-11-24 15:50 ` [PATCH v5 2/4] dmaengine: ioatdma: convert per-channel sysfs to chan_groups Logan Gunthorpe
2026-11-24 15:50 ` [PATCH v5 3/4] dmaengine: switchtec-dma: add config sysfs attributes Logan Gunthorpe
2026-11-24 15:50 ` [PATCH v5 4/4] dmaengine: switchtec-dma: add pmon " Logan Gunthorpe
2026-11-24 15:59   ` sashiko-bot [this message]

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=sashiko-outbox-231501@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@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