From: poma <pomidorabelisima-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: [PATCH] module parameters: permissions as defines, readable to everyone
Date: Sun, 10 Apr 2016 18:45:47 +0200 [thread overview]
Message-ID: <570A833B.5040007@gmail.com> (raw)
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@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
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
next reply other threads:[~2016-04-10 16:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-10 16:45 poma [this message]
[not found] ` <570A833B.5040007-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-10 16:58 ` [PATCH] module parameters: permissions as defines, readable to everyone Ilia Mirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=570A833B.5040007@gmail.com \
--to=pomidorabelisima-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.