All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (core) Constify PEC device attribute
@ 2026-08-07 20:06 Thomas Weißschuh
  2026-08-07 20:15 ` sashiko-bot
  2026-08-07 21:07 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2026-08-07 20:06 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-hwmon, linux-kernel, Thomas Weißschuh

Mark the attribute structure as const, as it is never modified.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
This should have been part of commit 5d27101b6f1c ("hwmon: (core)
Constify device attributes"). If you do a rebase anyways, maybe you
could fold them together.
---
 drivers/hwmon/hwmon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 90ceb815f43e..3297ed6daec1 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -341,7 +341,7 @@ static int hwmon_match_device(struct device *dev, const void *data)
 	return dev->class == &hwmon_class;
 }
 
-static ssize_t pec_show(struct device *dev, struct device_attribute *dummy,
+static ssize_t pec_show(struct device *dev, const struct device_attribute *dummy,
 			char *buf)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -349,7 +349,7 @@ static ssize_t pec_show(struct device *dev, struct device_attribute *dummy,
 	return sysfs_emit(buf, "%d\n", !!(client->flags & I2C_CLIENT_PEC));
 }
 
-static ssize_t pec_store(struct device *dev, struct device_attribute *devattr,
+static ssize_t pec_store(struct device *dev, const struct device_attribute *devattr,
 			 const char *buf, size_t count)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -390,7 +390,7 @@ static ssize_t pec_store(struct device *dev, struct device_attribute *devattr,
 	return err;
 }
 
-static DEVICE_ATTR_RW(pec);
+static const DEVICE_ATTR_RW(pec);
 
 static void hwmon_remove_pec(void *dev)
 {

---
base-commit: 611f4cbac429c09a7db4bb2aebf64e3423109639
change-id: 20260807-sysfs-const-attr-hwmon-2-43bd646c0c67

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


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

* Re: [PATCH] hwmon: (core) Constify PEC device attribute
  2026-08-07 20:06 [PATCH] hwmon: (core) Constify PEC device attribute Thomas Weißschuh
@ 2026-08-07 20:15 ` sashiko-bot
  2026-08-07 21:07 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-08-07 20:15 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: linux-hwmon

> Mark the attribute structure as const, as it is never modified.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260807-sysfs-const-attr-hwmon-2-v1-1-d16341379a97@weissschuh.net?part=1


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

* Re: [PATCH] hwmon: (core) Constify PEC device attribute
  2026-08-07 20:06 [PATCH] hwmon: (core) Constify PEC device attribute Thomas Weißschuh
  2026-08-07 20:15 ` sashiko-bot
@ 2026-08-07 21:07 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2026-08-07 21:07 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: linux-hwmon, linux-kernel

On Fri, Aug 07, 2026 at 10:06:17PM +0200, Thomas Weißschuh wrote:
> Mark the attribute structure as const, as it is never modified.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> This should have been part of commit 5d27101b6f1c ("hwmon: (core)
> Constify device attributes"). If you do a rebase anyways, maybe you
> could fold them together.

I'll do that.

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/hwmon.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> 
> ---
> base-commit: 611f4cbac429c09a7db4bb2aebf64e3423109639
> change-id: 20260807-sysfs-const-attr-hwmon-2-43bd646c0c67
> 
> Best regards,
> --  
> Thomas Weißschuh <linux@weissschuh.net>
> 
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index 90ceb815f43e..3297ed6daec1 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -341,7 +341,7 @@ static int hwmon_match_device(struct device *dev, const void *data)
>  	return dev->class == &hwmon_class;
>  }
>  
> -static ssize_t pec_show(struct device *dev, struct device_attribute *dummy,
> +static ssize_t pec_show(struct device *dev, const struct device_attribute *dummy,
>  			char *buf)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
> @@ -349,7 +349,7 @@ static ssize_t pec_show(struct device *dev, struct device_attribute *dummy,
>  	return sysfs_emit(buf, "%d\n", !!(client->flags & I2C_CLIENT_PEC));
>  }
>  
> -static ssize_t pec_store(struct device *dev, struct device_attribute *devattr,
> +static ssize_t pec_store(struct device *dev, const struct device_attribute *devattr,
>  			 const char *buf, size_t count)
>  {
>  	struct i2c_client *client = to_i2c_client(dev);
> @@ -390,7 +390,7 @@ static ssize_t pec_store(struct device *dev, struct device_attribute *devattr,
>  	return err;
>  }
>  
> -static DEVICE_ATTR_RW(pec);
> +static const DEVICE_ATTR_RW(pec);
>  
>  static void hwmon_remove_pec(void *dev)
>  {

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

end of thread, other threads:[~2026-08-07 21:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07 20:06 [PATCH] hwmon: (core) Constify PEC device attribute Thomas Weißschuh
2026-08-07 20:15 ` sashiko-bot
2026-08-07 21:07 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.