nouveau: Switch perms from macros to octal notations, module params readable to everyone

Submitted by poma on April 11, 2016, 1:48 p.m.

Details

Message ID 570BAB2B.7070509@gmail.com
State New
Headers show
Series "nouveau: Switch perms from macros to octal notations, module params readable to everyone" ( rev: 1 ) in Nouveau

Not browsing as part of any series.

Commit Message

poma April 11, 2016, 1:48 p.m.
From: poma <pomidorabelisima@gmail.com>

Switch from "silly" S_* macros to "definitely more readable" octal "way" permissions,
moreover to not "so restrictive" module parameters permissions.

Suggested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Fixes: poma <pomidorabelisima@gmail.com>
Tested-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_debugfs.c   |  2 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c       | 10 ++++----
 drivers/gpu/drm/nouveau/nouveau_fbcon.c     |  2 +-
 drivers/gpu/drm/nouveau/nouveau_hwmon.c     | 40 ++++++++++++++---------------
 7 files changed, 33 insertions(+), 33 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
index 163317d..2fa0d09 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, 0444);
 
 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..6d2b9d9 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, 0444);
 
 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..1684d22 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, 0444);
 
 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, 0444);
 
 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, 0444);
 
 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, 0444);
 
 struct nouveau_encoder *
 find_encoder(struct drm_connector *connector, int type)
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
index 3d0dc19..135e6c8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -204,7 +204,7 @@  nouveau_debugfs_create_file(struct drm_minor *minor,
 
 	node->minor = minor;
 	node->info_ent = (const void *)ndf->fops;
-	node->dent = debugfs_create_file(ndf->name, S_IRUGO | S_IWUSR,
+	node->dent = debugfs_create_file(ndf->name, 0644,
 					 minor->debugfs_root, node, ndf->fops);
 	if (!node->dent) {
 		kfree(node);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index d06877d..2166bdc 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, 0444);
 
 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, 0444);
 
 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, 0444);
 
 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, 0444);
 
 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, 0444);
 
 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..a68fd83 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, 0444);
 
 static void
 nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
index 67edd2f..d258cd3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
@@ -51,7 +51,7 @@  nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf)
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", temp * 1000);
 }
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp,
+static SENSOR_DEVICE_ATTR(temp1_input, 0444, nouveau_hwmon_show_temp,
 						  NULL, 0);
 
 static ssize_t
@@ -60,7 +60,7 @@  nouveau_hwmon_show_temp1_auto_point1_pwm(struct device *d,
 {
 	return snprintf(buf, PAGE_SIZE, "%d\n", 100);
 }
-static SENSOR_DEVICE_ATTR(temp1_auto_point1_pwm, S_IRUGO,
+static SENSOR_DEVICE_ATTR(temp1_auto_point1_pwm, 0444,
 			  nouveau_hwmon_show_temp1_auto_point1_pwm, NULL, 0);
 
 static ssize_t
@@ -92,7 +92,7 @@  nouveau_hwmon_set_temp1_auto_point1_temp(struct device *d,
 
 	return count;
 }
-static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp, 0644,
 			  nouveau_hwmon_temp1_auto_point1_temp,
 			  nouveau_hwmon_set_temp1_auto_point1_temp, 0);
 
@@ -125,7 +125,7 @@  nouveau_hwmon_set_temp1_auto_point1_temp_hyst(struct device *d,
 
 	return count;
 }
-static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp_hyst, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(temp1_auto_point1_temp_hyst, 0644,
 			  nouveau_hwmon_temp1_auto_point1_temp_hyst,
 			  nouveau_hwmon_set_temp1_auto_point1_temp_hyst, 0);
 
@@ -155,7 +155,7 @@  nouveau_hwmon_set_max_temp(struct device *d, struct device_attribute *a,
 
 	return count;
 }
-static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, nouveau_hwmon_max_temp,
+static SENSOR_DEVICE_ATTR(temp1_max, 0644, nouveau_hwmon_max_temp,
 						  nouveau_hwmon_set_max_temp,
 						  0);
 
@@ -187,7 +187,7 @@  nouveau_hwmon_set_max_temp_hyst(struct device *d, struct device_attribute *a,
 
 	return count;
 }
-static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(temp1_max_hyst, 0644,
 			  nouveau_hwmon_max_temp_hyst,
 			  nouveau_hwmon_set_max_temp_hyst, 0);
 
@@ -219,7 +219,7 @@  nouveau_hwmon_set_critical_temp(struct device *d, struct device_attribute *a,
 
 	return count;
 }
-static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(temp1_crit, 0644,
 						nouveau_hwmon_critical_temp,
 						nouveau_hwmon_set_critical_temp,
 						0);
@@ -254,7 +254,7 @@  nouveau_hwmon_set_critical_temp_hyst(struct device *d,
 
 	return count;
 }
-static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(temp1_crit_hyst, 0644,
 			  nouveau_hwmon_critical_temp_hyst,
 			  nouveau_hwmon_set_critical_temp_hyst, 0);
 static ssize_t
@@ -285,7 +285,7 @@  nouveau_hwmon_set_emergency_temp(struct device *d, struct device_attribute *a,
 
 	return count;
 }
-static SENSOR_DEVICE_ATTR(temp1_emergency, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(temp1_emergency, 0644,
 					nouveau_hwmon_emergency_temp,
 					nouveau_hwmon_set_emergency_temp,
 					0);
@@ -320,7 +320,7 @@  nouveau_hwmon_set_emergency_temp_hyst(struct device *d,
 
 	return count;
 }
-static SENSOR_DEVICE_ATTR(temp1_emergency_hyst, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(temp1_emergency_hyst, 0644,
 					nouveau_hwmon_emergency_temp_hyst,
 					nouveau_hwmon_set_emergency_temp_hyst,
 					0);
@@ -331,7 +331,7 @@  static ssize_t nouveau_hwmon_show_name(struct device *dev,
 {
 	return sprintf(buf, "nouveau\n");
 }
-static SENSOR_DEVICE_ATTR(name, S_IRUGO, nouveau_hwmon_show_name, NULL, 0);
+static SENSOR_DEVICE_ATTR(name, 0444, nouveau_hwmon_show_name, NULL, 0);
 
 static ssize_t nouveau_hwmon_show_update_rate(struct device *dev,
 				      struct device_attribute *attr,
@@ -339,7 +339,7 @@  static ssize_t nouveau_hwmon_show_update_rate(struct device *dev,
 {
 	return sprintf(buf, "1000\n");
 }
-static SENSOR_DEVICE_ATTR(update_rate, S_IRUGO,
+static SENSOR_DEVICE_ATTR(update_rate, 0444,
 						nouveau_hwmon_show_update_rate,
 						NULL, 0);
 
@@ -353,7 +353,7 @@  nouveau_hwmon_show_fan1_input(struct device *d, struct device_attribute *attr,
 
 	return snprintf(buf, PAGE_SIZE, "%d\n", nvkm_therm_fan_sense(therm));
 }
-static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, nouveau_hwmon_show_fan1_input,
+static SENSOR_DEVICE_ATTR(fan1_input, 0444, nouveau_hwmon_show_fan1_input,
 			  NULL, 0);
 
  static ssize_t
@@ -392,7 +392,7 @@  nouveau_hwmon_set_pwm1_enable(struct device *d, struct device_attribute *a,
 	else
 		return count;
 }
-static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(pwm1_enable, 0644,
 			  nouveau_hwmon_get_pwm1_enable,
 			  nouveau_hwmon_set_pwm1_enable, 0);
 
@@ -431,7 +431,7 @@  nouveau_hwmon_set_pwm1(struct device *d, struct device_attribute *a,
 	return count;
 }
 
-static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(pwm1, 0644,
 			  nouveau_hwmon_get_pwm1,
 			  nouveau_hwmon_set_pwm1, 0);
 
@@ -471,7 +471,7 @@  nouveau_hwmon_set_pwm1_min(struct device *d, struct device_attribute *a,
 	return count;
 }
 
-static SENSOR_DEVICE_ATTR(pwm1_min, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(pwm1_min, 0644,
 			  nouveau_hwmon_get_pwm1_min,
 			  nouveau_hwmon_set_pwm1_min, 0);
 
@@ -511,7 +511,7 @@  nouveau_hwmon_set_pwm1_max(struct device *d, struct device_attribute *a,
 	return count;
 }
 
-static SENSOR_DEVICE_ATTR(pwm1_max, S_IRUGO | S_IWUSR,
+static SENSOR_DEVICE_ATTR(pwm1_max, 0644,
 			  nouveau_hwmon_get_pwm1_max,
 			  nouveau_hwmon_set_pwm1_max, 0);
 
@@ -531,7 +531,7 @@  nouveau_hwmon_get_in0_input(struct device *d,
 	return sprintf(buf, "%i\n", ret / 1000);
 }
 
-static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO,
+static SENSOR_DEVICE_ATTR(in0_input, 0444,
 			  nouveau_hwmon_get_in0_input, NULL, 0);
 
 static ssize_t
@@ -541,7 +541,7 @@  nouveau_hwmon_get_in0_label(struct device *d,
 	return sprintf(buf, "GPU core\n");
 }
 
-static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO,
+static SENSOR_DEVICE_ATTR(in0_label, 0444,
 			  nouveau_hwmon_get_in0_label, NULL, 0);
 
 static ssize_t
@@ -559,7 +559,7 @@  nouveau_hwmon_get_power1_input(struct device *d, struct device_attribute *a,
 	return sprintf(buf, "%i\n", result);
 }
 
-static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO,
+static SENSOR_DEVICE_ATTR(power1_input, 0444,
 			  nouveau_hwmon_get_power1_input, NULL, 0);
 
 static struct attribute *hwmon_default_attributes[] = {