[PATCH] iommu/sysfs: constify the class struct

Bartosz Golaszewski posted 1 patch 1 month, 1 week ago
drivers/iommu/iommu-sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] iommu/sysfs: constify the class struct
Posted by Bartosz Golaszewski 1 month, 1 week ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

All functions that take the class address as argument expect a const
pointer so we can make the iommu class constant.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/iommu/iommu-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommu-sysfs.c b/drivers/iommu/iommu-sysfs.c
index cbe378c34ba3..170022c09536 100644
--- a/drivers/iommu/iommu-sysfs.c
+++ b/drivers/iommu/iommu-sysfs.c
@@ -34,7 +34,7 @@ static void release_device(struct device *dev)
 	kfree(dev);
 }
 
-static struct class iommu_class = {
+static const struct class iommu_class = {
 	.name = "iommu",
 	.dev_release = release_device,
 	.dev_groups = dev_groups,
-- 
2.43.0
Re: [PATCH] iommu/sysfs: constify the class struct
Posted by Joerg Roedel 3 weeks, 6 days ago
On Fri, Oct 18, 2024 at 02:17:25PM +0200, Bartosz Golaszewski wrote:
>  drivers/iommu/iommu-sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.
Re: [PATCH] iommu/sysfs: constify the class struct
Posted by Jason Gunthorpe 1 month ago
On Fri, Oct 18, 2024 at 02:17:25PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> All functions that take the class address as argument expect a const
> pointer so we can make the iommu class constant.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>  drivers/iommu/iommu-sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason