[PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const

Thomas Weißschuh posted 4 patches 5 hours ago
[PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const
Posted by Thomas Weißschuh 5 hours ago
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

Re: [PATCH 3/4] dmaengine: ioatdma: make ioat_ktype const
Posted by Dave Jiang 4 hours ago

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