poma
2016-Apr-10 16:45 UTC
[Nouveau] [PATCH] module parameters: permissions as defines, readable to everyone
For the purposes of the module parameters, specifies the permissions of the corresponding files in sysfs in predefined S_I* form rather than in octal notation. Withal it makes the source code more consistent. Moreover, because all parameters are readable to everyone, it is more user-friendly. $ grep S_IRUGO include/linux/stat.h #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH) $ grep 'S_IRUSR\|S_IRGRP\|S_IROTH' include/uapi/linux/stat.h #define S_IRUSR 00400 #define S_IRGRP 00040 #define S_IROTH 00004 $ ls -l /sys/module/nouveau/parameters/ total 0 -r--r--r--. 1 root root 4096 Apr 10 17:43 config -r--r--r--. 1 root root 4096 Apr 10 17:43 debug -r--r--r--. 1 root root 4096 Apr 10 17:43 duallink -r--r--r--. 1 root root 4096 Apr 10 17:43 hdmimhz -r--r--r--. 1 root root 4096 Apr 10 17:43 ignorelid -r--r--r--. 1 root root 4096 Apr 10 17:43 modeset -r--r--r--. 1 root root 4096 Apr 10 17:43 noaccel -r--r--r--. 1 root root 4096 Apr 10 17:43 nofbaccel -r--r--r--. 1 root root 4096 Apr 10 17:43 runpm -r--r--r--. 1 root root 4096 Apr 10 17:43 tv_disable -r--r--r--. 1 root root 4096 Apr 10 17:43 tv_norm -r--r--r--. 1 root root 4096 Apr 10 17:43 vram_pushbuf $ systool -vm nouveau | grep Parameters -A 12 Parameters: config = 28 6e 75 6c 6c 29 0a debug = "(null)" duallink = "1" hdmimhz = "0" ignorelid = "0" modeset = "-1" noaccel = "0" nofbaccel = "0" runpm = "-1" tv_disable = "0" tv_norm = "(null)" vram_pushbuf = "0" Signed-off-by: poma <pomidorabelisima at gmail.com> --- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 2 +- drivers/gpu/drm/nouveau/nouveau_chan.c | 2 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 8 ++++---- drivers/gpu/drm/nouveau/nouveau_drm.c | 10 +++++----- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c index 163317d..af520d0 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c @@ -40,7 +40,7 @@ MODULE_PARM_DESC(tv_norm, "Default TV norm.\n" "\t\tDefault: PAL\n" "\t\t*NOTE* Ignored for cards with external TV encoders."); static char *nouveau_tv_norm; -module_param_named(tv_norm, nouveau_tv_norm, charp, 0400); +module_param_named(tv_norm, nouveau_tv_norm, charp, S_IRUGO); static uint32_t nv42_tv_sample_load(struct drm_encoder *encoder) { diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index 879655c..0bb1b9c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c @@ -43,7 +43,7 @@ MODULE_PARM_DESC(vram_pushbuf, "Create DMA push buffers in VRAM"); int nouveau_vram_pushbuf; -module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400); +module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, S_IRUGO); int nouveau_channel_idle(struct nouveau_channel *chan) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index ae96ebc..30785fb 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -49,19 +49,19 @@ MODULE_PARM_DESC(tv_disable, "Disable TV-out detection"); int nouveau_tv_disable = 0; -module_param_named(tv_disable, nouveau_tv_disable, int, 0400); +module_param_named(tv_disable, nouveau_tv_disable, int, S_IRUGO); MODULE_PARM_DESC(ignorelid, "Ignore ACPI lid status"); int nouveau_ignorelid = 0; -module_param_named(ignorelid, nouveau_ignorelid, int, 0400); +module_param_named(ignorelid, nouveau_ignorelid, int, S_IRUGO); MODULE_PARM_DESC(duallink, "Allow dual-link TMDS (default: enabled)"); int nouveau_duallink = 1; -module_param_named(duallink, nouveau_duallink, int, 0400); +module_param_named(duallink, nouveau_duallink, int, S_IRUGO); MODULE_PARM_DESC(hdmimhz, "Force a maximum HDMI pixel clock (in MHz)"); int nouveau_hdmimhz = 0; -module_param_named(hdmimhz, nouveau_hdmimhz, int, 0400); +module_param_named(hdmimhz, nouveau_hdmimhz, int, S_IRUGO); struct nouveau_encoder * find_encoder(struct drm_connector *connector, int type) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index d06877d..98ead83 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -63,24 +63,24 @@ MODULE_PARM_DESC(config, "option string to pass to driver core"); static char *nouveau_config; -module_param_named(config, nouveau_config, charp, 0400); +module_param_named(config, nouveau_config, charp, S_IRUGO); MODULE_PARM_DESC(debug, "debug string to pass to driver core"); static char *nouveau_debug; -module_param_named(debug, nouveau_debug, charp, 0400); +module_param_named(debug, nouveau_debug, charp, S_IRUGO); MODULE_PARM_DESC(noaccel, "disable kernel/abi16 acceleration"); static int nouveau_noaccel = 0; -module_param_named(noaccel, nouveau_noaccel, int, 0400); +module_param_named(noaccel, nouveau_noaccel, int, S_IRUGO); MODULE_PARM_DESC(modeset, "enable driver (default: auto, " "0 = disabled, 1 = enabled, 2 = headless)"); int nouveau_modeset = -1; -module_param_named(modeset, nouveau_modeset, int, 0400); +module_param_named(modeset, nouveau_modeset, int, S_IRUGO); MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1)"); int nouveau_runtime_pm = -1; -module_param_named(runpm, nouveau_runtime_pm, int, 0400); +module_param_named(runpm, nouveau_runtime_pm, int, S_IRUGO); static struct drm_driver driver_stub; static struct drm_driver driver_pci; diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 59f27e7..425b423 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -53,7 +53,7 @@ MODULE_PARM_DESC(nofbaccel, "Disable fbcon acceleration"); int nouveau_nofbaccel = 0; -module_param_named(nofbaccel, nouveau_nofbaccel, int, 0400); +module_param_named(nofbaccel, nouveau_nofbaccel, int, S_IRUGO); static void nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) -- 2.4.11
Ilia Mirkin
2016-Apr-10 16:58 UTC
[Nouveau] [PATCH] module parameters: permissions as defines, readable to everyone
On Sun, Apr 10, 2016 at 12:45 PM, poma <pomidorabelisima at gmail.com> wrote:> > For the purposes of the module parameters, > specifies the permissions of the corresponding files in sysfs in predefined S_I* form rather than in octal notation.I definitely find octal *way* more readable for permissions than those S_* macros. Apparently others agree with me, have a look at 'git grep module_param_named drivers/gpu/drm' - note lack of the silly macros. I'd be fine with flipping everything to 0444 though. Not sure why it was so restrictive right now.> Withal it makes the source code more consistent. > Moreover, because all parameters are readable to everyone, it is more user-friendly. > > $ grep S_IRUGO include/linux/stat.h > #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH) > > $ grep 'S_IRUSR\|S_IRGRP\|S_IROTH' include/uapi/linux/stat.h > #define S_IRUSR 00400 > #define S_IRGRP 00040 > #define S_IROTH 00004 > > $ ls -l /sys/module/nouveau/parameters/ > total 0 > -r--r--r--. 1 root root 4096 Apr 10 17:43 config > -r--r--r--. 1 root root 4096 Apr 10 17:43 debug > -r--r--r--. 1 root root 4096 Apr 10 17:43 duallink > -r--r--r--. 1 root root 4096 Apr 10 17:43 hdmimhz > -r--r--r--. 1 root root 4096 Apr 10 17:43 ignorelid > -r--r--r--. 1 root root 4096 Apr 10 17:43 modeset > -r--r--r--. 1 root root 4096 Apr 10 17:43 noaccel > -r--r--r--. 1 root root 4096 Apr 10 17:43 nofbaccel > -r--r--r--. 1 root root 4096 Apr 10 17:43 runpm > -r--r--r--. 1 root root 4096 Apr 10 17:43 tv_disable > -r--r--r--. 1 root root 4096 Apr 10 17:43 tv_norm > -r--r--r--. 1 root root 4096 Apr 10 17:43 vram_pushbuf > > $ systool -vm nouveau | grep Parameters -A 12 > Parameters: > config = 28 6e 75 6c 6c 29 0a > debug = "(null)" > duallink = "1" > hdmimhz = "0" > ignorelid = "0" > modeset = "-1" > noaccel = "0" > nofbaccel = "0" > runpm = "-1" > tv_disable = "0" > tv_norm = "(null)" > vram_pushbuf = "0" > > Signed-off-by: poma <pomidorabelisima at gmail.com>>From Documentation/SubmittingPatches""" then you just add a line saying Signed-off-by: Random J Developer <random at developer.example.org> using your real name (sorry, no pseudonyms or anonymous contributions.) """ -ilia
Maybe Matching Threads
- [PATCH] nouveau: Switch perms from macros to octal notations, module params readable to everyone
- [PATCH] drm: Display Nouveau boot options at launch
- [PATCH 0204/1285] Replace numeric parameter like 0444 with macro
- Problem with GT218 (GeForce GT210)
- rgl.snapshot only captures a small portion what's visible in the RGL device window on CentOS 7