[PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static

Thomas Weißschuh posted 4 patches 5 hours ago
[PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static
Posted by Thomas Weißschuh 5 hours ago
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

Re: [PATCH 1/4] dmaengine: ioatdma: make some sysfs structures static
Posted by Dave Jiang 4 hours ago

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,
>  };
>