Staging: gasket: Replace symbolic permissions with octal permissions
PATCH 1/1 Staging: gasket: Replace symbolic permissions with octal permissions
This patch fixes the checkpatch.pl warning:
WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
--- drivers/staging/gasket/gasket_sysfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/gasket/gasket_sysfs.h +2 -2
@@ -40,7 +40,7 @@*/ #define GASKET_END_OF_ATTR_ARRAY \ { \ - .attr = __ATTR(GASKET_ARRAY_END_TOKEN, S_IRUGO, NULL, NULL), \ + .attr = __ATTR(GASKET_ARRAY_END_TOKEN, 0444, NULL, NULL), \ .data.attr_type = 0, \ }
@@ -75,7 +75,7 @@ struct gasket_sysfs_attribute {#define GASKET_SYSFS_RO (_name, _show_function, _attr_type) \ { \ - .attr = __ATTR(_name, S_IRUGO, _show_function, NULL), \ + .attr = __ATTR(_name, 0444, _show_function, NULL), \ .data.attr_type = _attr_type \ }
Signature · 1 line
2.17.1
Greg Kroah-Hartman
maintainerQuoted 13 lines · Wentao Cai
This patch fixes the checkpatch.pl warning:
WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.Signed-off-by Wentao Cai <[email protected]>--- drivers/staging/gasket/gasket_sysfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/gasket/gasket_sysfs.h +0
-0
drivers/staging/gasket/gasket_sysfs.h line 43
Quoted 5 lines
drivers/staging/gasket/gasket_sysfs.h +1
-1@@ -40,7 +40,7 @@*/ #define GASKET_END_OF_ATTR_ARRAY \ { \ - .attr = __ATTR(GASKET_ARRAY_END_TOKEN, S_IRUGO, NULL, NULL), \ + .attr = __ATTR(GASKET_ARRAY_END_TOKEN, 0444, NULL, NULL), \
This is fun, it keeps coming up and no one looks in the archives to see why I keep rejecting it :)
This should be __ATTR_NULL(), but really, the whole macro can be deleted.
drivers/staging/gasket/gasket_sysfs.h struct gasket_sysfs_attribute { · line 78
Quoted 9 lines
drivers/staging/gasket/gasket_sysfs.h +1
-1.data.attr_type = 0, \ }@@ -75,7 +75,7 @@ struct gasket_sysfs_attribute {#define GASKET_SYSFS_RO (_name, _show_function, _attr_type) \ { \ - .attr = __ATTR(_name, S_IRUGO, _show_function, NULL), \ + .attr = __ATTR(_name, 0444, _show_function, NULL), \
__ATTR_RO() please.
thanks,
greg k-h
Sorry Greg, I'll check the archive first next time, before I send my patches.
Wentao Cai
Quoted 53 lines · 在 2019年3月1日星期五 UTC+8下午4:19:07,gregkh写道:
Quoted 2 lines · Wentao Cai
This patch fixes the checkpatch.pl warning:
WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Considerusing octal permissions '0444'.
Review
Quoted 7 lines
Signed-off-by Wentao Cai <[email protected] <javascript:>>---
drivers/staging/gasket/gasket_sysfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/staging/gasket/gasket_sysfs.hdrivers/staging/gasket/gasket_sysfs.h line 41
Quoted 6 lines
index
151e8edd28ea..708ee43175ba100644drivers/staging/gasket/gasket_sysfs.h +0
-0@@ -40,7 +40,7 @@*/ #define GASKET_END_OF_ATTR_ARRAY \drivers/staging/gasket/gasket_sysfs.h line 42
Quoted 1 line
drivers/staging/gasket/gasket_sysfs.h +0
-0{\drivers/staging/gasket/gasket_sysfs.h line 43
Quoted 1 line
drivers/staging/gasket/gasket_sysfs.h +0
-1- .attr = __ATTR(GASKET_ARRAY_END_TOKEN, S_IRUGO, NULL,NULL), \
drivers/staging/gasket/gasket_sysfs.h line 43
Quoted 1 line
drivers/staging/gasket/gasket_sysfs.h +1
-0+ .attr = __ATTR(GASKET_ARRAY_END_TOKEN, 0444, NULL,NULL), \
This is fun, it keeps coming up and no one looks in the archives to see why I keep rejecting it :)
This should be
__ATTR_NULL(), but really, the whole macro can be deleted.drivers/staging/gasket/gasket_sysfs.h line 44
Quoted 1 line
drivers/staging/gasket/gasket_sysfs.h +0
-0.data.attr_type = 0,\drivers/staging/gasket/gasket_sysfs.h struct gasket_sysfs_attribute { · line 76
Quoted 5 lines
drivers/staging/gasket/gasket_sysfs.h +0
-0}@@ -75,7 +75,7 @@ struct gasket_sysfs_attribute {#define GASKET_SYSFS_RO (_name, _show_function, _attr_type)\drivers/staging/gasket/gasket_sysfs.h struct gasket_sysfs_attribute { · line 77
Quoted 1 line
drivers/staging/gasket/gasket_sysfs.h +0
-0{\drivers/staging/gasket/gasket_sysfs.h struct gasket_sysfs_attribute { · line 78
Quoted 1 line
drivers/staging/gasket/gasket_sysfs.h +0
-1- .attr = __ATTR(_name, S_IRUGO, _show_function, NULL),\drivers/staging/gasket/gasket_sysfs.h struct gasket_sysfs_attribute { · line 78
Quoted 1 line
drivers/staging/gasket/gasket_sysfs.h +1
-0+ .attr = __ATTR(_name, 0444, _show_function, NULL),\
__ATTR_RO()please.thanks,
greg k-h
Quoted 17 lines · gregkh
This is fun, it keeps coming up and no one looks in the archives to see why I keep rejecting it :)
This should be
__ATTR_NULL(), but really, the whole macro can be deleted.Quoted 1 line
.data.attr_type = 0,\Review struct gasket_sysfs_attribute { · line 76
Quoted 5 lines
}(quoted diff) +0
-0@@ -75,7 +75,7 @@ struct gasket_sysfs_attribute { #define GASKET_SYSFS_RO(_name, _show_function, _attr_type)\Review struct gasket_sysfs_attribute { · line 77
Quoted 1 line
(quoted diff) +0
-0{\
Quoted 8 lines
Review struct gasket_sysfs_attribute { · line 78
Quoted 1 line
(quoted diff) +0
-1- .attr = __ATTR(_name, S_IRUGO, _show_function, NULL),\Review struct gasket_sysfs_attribute { · line 78
Quoted 1 line
(quoted diff) +1
-0+ .attr = __ATTR(_name, 0444, _show_function, NULL),\
__ATTR_RO()please.Hi. I just submit a patch to fix the first
__ATTR_NULL, but I have some
question about the latter one.
I understand it is better to use read only attribute here, but by changing __ATTR to __ATTR_RO, since the new macro does not need the _show_function parameter:
Quoted 5 lines
(
linux/sysfs.h, line 115)
#define__ATTR_RO(_name){ \
.attr = { .name =__stringify(_name), .mode = 0444 }, \
.show = _name##_show, \
}
it seems to me that the second parameter in this macro should be deleted, which means all other file which calls this macro should be revise. I think it's a big code change, and don't know whether it's suitable to do this. Could you give me some advice?
Thanks,
Wentao
Quoted 4 lines
thanks,
greg k-h
Quoted 39 lines · Wentao Cai
Quoted 17 lines · gregkh
This is fun, it keeps coming up and no one looks in the archives to see why I keep rejecting it :)
This should be
__ATTR_NULL(), but really, the whole macro can be deleted.Quoted 1 line
.data.attr_type = 0,\Review struct gasket_sysfs_attribute { · line 76
Quoted 5 lines
}(quoted diff) +0
-0@@ -75,7 +75,7 @@ struct gasket_sysfs_attribute { #define GASKET_SYSFS_RO(_name, _show_function, _attr_type)\Review struct gasket_sysfs_attribute { · line 77
Quoted 1 line
(quoted diff) +0
-0{\Quoted 8 lines
Review struct gasket_sysfs_attribute { · line 78
Quoted 1 line
(quoted diff) +0
-1- .attr = __ATTR(_name, S_IRUGO, _show_function, NULL),\Review struct gasket_sysfs_attribute { · line 78
Quoted 1 line
(quoted diff) +1
-0+ .attr = __ATTR(_name, 0444, _show_function, NULL),\
__ATTR_RO()please.Hi. I just submit a patch to fix the first
__ATTR_NULL, but I have somequestion about the latter one.
I understand it is better to use read only attribute here, but by changing__ATTRto__ATTR_RO, since the new macro does not need the_show_functionparameter:Quoted 5 lines
(
linux/sysfs.h, line 115)
#define__ATTR_RO(_name){ \
.attr = { .name =__stringify(_name), .mode = 0444 }, \
.show = _name##_show, \
}
Quoted 4 lines
it seems to me that the second parameter in this macro should be deleted, which means all other file which calls this macro should be revise. I think it's a big code change, and don't know whether it's suitable to do this. Could you give me some advice?
Yes, it is a big code change, and if you are not comfortable with it, I would not recommend it at this point in time.
This is also why no one has done it yet :)
thanks,
greg k-h