public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: most: Eliminate symbolic permissions usage
@ 2016-11-24 22:10 Jason Litzinger
  2016-11-25  6:34 ` Jason Litzinger
  2016-11-25 13:01 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Jason Litzinger @ 2016-11-24 22:10 UTC (permalink / raw)
  To: gregkh, christian.gromm, andrey.shvetsov
  Cc: devel, linux-kernel, Jason Litzinger

Fix checkpatch warnings regarding the use of symbolic permissions.

Where the MOST_CHANNEL_ATTR macro is used, convert to octal permissions
over symbolic.

Where _ATTR is used directly, replace with _ATTR_RW/_ATTR_WO and
update the show/store function names appropriately.

Signed-off-by: Jason Litzinger <jlitzingerdev@gmail.com>
---
 drivers/staging/most/mostcore/core.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
index 4c580d1a6a46..3c574a8cb971 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -342,7 +342,7 @@ static ssize_t show_channel_starving(struct most_c_obj *c,
 }
 
 #define create_show_channel_attribute(val) \
-	static MOST_CHNL_ATTR(val, S_IRUGO, show_##val, NULL)
+	static MOST_CHNL_ATTR(val, 0444, show_##val, NULL)
 
 create_show_channel_attribute(available_directions);
 create_show_channel_attribute(available_datatypes);
@@ -494,9 +494,7 @@ static ssize_t store_set_packets_per_xact(struct most_c_obj *c,
 }
 
 #define create_channel_attribute(value) \
-	static MOST_CHNL_ATTR(value, S_IRUGO | S_IWUSR, \
-			      show_##value, \
-			      store_##value)
+	static MOST_CHNL_ATTR(value, 0644, show_##value, store_##value)
 
 create_channel_attribute(set_buffer_size);
 create_channel_attribute(set_number_of_buffers);
@@ -690,7 +688,7 @@ static ssize_t show_interface(struct most_inst_obj *instance_obj,
 }
 
 #define create_inst_attribute(value) \
-	static MOST_INST_ATTR(value, S_IRUGO, show_##value, NULL)
+	static MOST_INST_ATTR(value, 0444, show_##value, NULL)
 
 create_inst_attribute(description);
 create_inst_attribute(interface);
@@ -849,7 +847,7 @@ static void most_aim_release(struct kobject *kobj)
 	kfree(aim_obj);
 }
 
-static ssize_t show_add_link(struct most_aim_obj *aim_obj,
+static ssize_t add_link_show(struct most_aim_obj *aim_obj,
 			     struct most_aim_attribute *attr,
 			     char *buf)
 {
@@ -966,7 +964,7 @@ most_c_obj *get_channel_by_name(char *mdev, char *mdev_ch)
  * (1) would create the device node /dev/my_rxchannel
  * (2) would create the device node /dev/mdev1-ep81
  */
-static ssize_t store_add_link(struct most_aim_obj *aim_obj,
+static ssize_t add_link_store(struct most_aim_obj *aim_obj,
 			      struct most_aim_attribute *attr,
 			      const char *buf,
 			      size_t len)
@@ -1016,7 +1014,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj,
 }
 
 static struct most_aim_attribute most_aim_attr_add_link =
-	__ATTR(add_link, S_IRUGO | S_IWUSR, show_add_link, store_add_link);
+	__ATTR_RW(add_link);
 
 /**
  * store_remove_link - store function for remove_link attribute
@@ -1028,7 +1026,7 @@ static struct most_aim_attribute most_aim_attr_add_link =
  * Example:
  * echo "mdev0:ep81" >remove_link
  */
-static ssize_t store_remove_link(struct most_aim_obj *aim_obj,
+static ssize_t remove_link_store(struct most_aim_obj *aim_obj,
 				 struct most_aim_attribute *attr,
 				 const char *buf,
 				 size_t len)
@@ -1059,7 +1057,7 @@ static ssize_t store_remove_link(struct most_aim_obj *aim_obj,
 }
 
 static struct most_aim_attribute most_aim_attr_remove_link =
-	__ATTR(remove_link, S_IWUSR, NULL, store_remove_link);
+	__ATTR_WO(remove_link)
 
 static struct attribute *most_aim_def_attrs[] = {
 	&most_aim_attr_add_link.attr,
-- 
2.10.0

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

* Re: [PATCH] staging: most: Eliminate symbolic permissions usage
  2016-11-24 22:10 [PATCH] staging: most: Eliminate symbolic permissions usage Jason Litzinger
@ 2016-11-25  6:34 ` Jason Litzinger
  2016-11-25 13:01 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Litzinger @ 2016-11-25  6:34 UTC (permalink / raw)
  To: gregkh, christian.gromm, andrey.shvetsov; +Cc: devel, linux-kernel

On Thu, Nov 24, 2016 at 03:10:29PM -0700, Jason Litzinger wrote:
> Fix checkpatch warnings regarding the use of symbolic permissions.
> 
> Where the MOST_CHANNEL_ATTR macro is used, convert to octal permissions
> over symbolic.
> 
> Where _ATTR is used directly, replace with _ATTR_RW/_ATTR_WO and
> update the show/store function names appropriately.
Please ignore this, the most driver was not checked in my config so my
test-compile was worthless (it doesn't).

Will submit again.

-Jason

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

* Re: [PATCH] staging: most: Eliminate symbolic permissions usage
  2016-11-24 22:10 [PATCH] staging: most: Eliminate symbolic permissions usage Jason Litzinger
  2016-11-25  6:34 ` Jason Litzinger
@ 2016-11-25 13:01 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2016-11-25 13:01 UTC (permalink / raw)
  To: Jason Litzinger
  Cc: kbuild-all, gregkh, christian.gromm, andrey.shvetsov, devel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3260 bytes --]

Hi Jason,

[auto build test ERROR on staging/staging-testing]
[cannot apply to v4.9-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jason-Litzinger/staging-most-Eliminate-symbolic-permissions-usage/20161125-194750
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

>> drivers/staging/most/mostcore/core.c:1062:1: error: expected ',' or ';' before 'static'
    static struct attribute *most_aim_def_attrs[] = {
    ^~~~~~
>> drivers/staging/most/mostcore/core.c:1071:19: error: 'most_aim_def_attrs' undeclared here (not in a function)
     .default_attrs = most_aim_def_attrs,
                      ^~~~~~~~~~~~~~~~~~
   drivers/staging/most/mostcore/core.c:1059:34: warning: 'most_aim_attr_remove_link' defined but not used [-Wunused-variable]
    static struct most_aim_attribute most_aim_attr_remove_link =
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/most/mostcore/core.c:1016:34: warning: 'most_aim_attr_add_link' defined but not used [-Wunused-variable]
    static struct most_aim_attribute most_aim_attr_add_link =
                                     ^~~~~~~~~~~~~~~~~~~~~~

vim +1062 drivers/staging/most/mostcore/core.c

57562a72 Christian Gromm 2015-07-24  1056  	return len;
57562a72 Christian Gromm 2015-07-24  1057  }
57562a72 Christian Gromm 2015-07-24  1058  
c942ea7a Adrian Remonda  2015-08-14  1059  static struct most_aim_attribute most_aim_attr_remove_link =
c383d574 Jason Litzinger 2016-11-24  1060  	__ATTR_WO(remove_link)
57562a72 Christian Gromm 2015-07-24  1061  
57562a72 Christian Gromm 2015-07-24 @1062  static struct attribute *most_aim_def_attrs[] = {
57562a72 Christian Gromm 2015-07-24  1063  	&most_aim_attr_add_link.attr,
57562a72 Christian Gromm 2015-07-24  1064  	&most_aim_attr_remove_link.attr,
57562a72 Christian Gromm 2015-07-24  1065  	NULL,
57562a72 Christian Gromm 2015-07-24  1066  };
57562a72 Christian Gromm 2015-07-24  1067  
57562a72 Christian Gromm 2015-07-24  1068  static struct kobj_type most_aim_ktype = {
57562a72 Christian Gromm 2015-07-24  1069  	.sysfs_ops = &most_aim_sysfs_ops,
57562a72 Christian Gromm 2015-07-24  1070  	.release = most_aim_release,
57562a72 Christian Gromm 2015-07-24 @1071  	.default_attrs = most_aim_def_attrs,
57562a72 Christian Gromm 2015-07-24  1072  };
57562a72 Christian Gromm 2015-07-24  1073  
57562a72 Christian Gromm 2015-07-24  1074  static struct kset *most_aim_kset;

:::::: The code at line 1062 was first introduced by commit
:::::: 57562a72414ca35b2e614cfe0a1b1a7b7e7813dd Staging: most: add MOST driver's core module

:::::: TO: Christian Gromm <christian.gromm@microchip.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 45142 bytes --]

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

end of thread, other threads:[~2016-11-25 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24 22:10 [PATCH] staging: most: Eliminate symbolic permissions usage Jason Litzinger
2016-11-25  6:34 ` Jason Litzinger
2016-11-25 13:01 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox