[PATCH] hwmon: (core) Make hwmon_class const

Thomas Weißschuh posted 1 patch 1 year, 8 months ago
drivers/hwmon/hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] hwmon: (core) Make hwmon_class const
Posted by Thomas Weißschuh 1 year, 8 months ago
Now that the driver core allows for struct class to be in read-only
memory, mark hwmon_class as const.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/hwmon/hwmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 3b259c425ab7..1d1451dd239d 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -136,7 +136,7 @@ static void hwmon_dev_release(struct device *dev)
 	kfree(hwdev);
 }
 
-static struct class hwmon_class = {
+static const struct class hwmon_class = {
 	.name = "hwmon",
 	.dev_groups = hwmon_dev_attr_groups,
 	.dev_release = hwmon_dev_release,

---
base-commit: d20f6b3d747c36889b7ce75ee369182af3decb6b
change-id: 20240614-class-const-hwmon-556014c02b70

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

Re: [PATCH] hwmon: (core) Make hwmon_class const
Posted by Guenter Roeck 1 year, 8 months ago
On Fri, Jun 14, 2024 at 01:01:42AM +0200, Thomas Weißschuh wrote:
> Now that the driver core allows for struct class to be in read-only
> memory, mark hwmon_class as const.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/hwmon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 
> ---
> base-commit: d20f6b3d747c36889b7ce75ee369182af3decb6b
> change-id: 20240614-class-const-hwmon-556014c02b70
> 
> Best regards,
> 
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index 3b259c425ab7..1d1451dd239d 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -136,7 +136,7 @@ static void hwmon_dev_release(struct device *dev)
>  	kfree(hwdev);
>  }
>  
> -static struct class hwmon_class = {
> +static const struct class hwmon_class = {
>  	.name = "hwmon",
>  	.dev_groups = hwmon_dev_attr_groups,
>  	.dev_release = hwmon_dev_release,