linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powercap: Replace symbolic permissions with octal permissions
@ 2021-06-24  8:44 Jinchao Wang
  2021-06-30 17:41 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Jinchao Wang @ 2021-06-24  8:44 UTC (permalink / raw)
  To: rjw; +Cc: linux-kernel, wjc, linux-pm

Resolve following checkpatch issue,
Replace symbolic permissions with octal permissions

Signed-off-by: Jinchao Wang <wjc@cdjrlc.com>
---
 drivers/powercap/powercap_sys.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
index f0654a932b37..e706548c59bb 100644
--- a/drivers/powercap/powercap_sys.c
+++ b/drivers/powercap/powercap_sys.c
@@ -223,46 +223,46 @@ static int seed_constraint_attributes(void)
 
 	for (i = 0; i < MAX_CONSTRAINTS_PER_ZONE; ++i) {
 		ret = create_constraint_attribute(i, "power_limit_uw",
-					S_IWUSR | S_IRUGO,
+					0644,
 					&constraint_attrs[i].power_limit_attr,
 					show_constraint_power_limit_uw,
 					store_constraint_power_limit_uw);
 		if (ret)
 			goto err_alloc;
 		ret = create_constraint_attribute(i, "time_window_us",
-					S_IWUSR | S_IRUGO,
+					0644,
 					&constraint_attrs[i].time_window_attr,
 					show_constraint_time_window_us,
 					store_constraint_time_window_us);
 		if (ret)
 			goto err_alloc;
-		ret = create_constraint_attribute(i, "name", S_IRUGO,
+		ret = create_constraint_attribute(i, "name", 0444,
 				&constraint_attrs[i].name_attr,
 				show_constraint_name,
 				NULL);
 		if (ret)
 			goto err_alloc;
-		ret = create_constraint_attribute(i, "max_power_uw", S_IRUGO,
+		ret = create_constraint_attribute(i, "max_power_uw", 0444,
 				&constraint_attrs[i].max_power_attr,
 				show_constraint_max_power_uw,
 				NULL);
 		if (ret)
 			goto err_alloc;
-		ret = create_constraint_attribute(i, "min_power_uw", S_IRUGO,
+		ret = create_constraint_attribute(i, "min_power_uw", 0444,
 				&constraint_attrs[i].min_power_attr,
 				show_constraint_min_power_uw,
 				NULL);
 		if (ret)
 			goto err_alloc;
 		ret = create_constraint_attribute(i, "max_time_window_us",
-				S_IRUGO,
+				0444,
 				&constraint_attrs[i].max_time_window_attr,
 				show_constraint_max_time_window_us,
 				NULL);
 		if (ret)
 			goto err_alloc;
 		ret = create_constraint_attribute(i, "min_time_window_us",
-				S_IRUGO,
+				0444,
 				&constraint_attrs[i].min_time_window_attr,
 				show_constraint_min_time_window_us,
 				NULL);
@@ -366,9 +366,9 @@ static void create_power_zone_common_attributes(
 					&dev_attr_max_energy_range_uj.attr;
 	if (power_zone->ops->get_energy_uj) {
 		if (power_zone->ops->reset_energy_uj)
-			dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUSR;
+			dev_attr_energy_uj.attr.mode = 0600;
 		else
-			dev_attr_energy_uj.attr.mode = S_IRUSR;
+			dev_attr_energy_uj.attr.mode = 0400;
 		power_zone->zone_dev_attrs[count++] =
 					&dev_attr_energy_uj.attr;
 	}
-- 
2.31.1




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

* Re: [PATCH] powercap: Replace symbolic permissions with octal permissions
  2021-06-24  8:44 [PATCH] powercap: Replace symbolic permissions with octal permissions Jinchao Wang
@ 2021-06-30 17:41 ` Rafael J. Wysocki
  2021-06-30 18:00   ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2021-06-30 17:41 UTC (permalink / raw)
  To: Jinchao Wang; +Cc: Rafael J. Wysocki, Linux Kernel Mailing List, Linux PM

On Thu, Jun 24, 2021 at 10:44 AM Jinchao Wang <wjc@cdjrlc.com> wrote:
>
> Resolve following checkpatch issue,
> Replace symbolic permissions with octal permissions

I don't see much value in this replacement and checkpatch complaining
about the existing code base is not something to worry about in
general.

> Signed-off-by: Jinchao Wang <wjc@cdjrlc.com>
> ---
>  drivers/powercap/powercap_sys.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
> index f0654a932b37..e706548c59bb 100644
> --- a/drivers/powercap/powercap_sys.c
> +++ b/drivers/powercap/powercap_sys.c
> @@ -223,46 +223,46 @@ static int seed_constraint_attributes(void)
>
>         for (i = 0; i < MAX_CONSTRAINTS_PER_ZONE; ++i) {
>                 ret = create_constraint_attribute(i, "power_limit_uw",
> -                                       S_IWUSR | S_IRUGO,
> +                                       0644,
>                                         &constraint_attrs[i].power_limit_attr,
>                                         show_constraint_power_limit_uw,
>                                         store_constraint_power_limit_uw);
>                 if (ret)
>                         goto err_alloc;
>                 ret = create_constraint_attribute(i, "time_window_us",
> -                                       S_IWUSR | S_IRUGO,
> +                                       0644,
>                                         &constraint_attrs[i].time_window_attr,
>                                         show_constraint_time_window_us,
>                                         store_constraint_time_window_us);
>                 if (ret)
>                         goto err_alloc;
> -               ret = create_constraint_attribute(i, "name", S_IRUGO,
> +               ret = create_constraint_attribute(i, "name", 0444,
>                                 &constraint_attrs[i].name_attr,
>                                 show_constraint_name,
>                                 NULL);
>                 if (ret)
>                         goto err_alloc;
> -               ret = create_constraint_attribute(i, "max_power_uw", S_IRUGO,
> +               ret = create_constraint_attribute(i, "max_power_uw", 0444,
>                                 &constraint_attrs[i].max_power_attr,
>                                 show_constraint_max_power_uw,
>                                 NULL);
>                 if (ret)
>                         goto err_alloc;
> -               ret = create_constraint_attribute(i, "min_power_uw", S_IRUGO,
> +               ret = create_constraint_attribute(i, "min_power_uw", 0444,
>                                 &constraint_attrs[i].min_power_attr,
>                                 show_constraint_min_power_uw,
>                                 NULL);
>                 if (ret)
>                         goto err_alloc;
>                 ret = create_constraint_attribute(i, "max_time_window_us",
> -                               S_IRUGO,
> +                               0444,
>                                 &constraint_attrs[i].max_time_window_attr,
>                                 show_constraint_max_time_window_us,
>                                 NULL);
>                 if (ret)
>                         goto err_alloc;
>                 ret = create_constraint_attribute(i, "min_time_window_us",
> -                               S_IRUGO,
> +                               0444,
>                                 &constraint_attrs[i].min_time_window_attr,
>                                 show_constraint_min_time_window_us,
>                                 NULL);
> @@ -366,9 +366,9 @@ static void create_power_zone_common_attributes(
>                                         &dev_attr_max_energy_range_uj.attr;
>         if (power_zone->ops->get_energy_uj) {
>                 if (power_zone->ops->reset_energy_uj)
> -                       dev_attr_energy_uj.attr.mode = S_IWUSR | S_IRUSR;
> +                       dev_attr_energy_uj.attr.mode = 0600;
>                 else
> -                       dev_attr_energy_uj.attr.mode = S_IRUSR;
> +                       dev_attr_energy_uj.attr.mode = 0400;
>                 power_zone->zone_dev_attrs[count++] =
>                                         &dev_attr_energy_uj.attr;
>         }
> --
> 2.31.1
>
>
>

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

* Re: [PATCH] powercap: Replace symbolic permissions with octal permissions
  2021-06-30 17:41 ` Rafael J. Wysocki
@ 2021-06-30 18:00   ` Joe Perches
  0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2021-06-30 18:00 UTC (permalink / raw)
  To: Rafael J. Wysocki, Jinchao Wang
  Cc: Rafael J. Wysocki, Linux Kernel Mailing List, Linux PM

On Wed, 2021-06-30 at 19:41 +0200, Rafael J. Wysocki wrote:
> On Thu, Jun 24, 2021 at 10:44 AM Jinchao Wang <wjc@cdjrlc.com> wrote:
> > 
> > Resolve following checkpatch issue,
> > Replace symbolic permissions with octal permissions
> 
> I don't see much value in this replacement and checkpatch complaining
> about the existing code base is not something to worry about in
> general.

https://lore.kernel.org/lkml/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com/

I do agree that in general checkpatch should not really be used as
the sole argument in favor of changing existing code.

So removing the "resolve following checkpatch issue" from the
commit message and replacing it with something like "to improve
readability" would be better.



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

end of thread, other threads:[~2021-06-30 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  8:44 [PATCH] powercap: Replace symbolic permissions with octal permissions Jinchao Wang
2021-06-30 17:41 ` Rafael J. Wysocki
2021-06-30 18:00   ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).