mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] dmaengine: ioatdma: some sysfs cleanups and constifications
@ 2026-03-02 22:15 Thomas Weißschuh
  2026-03-02 22:15 ` [PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static Thomas Weißschuh
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Thomas Weißschuh @ 2026-03-02 22:15 UTC (permalink / raw)
  To: Vinod Koul, Frank Li; +Cc: dmaengine, linux-kernel, Thomas Weißschuh

Reduce the visibility of some symbols and make some structures readonly.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (4):
      dmaengine: ioatdma: make some sysfs structures static
      dmaengine: ioatdma: move sysfs entry definition out of header
      dmaengine: ioatdma: make ioat_ktype const
      dmaengine: ioatdma: make sysfs attributes const

 drivers/dma/ioat/dma.h   | 13 ++-----------
 drivers/dma/ioat/sysfs.c | 32 +++++++++++++++++++-------------
 2 files changed, 21 insertions(+), 24 deletions(-)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260302-sysfs-const-ioat-0e665141b26b

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static
  2026-03-02 22:15 [PATCH 0/4] dmaengine: ioatdma: some sysfs cleanups and constifications Thomas Weißschuh
@ 2026-03-02 22:15 ` Thomas Weißschuh
  2026-03-02 22:56   ` Dave Jiang
  2026-03-04 16:00   ` Frank Li
  2026-03-02 22:15 ` [PATCH 2/4] dmaengine: ioatdma: move sysfs entry definition out of header Thomas Weißschuh
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 11+ messages in thread
From: Thomas Weißschuh @ 2026-03-02 22:15 UTC (permalink / raw)
  To: Vinod Koul, Frank Li; +Cc: dmaengine, linux-kernel, Thomas Weißschuh

These structures are only used in sysfs.c, where are defined.

Make them static and remove them from the header.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/dma/ioat/dma.h   | 3 ---
 drivers/dma/ioat/sysfs.c | 6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index 12a4a4860a74..27d2b411853f 100644
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
@@ -195,9 +195,6 @@ struct ioat_ring_ent {
 	struct ioat_sed_ent *sed;
 };
 
-extern const struct sysfs_ops ioat_sysfs_ops;
-extern struct ioat_sysfs_entry ioat_version_attr;
-extern struct ioat_sysfs_entry ioat_cap_attr;
 extern int ioat_pending_level;
 extern struct kobj_type ioat_ktype;
 extern struct kmem_cache *ioat_cache;
diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
index 168adf28c5b1..5da9b0a7b2bb 100644
--- a/drivers/dma/ioat/sysfs.c
+++ b/drivers/dma/ioat/sysfs.c
@@ -26,7 +26,7 @@ static ssize_t cap_show(struct dma_chan *c, char *page)
 		       dma_has_cap(DMA_INTERRUPT, dma->cap_mask) ? " intr" : "");
 
 }
-struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap);
+static struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap);
 
 static ssize_t version_show(struct dma_chan *c, char *page)
 {
@@ -36,7 +36,7 @@ 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);
 }
-struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version);
+static struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version);
 
 static ssize_t
 ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
@@ -67,7 +67,7 @@ const char *page, size_t count)
 	return entry->store(&ioat_chan->dma_chan, page, count);
 }
 
-const struct sysfs_ops ioat_sysfs_ops = {
+static const struct sysfs_ops ioat_sysfs_ops = {
 	.show	= ioat_attr_show,
 	.store  = ioat_attr_store,
 };

-- 
2.53.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/4] dmaengine: ioatdma: move sysfs entry definition out of header
  2026-03-02 22:15 [PATCH 0/4] dmaengine: ioatdma: some sysfs cleanups and constifications Thomas Weißschuh
  2026-03-02 22:15 ` [PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static Thomas Weißschuh
@ 2026-03-02 22:15 ` Thomas Weißschuh
  2026-03-04 16:02   ` Frank Li
  2026-03-02 22:15 ` [PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const Thomas Weißschuh
  2026-03-02 22:15 ` [PATCH 4/4] dmaengine: ioatdma: make sysfs attributes const Thomas Weißschuh
  3 siblings, 1 reply; 11+ messages in thread
From: Thomas Weißschuh @ 2026-03-02 22:15 UTC (permalink / raw)
  To: Vinod Koul, Frank Li; +Cc: dmaengine, linux-kernel, Thomas Weißschuh

This structure is only ever used from sysfs.c.

Move its definition there.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/dma/ioat/dma.h   | 6 ------
 drivers/dma/ioat/sysfs.c | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index 27d2b411853f..e187f3a7e968 100644
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
@@ -140,12 +140,6 @@ struct ioatdma_chan {
 	int prev_intr_coalesce;
 };
 
-struct ioat_sysfs_entry {
-	struct attribute attr;
-	ssize_t (*show)(struct dma_chan *, char *);
-	ssize_t (*store)(struct dma_chan *, const char *, size_t);
-};
-
 /**
  * struct ioat_sed_ent - wrapper around super extended hardware descriptor
  * @hw: hardware SED
diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
index 5da9b0a7b2bb..709d672bae51 100644
--- a/drivers/dma/ioat/sysfs.c
+++ b/drivers/dma/ioat/sysfs.c
@@ -14,6 +14,12 @@
 
 #include "../dmaengine.h"
 
+struct ioat_sysfs_entry {
+	struct attribute attr;
+	ssize_t (*show)(struct dma_chan *, char *);
+	ssize_t (*store)(struct dma_chan *, const char *, size_t);
+};
+
 static ssize_t cap_show(struct dma_chan *c, char *page)
 {
 	struct dma_device *dma = c->device;

-- 
2.53.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const
  2026-03-02 22:15 [PATCH 0/4] dmaengine: ioatdma: some sysfs cleanups and constifications Thomas Weißschuh
  2026-03-02 22:15 ` [PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static Thomas Weißschuh
  2026-03-02 22:15 ` [PATCH 2/4] dmaengine: ioatdma: move sysfs entry definition out of header Thomas Weißschuh
@ 2026-03-02 22:15 ` Thomas Weißschuh
  2026-03-02 22:49   ` Dave Jiang
  2026-03-04 16:03   ` Frank Li
  2026-03-02 22:15 ` [PATCH 4/4] dmaengine: ioatdma: make sysfs attributes const Thomas Weißschuh
  3 siblings, 2 replies; 11+ messages in thread
From: Thomas Weißschuh @ 2026-03-02 22:15 UTC (permalink / raw)
  To: Vinod Koul, Frank Li; +Cc: dmaengine, linux-kernel, Thomas Weißschuh

This structure is never modified, mark is as read-only.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/dma/ioat/dma.h   | 4 ++--
 drivers/dma/ioat/sysfs.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index e187f3a7e968..e8a880f338c6 100644
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
@@ -190,7 +190,7 @@ struct ioat_ring_ent {
 };
 
 extern int ioat_pending_level;
-extern struct kobj_type ioat_ktype;
+extern const struct kobj_type ioat_ktype;
 extern struct kmem_cache *ioat_cache;
 extern struct kmem_cache *ioat_sed_cache;
 
@@ -393,7 +393,7 @@ void ioat_issue_pending(struct dma_chan *chan);
 /* IOAT Init functions */
 bool is_bwd_ioat(struct pci_dev *pdev);
 struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase);
-void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type);
+void ioat_kobject_add(struct ioatdma_device *ioat_dma, const struct kobj_type *type);
 void ioat_kobject_del(struct ioatdma_device *ioat_dma);
 int ioat_dma_setup_interrupts(struct ioatdma_device *ioat_dma);
 void ioat_stop(struct ioatdma_chan *ioat_chan);
diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
index 709d672bae51..da616365fef5 100644
--- a/drivers/dma/ioat/sysfs.c
+++ b/drivers/dma/ioat/sysfs.c
@@ -78,7 +78,7 @@ static const struct sysfs_ops ioat_sysfs_ops = {
 	.store  = ioat_attr_store,
 };
 
-void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type)
+void ioat_kobject_add(struct ioatdma_device *ioat_dma, const struct kobj_type *type)
 {
 	struct dma_device *dma = &ioat_dma->dma_dev;
 	struct dma_chan *c;
@@ -166,7 +166,7 @@ static struct attribute *ioat_attrs[] = {
 };
 ATTRIBUTE_GROUPS(ioat);
 
-struct kobj_type ioat_ktype = {
+const struct kobj_type ioat_ktype = {
 	.sysfs_ops = &ioat_sysfs_ops,
 	.default_groups = ioat_groups,
 };

-- 
2.53.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/4] dmaengine: ioatdma: make sysfs attributes const
  2026-03-02 22:15 [PATCH 0/4] dmaengine: ioatdma: some sysfs cleanups and constifications Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2026-03-02 22:15 ` [PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const Thomas Weißschuh
@ 2026-03-02 22:15 ` Thomas Weißschuh
  2026-03-02 22:50   ` Dave Jiang
  3 siblings, 1 reply; 11+ messages in thread
From: Thomas Weißschuh @ 2026-03-02 22:15 UTC (permalink / raw)
  To: Vinod Koul, Frank Li; +Cc: dmaengine, linux-kernel, Thomas Weißschuh

These structures are never modified, mark them as read-only.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const
  2026-03-02 22:15 ` [PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const Thomas Weißschuh
@ 2026-03-02 22:49   ` Dave Jiang
  2026-03-04 16:03   ` Frank Li
  1 sibling, 0 replies; 11+ messages in thread
From: Dave Jiang @ 2026-03-02 22:49 UTC (permalink / raw)
  To: Thomas Weißschuh, Vinod Koul, Frank Li; +Cc: dmaengine, linux-kernel



On 3/2/26 3:15 PM, Thomas Weißschuh wrote:
> This structure is never modified, mark is as read-only.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Acked-by: Dave Jiang <dave.jiang@intel.com>


> ---
>  drivers/dma/ioat/dma.h   | 4 ++--
>  drivers/dma/ioat/sysfs.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
> index e187f3a7e968..e8a880f338c6 100644
> --- a/drivers/dma/ioat/dma.h
> +++ b/drivers/dma/ioat/dma.h
> @@ -190,7 +190,7 @@ struct ioat_ring_ent {
>  };
>  
>  extern int ioat_pending_level;
> -extern struct kobj_type ioat_ktype;
> +extern const struct kobj_type ioat_ktype;
>  extern struct kmem_cache *ioat_cache;
>  extern struct kmem_cache *ioat_sed_cache;
>  
> @@ -393,7 +393,7 @@ void ioat_issue_pending(struct dma_chan *chan);
>  /* IOAT Init functions */
>  bool is_bwd_ioat(struct pci_dev *pdev);
>  struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase);
> -void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type);
> +void ioat_kobject_add(struct ioatdma_device *ioat_dma, const struct kobj_type *type);
>  void ioat_kobject_del(struct ioatdma_device *ioat_dma);
>  int ioat_dma_setup_interrupts(struct ioatdma_device *ioat_dma);
>  void ioat_stop(struct ioatdma_chan *ioat_chan);
> diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
> index 709d672bae51..da616365fef5 100644
> --- a/drivers/dma/ioat/sysfs.c
> +++ b/drivers/dma/ioat/sysfs.c
> @@ -78,7 +78,7 @@ static const struct sysfs_ops ioat_sysfs_ops = {
>  	.store  = ioat_attr_store,
>  };
>  
> -void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type)
> +void ioat_kobject_add(struct ioatdma_device *ioat_dma, const struct kobj_type *type)
>  {
>  	struct dma_device *dma = &ioat_dma->dma_dev;
>  	struct dma_chan *c;
> @@ -166,7 +166,7 @@ static struct attribute *ioat_attrs[] = {
>  };
>  ATTRIBUTE_GROUPS(ioat);
>  
> -struct kobj_type ioat_ktype = {
> +const struct kobj_type ioat_ktype = {
>  	.sysfs_ops = &ioat_sysfs_ops,
>  	.default_groups = ioat_groups,
>  };
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] dmaengine: ioatdma: make sysfs attributes const
  2026-03-02 22:15 ` [PATCH 4/4] dmaengine: ioatdma: make sysfs attributes const Thomas Weißschuh
@ 2026-03-02 22:50   ` Dave Jiang
  0 siblings, 0 replies; 11+ messages in thread
From: Dave Jiang @ 2026-03-02 22:50 UTC (permalink / raw)
  To: Thomas Weißschuh, Vinod Koul, Frank Li; +Cc: dmaengine, linux-kernel



On 3/2/26 3:15 PM, Thomas Weißschuh wrote:
> These structures are never modified, mark them as read-only.
> 
> 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,
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static
  2026-03-02 22:15 ` [PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static Thomas Weißschuh
@ 2026-03-02 22:56   ` Dave Jiang
  2026-03-04 16:00   ` Frank Li
  1 sibling, 0 replies; 11+ messages in thread
From: Dave Jiang @ 2026-03-02 22:56 UTC (permalink / raw)
  To: Thomas Weißschuh, Vinod Koul, Frank Li; +Cc: dmaengine, linux-kernel



On 3/2/26 3:15 PM, Thomas Weißschuh wrote:
> These structures are only used in sysfs.c, where are defined.
> 
> Make them static and remove them from the header.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Acked-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/dma/ioat/dma.h   | 3 ---
>  drivers/dma/ioat/sysfs.c | 6 +++---
>  2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
> index 12a4a4860a74..27d2b411853f 100644
> --- a/drivers/dma/ioat/dma.h
> +++ b/drivers/dma/ioat/dma.h
> @@ -195,9 +195,6 @@ struct ioat_ring_ent {
>  	struct ioat_sed_ent *sed;
>  };
>  
> -extern const struct sysfs_ops ioat_sysfs_ops;
> -extern struct ioat_sysfs_entry ioat_version_attr;
> -extern struct ioat_sysfs_entry ioat_cap_attr;
>  extern int ioat_pending_level;
>  extern struct kobj_type ioat_ktype;
>  extern struct kmem_cache *ioat_cache;
> diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
> index 168adf28c5b1..5da9b0a7b2bb 100644
> --- a/drivers/dma/ioat/sysfs.c
> +++ b/drivers/dma/ioat/sysfs.c
> @@ -26,7 +26,7 @@ static ssize_t cap_show(struct dma_chan *c, char *page)
>  		       dma_has_cap(DMA_INTERRUPT, dma->cap_mask) ? " intr" : "");
>  
>  }
> -struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap);
> +static struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap);
>  
>  static ssize_t version_show(struct dma_chan *c, char *page)
>  {
> @@ -36,7 +36,7 @@ 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);
>  }
> -struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version);
> +static struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version);
>  
>  static ssize_t
>  ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
> @@ -67,7 +67,7 @@ const char *page, size_t count)
>  	return entry->store(&ioat_chan->dma_chan, page, count);
>  }
>  
> -const struct sysfs_ops ioat_sysfs_ops = {
> +static const struct sysfs_ops ioat_sysfs_ops = {
>  	.show	= ioat_attr_show,
>  	.store  = ioat_attr_store,
>  };
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static
  2026-03-02 22:15 ` [PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static Thomas Weißschuh
  2026-03-02 22:56   ` Dave Jiang
@ 2026-03-04 16:00   ` Frank Li
  1 sibling, 0 replies; 11+ messages in thread
From: Frank Li @ 2026-03-04 16:00 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: Vinod Koul, Frank Li, dmaengine, linux-kernel

On Mon, Mar 02, 2026 at 11:15:53PM +0100, Thomas Weißschuh wrote:
> These structures are only used in sysfs.c, where are defined.
>
> Make them static and remove them from the header.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/dma/ioat/dma.h   | 3 ---
>  drivers/dma/ioat/sysfs.c | 6 +++---
>  2 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
> index 12a4a4860a74..27d2b411853f 100644
> --- a/drivers/dma/ioat/dma.h
> +++ b/drivers/dma/ioat/dma.h
> @@ -195,9 +195,6 @@ struct ioat_ring_ent {
>  	struct ioat_sed_ent *sed;
>  };
>
> -extern const struct sysfs_ops ioat_sysfs_ops;
> -extern struct ioat_sysfs_entry ioat_version_attr;
> -extern struct ioat_sysfs_entry ioat_cap_attr;
>  extern int ioat_pending_level;
>  extern struct kobj_type ioat_ktype;
>  extern struct kmem_cache *ioat_cache;
> diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
> index 168adf28c5b1..5da9b0a7b2bb 100644
> --- a/drivers/dma/ioat/sysfs.c
> +++ b/drivers/dma/ioat/sysfs.c
> @@ -26,7 +26,7 @@ static ssize_t cap_show(struct dma_chan *c, char *page)
>  		       dma_has_cap(DMA_INTERRUPT, dma->cap_mask) ? " intr" : "");
>
>  }
> -struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap);
> +static struct ioat_sysfs_entry ioat_cap_attr = __ATTR_RO(cap);
>
>  static ssize_t version_show(struct dma_chan *c, char *page)
>  {
> @@ -36,7 +36,7 @@ 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);
>  }
> -struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version);
> +static struct ioat_sysfs_entry ioat_version_attr = __ATTR_RO(version);
>
>  static ssize_t
>  ioat_attr_show(struct kobject *kobj, struct attribute *attr, char *page)
> @@ -67,7 +67,7 @@ const char *page, size_t count)
>  	return entry->store(&ioat_chan->dma_chan, page, count);
>  }
>
> -const struct sysfs_ops ioat_sysfs_ops = {
> +static const struct sysfs_ops ioat_sysfs_ops = {
>  	.show	= ioat_attr_show,
>  	.store  = ioat_attr_store,
>  };
>
> --
> 2.53.0
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] dmaengine: ioatdma: move sysfs entry definition out of header
  2026-03-02 22:15 ` [PATCH 2/4] dmaengine: ioatdma: move sysfs entry definition out of header Thomas Weißschuh
@ 2026-03-04 16:02   ` Frank Li
  0 siblings, 0 replies; 11+ messages in thread
From: Frank Li @ 2026-03-04 16:02 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: Vinod Koul, Frank Li, dmaengine, linux-kernel

On Mon, Mar 02, 2026 at 11:15:54PM +0100, Thomas Weißschuh wrote:
> This structure is only ever used from sysfs.c.
>
> Move its definition there.

better descript which structure.

Move struct ioat_sysfs_entry into sysfs.c because it is only used in it.

Frank

>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  drivers/dma/ioat/dma.h   | 6 ------
>  drivers/dma/ioat/sysfs.c | 6 ++++++
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
> index 27d2b411853f..e187f3a7e968 100644
> --- a/drivers/dma/ioat/dma.h
> +++ b/drivers/dma/ioat/dma.h
> @@ -140,12 +140,6 @@ struct ioatdma_chan {
>  	int prev_intr_coalesce;
>  };
>
> -struct ioat_sysfs_entry {
> -	struct attribute attr;
> -	ssize_t (*show)(struct dma_chan *, char *);
> -	ssize_t (*store)(struct dma_chan *, const char *, size_t);
> -};
> -
>  /**
>   * struct ioat_sed_ent - wrapper around super extended hardware descriptor
>   * @hw: hardware SED
> diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
> index 5da9b0a7b2bb..709d672bae51 100644
> --- a/drivers/dma/ioat/sysfs.c
> +++ b/drivers/dma/ioat/sysfs.c
> @@ -14,6 +14,12 @@
>
>  #include "../dmaengine.h"
>
> +struct ioat_sysfs_entry {
> +	struct attribute attr;
> +	ssize_t (*show)(struct dma_chan *, char *);
> +	ssize_t (*store)(struct dma_chan *, const char *, size_t);
> +};
> +
>  static ssize_t cap_show(struct dma_chan *c, char *page)
>  {
>  	struct dma_device *dma = c->device;
>
> --
> 2.53.0
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const
  2026-03-02 22:15 ` [PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const Thomas Weißschuh
  2026-03-02 22:49   ` Dave Jiang
@ 2026-03-04 16:03   ` Frank Li
  1 sibling, 0 replies; 11+ messages in thread
From: Frank Li @ 2026-03-04 16:03 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: Vinod Koul, Frank Li, dmaengine, linux-kernel

On Mon, Mar 02, 2026 at 11:15:55PM +0100, Thomas Weißschuh wrote:
> This structure is never modified, mark is as read-only.

ioat_ktype is never modified, so make it const.

Frank
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  drivers/dma/ioat/dma.h   | 4 ++--
>  drivers/dma/ioat/sysfs.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
> index e187f3a7e968..e8a880f338c6 100644
> --- a/drivers/dma/ioat/dma.h
> +++ b/drivers/dma/ioat/dma.h
> @@ -190,7 +190,7 @@ struct ioat_ring_ent {
>  };
>
>  extern int ioat_pending_level;
> -extern struct kobj_type ioat_ktype;
> +extern const struct kobj_type ioat_ktype;
>  extern struct kmem_cache *ioat_cache;
>  extern struct kmem_cache *ioat_sed_cache;
>
> @@ -393,7 +393,7 @@ void ioat_issue_pending(struct dma_chan *chan);
>  /* IOAT Init functions */
>  bool is_bwd_ioat(struct pci_dev *pdev);
>  struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase);
> -void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type);
> +void ioat_kobject_add(struct ioatdma_device *ioat_dma, const struct kobj_type *type);
>  void ioat_kobject_del(struct ioatdma_device *ioat_dma);
>  int ioat_dma_setup_interrupts(struct ioatdma_device *ioat_dma);
>  void ioat_stop(struct ioatdma_chan *ioat_chan);
> diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
> index 709d672bae51..da616365fef5 100644
> --- a/drivers/dma/ioat/sysfs.c
> +++ b/drivers/dma/ioat/sysfs.c
> @@ -78,7 +78,7 @@ static const struct sysfs_ops ioat_sysfs_ops = {
>  	.store  = ioat_attr_store,
>  };
>
> -void ioat_kobject_add(struct ioatdma_device *ioat_dma, struct kobj_type *type)
> +void ioat_kobject_add(struct ioatdma_device *ioat_dma, const struct kobj_type *type)
>  {
>  	struct dma_device *dma = &ioat_dma->dma_dev;
>  	struct dma_chan *c;
> @@ -166,7 +166,7 @@ static struct attribute *ioat_attrs[] = {
>  };
>  ATTRIBUTE_GROUPS(ioat);
>
> -struct kobj_type ioat_ktype = {
> +const struct kobj_type ioat_ktype = {
>  	.sysfs_ops = &ioat_sysfs_ops,
>  	.default_groups = ioat_groups,
>  };
>
> --
> 2.53.0
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-03-04 16:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-02 22:15 [PATCH 0/4] dmaengine: ioatdma: some sysfs cleanups and constifications Thomas Weißschuh
2026-03-02 22:15 ` [PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static Thomas Weißschuh
2026-03-02 22:56   ` Dave Jiang
2026-03-04 16:00   ` Frank Li
2026-03-02 22:15 ` [PATCH 2/4] dmaengine: ioatdma: move sysfs entry definition out of header Thomas Weißschuh
2026-03-04 16:02   ` Frank Li
2026-03-02 22:15 ` [PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const Thomas Weißschuh
2026-03-02 22:49   ` Dave Jiang
2026-03-04 16:03   ` Frank Li
2026-03-02 22:15 ` [PATCH 4/4] dmaengine: ioatdma: make sysfs attributes const Thomas Weißschuh
2026-03-02 22:50   ` Dave Jiang

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®