mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dave Jiang <dave.jiang@intel.com>
Subject: Re: [PATCH v2 4/4] dmaengine: ioatdma: make sysfs attributes const
Date: Wed, 4 Mar 2026 22:36:06 -0500	[thread overview]
Message-ID: <aaj6JtGjAszUlmRu@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260304-sysfs-const-ioat-v2-4-b9b82651219b@weissschuh.net>

On Wed, Mar 04, 2026 at 10:44:40PM +0100, Thomas Weißschuh wrote:
> The ioat_sysfs_entry structures are never modified, mark them as
> read-only.

Nit: if there are chance to respin it, s/read-only/const/

Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> Acked-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/dma/ioat/sysfs.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
> index da616365fef5..e796ddb5383f 100644
> --- a/drivers/dma/ioat/sysfs.c
> +++ b/drivers/dma/ioat/sysfs.c
> @@ -32,7 +32,7 @@ static ssize_t cap_show(struct dma_chan *c, char *page)
>  		       dma_has_cap(DMA_INTERRUPT, dma->cap_mask) ? " intr" : "");
>
>  }
> -static struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap);
> +static const struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap);
>
>  static ssize_t version_show(struct dma_chan *c, char *page)
>  {
> @@ -42,15 +42,15 @@ static ssize_t version_show(struct dma_chan *c, char *page)
>  	return sprintf(page, "%d.%d\n",
>  		       ioat_dma->version >> 4, ioat_dma->version & 0xf);
>  }
> -static struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version);
> +static const struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version);
>
>  static ssize_t
>  ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
>  {
> -	struct ioat_sysfs_entry *entry;
> +	const struct ioat_sysfs_entry *entry;
>  	struct ioatdma_chan *ioat_chan;
>
> -	entry = container_of(attr, struct ioat_sysfs_entry, attr);
> +	entry = container_of_const(attr, struct ioat_sysfs_entry, attr);
>  	ioat_chan = container_of(kobj, struct ioatdma_chan, kobj);
>
>  	if (!entry->show)
> @@ -62,10 +62,10 @@ static ssize_t
>  ioat_attr_store(struct kobject *kobj, struct attribute *attr,
>  const char *page, size_t count)
>  {
> -	struct ioat_sysfs_entry *entry;
> +	const struct ioat_sysfs_entry *entry;
>  	struct ioatdma_chan *ioat_chan;
>
> -	entry = container_of(attr, struct ioat_sysfs_entry, attr);
> +	entry = container_of_const(attr, struct ioat_sysfs_entry, attr);
>  	ioat_chan = container_of(kobj, struct ioatdma_chan, kobj);
>
>  	if (!entry->store)
> @@ -120,7 +120,7 @@ static ssize_t ring_size_show(struct dma_chan *c, char *page)
>
>  	return sprintf(page, "%d\n", (1 << ioat_chan->alloc_order) & ~1);
>  }
> -static struct ioat_sysfs_entry ring_size_attr = __ATTR_RO(ring_size);
> +static const struct ioat_sysfs_entry ring_size_attr = __ATTR_RO(ring_size);
>
>  static ssize_t ring_active_show(struct dma_chan *c, char *page)
>  {
> @@ -129,7 +129,7 @@ static ssize_t ring_active_show(struct dma_chan *c, char *page)
>  	/* ...taken outside the lock, no need to be precise */
>  	return sprintf(page, "%d\n", ioat_ring_active(ioat_chan));
>  }
> -static struct ioat_sysfs_entry ring_active_attr = __ATTR_RO(ring_active);
> +static const struct ioat_sysfs_entry ring_active_attr = __ATTR_RO(ring_active);
>
>  static ssize_t intr_coalesce_show(struct dma_chan *c, char *page)
>  {
> @@ -154,9 +154,9 @@ size_t count)
>  	return count;
>  }
>
> -static struct ioat_sysfs_entry intr_coalesce_attr = __ATTR_RW(intr_coalesce);
> +static const struct ioat_sysfs_entry intr_coalesce_attr = __ATTR_RW(intr_coalesce);
>
> -static struct attribute *ioat_attrs[] = {
> +static const struct attribute *const ioat_attrs[] = {
>  	&ring_size_attr.attr,
>  	&ring_active_attr.attr,
>  	&ioat_cap_attr.attr,
>
> --
> 2.53.0
>

  reply	other threads:[~2026-03-05  3:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 21:44 [PATCH v2 0/4] dmaengine: ioatdma: some sysfs cleanups and constifications Thomas Weißschuh
2026-03-04 21:44 ` [PATCH v2 1/4] dmaengine: ioatdma: make some sysfs structures static Thomas Weißschuh
2026-03-04 21:44 ` [PATCH v2 2/4] dmaengine: ioatdma: move sysfs entry definition out of header Thomas Weißschuh
2026-03-04 22:12   ` Dave Jiang
2026-03-05  3:37   ` Frank Li
2026-03-04 21:44 ` [PATCH v2 3/4] dmaengine: ioatdma: make ioat_ktype const Thomas Weißschuh
2026-03-05  3:36   ` Frank Li
2026-03-04 21:44 ` [PATCH v2 4/4] dmaengine: ioatdma: make sysfs attributes const Thomas Weißschuh
2026-03-05  3:36   ` Frank Li [this message]
2026-03-09  7:46 ` [PATCH v2 0/4] dmaengine: ioatdma: some sysfs cleanups and constifications Vinod Koul

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=aaj6JtGjAszUlmRu@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=Frank.Li@kernel.org \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --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

all inboxes | Powered by JetHome®