[PATCH] thermal: sysfs: fix whitespace and use octal permissions

Mayur Kumar posted 1 patch 1 month ago
drivers/thermal/thermal_sysfs.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
[PATCH] thermal: sysfs: fix whitespace and use octal permissions
Posted by Mayur Kumar 1 month ago
Clean up thermal_sysfs.c by removing a space before a tab and
replacing symbolic permissions (S_IRUGO, S_IWUSR) with their
preferred octal equivalents (0444, 0200) to improve readability.

Signed-off-by: Mayur Kumar <kmayur809@gmail.com>
---
 drivers/thermal/thermal_sysfs.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 5eecae13f07..7cf6b0b060a 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -82,7 +82,7 @@ mode_store(struct device *dev, struct device_attribute *attr,
 }
 
 #define thermal_trip_of_attr(_ptr_, _attr_)				\
-	({ 								\
+	({\
 		struct thermal_trip_desc *td;				\
 									\
 		td = container_of(_ptr_, struct thermal_trip_desc,	\
@@ -405,7 +405,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz)
 
 		sysfs_attr_init(&trip_attrs->type.attr.attr);
 		trip_attrs->type.attr.attr.name = trip_attrs->type.name;
-		trip_attrs->type.attr.attr.mode = S_IRUGO;
+		trip_attrs->type.attr.attr.mode = 0444;
 		trip_attrs->type.attr.show = trip_point_type_show;
 		attrs[i] = &trip_attrs->type.attr.attr;
 
@@ -415,10 +415,10 @@ static int create_trip_attrs(struct thermal_zone_device *tz)
 
 		sysfs_attr_init(&trip_attrs->temp.attr.attr);
 		trip_attrs->temp.attr.attr.name = trip_attrs->temp.name;
-		trip_attrs->temp.attr.attr.mode = S_IRUGO;
+		trip_attrs->temp.attr.attr.mode = 0444;
 		trip_attrs->temp.attr.show = trip_point_temp_show;
 		if (td->trip.flags & THERMAL_TRIP_FLAG_RW_TEMP) {
-			trip_attrs->temp.attr.attr.mode |= S_IWUSR;
+			trip_attrs->temp.attr.attr.mode |= 0200;
 			trip_attrs->temp.attr.store = trip_point_temp_store;
 		}
 		attrs[i + tz->num_trips] = &trip_attrs->temp.attr.attr;
@@ -428,10 +428,10 @@ static int create_trip_attrs(struct thermal_zone_device *tz)
 
 		sysfs_attr_init(&trip_attrs->hyst.attr.attr);
 		trip_attrs->hyst.attr.attr.name = trip_attrs->hyst.name;
-		trip_attrs->hyst.attr.attr.mode = S_IRUGO;
+		trip_attrs->hyst.attr.attr.mode = 0444;
 		trip_attrs->hyst.attr.show = trip_point_hyst_show;
 		if (td->trip.flags & THERMAL_TRIP_FLAG_RW_HYST) {
-			trip_attrs->hyst.attr.attr.mode |= S_IWUSR;
+			trip_attrs->hyst.attr.attr.mode |= 0200;
 			trip_attrs->hyst.attr.store = trip_point_hyst_store;
 		}
 		attrs[i + 2 * tz->num_trips] = &trip_attrs->hyst.attr.attr;
-- 
2.34.1
Re: [PATCH] thermal: sysfs: fix whitespace and use octal permissions
Posted by Rafael J. Wysocki 1 month ago
On Mon, May 11, 2026 at 6:37 PM Mayur Kumar <kmayur809@gmail.com> wrote:
>
> Clean up thermal_sysfs.c by removing a space before a tab

So please do the white space cleanup separately if you care enough.

The permissions are correct as they are AFAICS.

> and replacing symbolic permissions (S_IRUGO, S_IWUSR) with their
> preferred octal equivalents (0444, 0200) to improve readability.
>
> Signed-off-by: Mayur Kumar <kmayur809@gmail.com>
> ---
>  drivers/thermal/thermal_sysfs.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
> index 5eecae13f07..7cf6b0b060a 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -82,7 +82,7 @@ mode_store(struct device *dev, struct device_attribute *attr,
>  }
>
>  #define thermal_trip_of_attr(_ptr_, _attr_)                            \
> -       ({                                                              \
> +       ({\
>                 struct thermal_trip_desc *td;                           \
>                                                                         \
>                 td = container_of(_ptr_, struct thermal_trip_desc,      \
> @@ -405,7 +405,7 @@ static int create_trip_attrs(struct thermal_zone_device *tz)
>
>                 sysfs_attr_init(&trip_attrs->type.attr.attr);
>                 trip_attrs->type.attr.attr.name = trip_attrs->type.name;
> -               trip_attrs->type.attr.attr.mode = S_IRUGO;
> +               trip_attrs->type.attr.attr.mode = 0444;
>                 trip_attrs->type.attr.show = trip_point_type_show;
>                 attrs[i] = &trip_attrs->type.attr.attr;
>
> @@ -415,10 +415,10 @@ static int create_trip_attrs(struct thermal_zone_device *tz)
>
>                 sysfs_attr_init(&trip_attrs->temp.attr.attr);
>                 trip_attrs->temp.attr.attr.name = trip_attrs->temp.name;
> -               trip_attrs->temp.attr.attr.mode = S_IRUGO;
> +               trip_attrs->temp.attr.attr.mode = 0444;
>                 trip_attrs->temp.attr.show = trip_point_temp_show;
>                 if (td->trip.flags & THERMAL_TRIP_FLAG_RW_TEMP) {
> -                       trip_attrs->temp.attr.attr.mode |= S_IWUSR;
> +                       trip_attrs->temp.attr.attr.mode |= 0200;
>                         trip_attrs->temp.attr.store = trip_point_temp_store;
>                 }
>                 attrs[i + tz->num_trips] = &trip_attrs->temp.attr.attr;
> @@ -428,10 +428,10 @@ static int create_trip_attrs(struct thermal_zone_device *tz)
>
>                 sysfs_attr_init(&trip_attrs->hyst.attr.attr);
>                 trip_attrs->hyst.attr.attr.name = trip_attrs->hyst.name;
> -               trip_attrs->hyst.attr.attr.mode = S_IRUGO;
> +               trip_attrs->hyst.attr.attr.mode = 0444;
>                 trip_attrs->hyst.attr.show = trip_point_hyst_show;
>                 if (td->trip.flags & THERMAL_TRIP_FLAG_RW_HYST) {
> -                       trip_attrs->hyst.attr.attr.mode |= S_IWUSR;
> +                       trip_attrs->hyst.attr.attr.mode |= 0200;
>                         trip_attrs->hyst.attr.store = trip_point_hyst_store;
>                 }
>                 attrs[i + 2 * tz->num_trips] = &trip_attrs->hyst.attr.attr;
> --
[PATCH v2] thermal: sysfs: remove space before tab in macro
Posted by Mayur Kumar 1 month ago
Signed-off-by: Mayur Kumar <kmayur809@gmail.com>
---
 drivers/thermal/thermal_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 5eecae13f07..15f269358e0 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -82,7 +82,7 @@ mode_store(struct device *dev, struct device_attribute *attr,
 }
 
 #define thermal_trip_of_attr(_ptr_, _attr_)				\
-	({ 								\
+	({\
 		struct thermal_trip_desc *td;				\
 									\
 		td = container_of(_ptr_, struct thermal_trip_desc,	\
-- 
2.34.1
Re: [PATCH v2] thermal: sysfs: remove space before tab in macro
Posted by Rafael J. Wysocki 3 weeks ago
On Mon, May 11, 2026 at 7:53 PM Mayur Kumar <kmayur809@gmail.com> wrote:
>
> Signed-off-by: Mayur Kumar <kmayur809@gmail.com>
> ---
>  drivers/thermal/thermal_sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
> index 5eecae13f07..15f269358e0 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -82,7 +82,7 @@ mode_store(struct device *dev, struct device_attribute *attr,
>  }
>
>  #define thermal_trip_of_attr(_ptr_, _attr_)                            \
> -       ({                                                              \
> +       ({\

Broken, but I fixed it up.

>                 struct thermal_trip_desc *td;                           \
>                                                                         \
>                 td = container_of(_ptr_, struct thermal_trip_desc,      \
> --

Applied as 7.2 material, thanks!