Skip to content

Commit bf5ecda

Browse files
JoePerchesintel-lab-lkp
authored andcommitted
drm: Convert S_<FOO> permission uses to octal
Convert S_<FOO> permissions to the more readable octal. Link: https://lore.kernel.org/lkml/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com/ Done using: $ git ls-files -- drivers/gpu/drm/*.[ch] | xargs ./scripts/checkpatch.pl -f --fix-inplace --types=SYMBOLIC_PERMS No difference in generated .o files allyesconfig x86-64 The files below were not compiled for x86-64: drivers/gpu/drm/msm/adreno/a5xx_debugfs.c drivers/gpu/drm/msm/msm_debugfs.c drivers/gpu/drm/msm/msm_perf.c drivers/gpu/drm/msm/msm_rd.c drivers/gpu/drm/sti/sti_drv.c checkpatch does report several places where permissions perhaps could be downgraded. None of these locations are modified by this patch. WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#165: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1146: + debugfs_create_file("ras_ctrl", 0666, con->dir, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#165: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1146: + debugfs_create_file("ras_ctrl", 0666, con->dir, adev, &amdgpu_ras_debugfs_ctrl_ops); WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#168: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1148: + debugfs_create_file("ras_eeprom_reset", 0666, con->dir, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#168: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1148: + debugfs_create_file("ras_eeprom_reset", 0666, con->dir, adev, &amdgpu_ras_debugfs_eeprom_ops); WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#177: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1159: + debugfs_create_bool("auto_reboot", 0666, con->dir, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#177: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1159: + debugfs_create_bool("auto_reboot", 0666, con->dir, &con->reboot); WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#688: FILE: drivers/gpu/drm/msm/adreno/a5xx_debugfs.c:157: + debugfs_create_file("reset", 0222, minor->debugfs_root, dev, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#688: FILE: drivers/gpu/drm/msm/adreno/a5xx_debugfs.c:157: + debugfs_create_file("reset", 0222, minor->debugfs_root, dev, &reset_fops); Signed-off-by: Joe Perches <[email protected]>
1 parent 671176b commit bf5ecda

36 files changed

+137
-137
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev)
12241224

12251225
for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) {
12261226
ent = debugfs_create_file(debugfs_regs_names[i],
1227-
S_IFREG | S_IRUGO, root,
1227+
S_IFREG | 0444, root,
12281228
adev, debugfs_regs[i]);
12291229
if (!i && !IS_ERR_OR_NULL(ent))
12301230
i_size_write(ent->d_inode, adev->rmmio_size);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static ssize_t amdgpu_device_get_pcie_replay_count(struct device *dev,
139139
return snprintf(buf, PAGE_SIZE, "%llu\n", cnt);
140140
}
141141

142-
static DEVICE_ATTR(pcie_replay_count, S_IRUGO,
142+
static DEVICE_ATTR(pcie_replay_count, 0444,
143143
amdgpu_device_get_pcie_replay_count, NULL);
144144

145145
static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev);
@@ -163,7 +163,7 @@ static ssize_t amdgpu_device_get_product_name(struct device *dev,
163163
return snprintf(buf, PAGE_SIZE, "%s\n", adev->product_name);
164164
}
165165

166-
static DEVICE_ATTR(product_name, S_IRUGO,
166+
static DEVICE_ATTR(product_name, 0444,
167167
amdgpu_device_get_product_name, NULL);
168168

169169
/**
@@ -185,7 +185,7 @@ static ssize_t amdgpu_device_get_product_number(struct device *dev,
185185
return snprintf(buf, PAGE_SIZE, "%s\n", adev->product_number);
186186
}
187187

188-
static DEVICE_ATTR(product_number, S_IRUGO,
188+
static DEVICE_ATTR(product_number, 0444,
189189
amdgpu_device_get_product_number, NULL);
190190

191191
/**
@@ -207,7 +207,7 @@ static ssize_t amdgpu_device_get_serial_number(struct device *dev,
207207
return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
208208
}
209209

210-
static DEVICE_ATTR(serial_number, S_IRUGO,
210+
static DEVICE_ATTR(serial_number, 0444,
211211
amdgpu_device_get_serial_number, NULL);
212212

213213
/**

drivers/gpu/drm/amd/amdgpu/amdgpu_fw_attestation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void amdgpu_fw_attestation_debugfs_init(struct amdgpu_device *adev)
133133
return;
134134

135135
debugfs_create_file("amdgpu_fw_attestation",
136-
S_IRUSR,
136+
0400,
137137
adev_to_drm(adev)->primary->debugfs_root,
138138
adev,
139139
&amdgpu_fw_attestation_debugfs_ops);

drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ static ssize_t amdgpu_mem_info_gtt_used_show(struct device *dev,
7272
amdgpu_gtt_mgr_usage(man));
7373
}
7474

75-
static DEVICE_ATTR(mem_info_gtt_total, S_IRUGO,
75+
static DEVICE_ATTR(mem_info_gtt_total, 0444,
7676
amdgpu_mem_info_gtt_total_show, NULL);
77-
static DEVICE_ATTR(mem_info_gtt_used, S_IRUGO,
77+
static DEVICE_ATTR(mem_info_gtt_used, 0444,
7878
amdgpu_mem_info_gtt_used_show, NULL);
7979

8080
static const struct ttm_resource_manager_func amdgpu_gtt_mgr_func;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2978,7 +2978,7 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,
29782978
return count;
29792979
}
29802980

2981-
static DEVICE_ATTR(usbc_pd_fw, S_IRUGO | S_IWUSR,
2981+
static DEVICE_ATTR(usbc_pd_fw, 0644,
29822982
psp_usbc_pd_fw_sysfs_read,
29832983
psp_usbc_pd_fw_sysfs_write);
29842984

drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void amdgpu_rap_debugfs_init(struct amdgpu_device *adev)
121121
if (!adev->psp.rap_context.rap_initialized)
122122
return;
123123

124-
debugfs_create_file("rap_test", S_IWUSR, minor->debugfs_root,
124+
debugfs_create_file("rap_test", 0200, minor->debugfs_root,
125125
adev, &amdgpu_rap_debugfs_ops);
126126
#endif
127127
}

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ int amdgpu_ras_sysfs_create(struct amdgpu_device *adev,
10651065
obj->sysfs_attr = (struct device_attribute){
10661066
.attr = {
10671067
.name = obj->fs_data.sysfs_name,
1068-
.mode = S_IRUGO,
1068+
.mode = 0444,
10691069
},
10701070
.show = amdgpu_ras_sysfs_read,
10711071
};
@@ -1143,9 +1143,9 @@ static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
11431143
struct drm_minor *minor = adev_to_drm(adev)->primary;
11441144

11451145
con->dir = debugfs_create_dir(RAS_FS_NAME, minor->debugfs_root);
1146-
debugfs_create_file("ras_ctrl", S_IWUGO | S_IRUGO, con->dir,
1146+
debugfs_create_file("ras_ctrl", 0666, con->dir,
11471147
adev, &amdgpu_ras_debugfs_ctrl_ops);
1148-
debugfs_create_file("ras_eeprom_reset", S_IWUGO | S_IRUGO, con->dir,
1148+
debugfs_create_file("ras_eeprom_reset", 0666, con->dir,
11491149
adev, &amdgpu_ras_debugfs_eeprom_ops);
11501150

11511151
/*
@@ -1156,7 +1156,7 @@ static void amdgpu_ras_debugfs_create_ctrl_node(struct amdgpu_device *adev)
11561156
* ERREVENT_ATHUB_INTERRUPT generated. Normal GPU recovery routine
11571157
* will never be called.
11581158
*/
1159-
debugfs_create_bool("auto_reboot", S_IWUGO | S_IRUGO, con->dir,
1159+
debugfs_create_bool("auto_reboot", 0666, con->dir,
11601160
&con->reboot);
11611161

11621162
/*
@@ -1183,7 +1183,7 @@ static void amdgpu_ras_debugfs_create(struct amdgpu_device *adev,
11831183
sizeof(obj->fs_data.debugfs_name));
11841184

11851185
obj->ent = debugfs_create_file(obj->fs_data.debugfs_name,
1186-
S_IWUGO | S_IRUGO, con->dir, obj,
1186+
0666, con->dir, obj,
11871187
&amdgpu_ras_debugfs_ops);
11881188
}
11891189

@@ -1239,9 +1239,9 @@ static void amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)
12391239
/* debugfs end */
12401240

12411241
/* ras fs */
1242-
static BIN_ATTR(gpu_vram_bad_pages, S_IRUGO,
1242+
static BIN_ATTR(gpu_vram_bad_pages, 0444,
12431243
amdgpu_ras_sysfs_badpages_read, NULL, 0);
1244-
static DEVICE_ATTR(features, S_IRUGO,
1244+
static DEVICE_ATTR(features, 0444,
12451245
amdgpu_ras_sysfs_features_read, NULL);
12461246
static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
12471247
{

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ int amdgpu_debugfs_ring_init(struct amdgpu_device *adev,
423423
sprintf(name, "amdgpu_ring_%s", ring->name);
424424

425425
ent = debugfs_create_file(name,
426-
S_IFREG | S_IRUGO, root,
426+
S_IFREG | 0444, root,
427427
ring, &amdgpu_debugfs_ring_fops);
428428
if (!ent)
429429
return -ENOMEM;

drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void amdgpu_securedisplay_debugfs_init(struct amdgpu_device *adev)
170170
if (!adev->psp.securedisplay_context.securedisplay_initialized)
171171
return;
172172

173-
debugfs_create_file("securedisplay_test", S_IWUSR, adev_to_drm(adev)->primary->debugfs_root,
173+
debugfs_create_file("securedisplay_test", 0200, adev_to_drm(adev)->primary->debugfs_root,
174174
adev, &amdgpu_securedisplay_debugfs_ops);
175175
#endif
176176
}

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2499,7 +2499,7 @@ int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev)
24992499
for (count = 0; count < ARRAY_SIZE(ttm_debugfs_entries); count++) {
25002500
ent = debugfs_create_file(
25012501
ttm_debugfs_entries[count].name,
2502-
S_IFREG | S_IRUGO, root,
2502+
S_IFREG | 0444, root,
25032503
adev,
25042504
ttm_debugfs_entries[count].fops);
25052505
if (IS_ERR(ent))

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ static ssize_t amdgpu_mem_info_vram_vendor(struct device *dev,
143143
}
144144
}
145145

146-
static DEVICE_ATTR(mem_info_vram_total, S_IRUGO,
146+
static DEVICE_ATTR(mem_info_vram_total, 0444,
147147
amdgpu_mem_info_vram_total_show, NULL);
148-
static DEVICE_ATTR(mem_info_vis_vram_total, S_IRUGO,
148+
static DEVICE_ATTR(mem_info_vis_vram_total, 0444,
149149
amdgpu_mem_info_vis_vram_total_show,NULL);
150-
static DEVICE_ATTR(mem_info_vram_used, S_IRUGO,
150+
static DEVICE_ATTR(mem_info_vram_used, 0444,
151151
amdgpu_mem_info_vram_used_show, NULL);
152-
static DEVICE_ATTR(mem_info_vis_vram_used, S_IRUGO,
152+
static DEVICE_ATTR(mem_info_vis_vram_used, 0444,
153153
amdgpu_mem_info_vis_vram_used_show, NULL);
154-
static DEVICE_ATTR(mem_info_vram_vendor, S_IRUGO,
154+
static DEVICE_ATTR(mem_info_vram_vendor, 0444,
155155
amdgpu_mem_info_vram_vendor, NULL);
156156

157157
static const struct attribute *amdgpu_vram_mgr_attributes[] = {

drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static const struct amdgpu_pcs_ras_field wafl_pcs_ras_fields[] = {
171171

172172
static struct attribute amdgpu_xgmi_hive_id = {
173173
.name = "xgmi_hive_id",
174-
.mode = S_IRUGO
174+
.mode = 0444
175175
};
176176

177177
static struct attribute *amdgpu_xgmi_hive_attrs[] = {
@@ -250,8 +250,8 @@ static ssize_t amdgpu_xgmi_show_error(struct device *dev,
250250
}
251251

252252

253-
static DEVICE_ATTR(xgmi_device_id, S_IRUGO, amdgpu_xgmi_show_device_id, NULL);
254-
static DEVICE_ATTR(xgmi_error, S_IRUGO, amdgpu_xgmi_show_error, NULL);
253+
static DEVICE_ATTR(xgmi_device_id, 0444, amdgpu_xgmi_show_device_id, NULL);
254+
static DEVICE_ATTR(xgmi_error, 0444, amdgpu_xgmi_show_error, NULL);
255255

256256
static int amdgpu_xgmi_sysfs_add_dev_info(struct amdgpu_device *adev,
257257
struct amdgpu_hive_info *hive)

drivers/gpu/drm/amd/amdgpu/df_v3_6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static ssize_t df_v3_6_get_df_cntr_avail(struct device *dev,
209209
}
210210

211211
/* device attr for available perfmon counters */
212-
static DEVICE_ATTR(df_cntr_avail, S_IRUGO, df_v3_6_get_df_cntr_avail, NULL);
212+
static DEVICE_ATTR(df_cntr_avail, 0444, df_v3_6_get_df_cntr_avail, NULL);
213213

214214
static void df_v3_6_query_hashes(struct amdgpu_device *adev)
215215
{

drivers/gpu/drm/amd/pm/amdgpu_pm.c

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,7 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
22562256
if (DEVICE_ATTR_IS(pp_dpm_mclk) ||
22572257
DEVICE_ATTR_IS(pp_dpm_socclk) ||
22582258
DEVICE_ATTR_IS(pp_dpm_fclk)) {
2259-
dev_attr->attr.mode &= ~S_IWUGO;
2259+
dev_attr->attr.mode &= ~0222;
22602260
dev_attr->store = NULL;
22612261
}
22622262
}
@@ -3335,48 +3335,48 @@ static ssize_t amdgpu_hwmon_show_mclk_label(struct device *dev,
33353335
*
33363336
*/
33373337

3338-
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, amdgpu_hwmon_show_temp, NULL, PP_TEMP_EDGE);
3339-
static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, amdgpu_hwmon_show_temp_thresh, NULL, 0);
3340-
static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, amdgpu_hwmon_show_temp_thresh, NULL, 1);
3341-
static SENSOR_DEVICE_ATTR(temp1_emergency, S_IRUGO, amdgpu_hwmon_show_temp_emergency, NULL, PP_TEMP_EDGE);
3342-
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, amdgpu_hwmon_show_temp, NULL, PP_TEMP_JUNCTION);
3343-
static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, amdgpu_hwmon_show_hotspot_temp_thresh, NULL, 0);
3344-
static SENSOR_DEVICE_ATTR(temp2_crit_hyst, S_IRUGO, amdgpu_hwmon_show_hotspot_temp_thresh, NULL, 1);
3345-
static SENSOR_DEVICE_ATTR(temp2_emergency, S_IRUGO, amdgpu_hwmon_show_temp_emergency, NULL, PP_TEMP_JUNCTION);
3346-
static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, amdgpu_hwmon_show_temp, NULL, PP_TEMP_MEM);
3347-
static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, amdgpu_hwmon_show_mem_temp_thresh, NULL, 0);
3348-
static SENSOR_DEVICE_ATTR(temp3_crit_hyst, S_IRUGO, amdgpu_hwmon_show_mem_temp_thresh, NULL, 1);
3349-
static SENSOR_DEVICE_ATTR(temp3_emergency, S_IRUGO, amdgpu_hwmon_show_temp_emergency, NULL, PP_TEMP_MEM);
3350-
static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, amdgpu_hwmon_show_temp_label, NULL, PP_TEMP_EDGE);
3351-
static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, amdgpu_hwmon_show_temp_label, NULL, PP_TEMP_JUNCTION);
3352-
static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, amdgpu_hwmon_show_temp_label, NULL, PP_TEMP_MEM);
3353-
static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, amdgpu_hwmon_get_pwm1, amdgpu_hwmon_set_pwm1, 0);
3354-
static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, amdgpu_hwmon_get_pwm1_enable, amdgpu_hwmon_set_pwm1_enable, 0);
3355-
static SENSOR_DEVICE_ATTR(pwm1_min, S_IRUGO, amdgpu_hwmon_get_pwm1_min, NULL, 0);
3356-
static SENSOR_DEVICE_ATTR(pwm1_max, S_IRUGO, amdgpu_hwmon_get_pwm1_max, NULL, 0);
3357-
static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, amdgpu_hwmon_get_fan1_input, NULL, 0);
3358-
static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO, amdgpu_hwmon_get_fan1_min, NULL, 0);
3359-
static SENSOR_DEVICE_ATTR(fan1_max, S_IRUGO, amdgpu_hwmon_get_fan1_max, NULL, 0);
3360-
static SENSOR_DEVICE_ATTR(fan1_target, S_IRUGO | S_IWUSR, amdgpu_hwmon_get_fan1_target, amdgpu_hwmon_set_fan1_target, 0);
3361-
static SENSOR_DEVICE_ATTR(fan1_enable, S_IRUGO | S_IWUSR, amdgpu_hwmon_get_fan1_enable, amdgpu_hwmon_set_fan1_enable, 0);
3362-
static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, amdgpu_hwmon_show_vddgfx, NULL, 0);
3363-
static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, amdgpu_hwmon_show_vddgfx_label, NULL, 0);
3364-
static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, amdgpu_hwmon_show_vddnb, NULL, 0);
3365-
static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, amdgpu_hwmon_show_vddnb_label, NULL, 0);
3366-
static SENSOR_DEVICE_ATTR(power1_average, S_IRUGO, amdgpu_hwmon_show_power_avg, NULL, 0);
3367-
static SENSOR_DEVICE_ATTR(power1_cap_max, S_IRUGO, amdgpu_hwmon_show_power_cap_max, NULL, 0);
3368-
static SENSOR_DEVICE_ATTR(power1_cap_min, S_IRUGO, amdgpu_hwmon_show_power_cap_min, NULL, 0);
3369-
static SENSOR_DEVICE_ATTR(power1_cap, S_IRUGO | S_IWUSR, amdgpu_hwmon_show_power_cap, amdgpu_hwmon_set_power_cap, 0);
3370-
static SENSOR_DEVICE_ATTR(power1_label, S_IRUGO, amdgpu_hwmon_show_power_label, NULL, 0);
3371-
static SENSOR_DEVICE_ATTR(power2_average, S_IRUGO, amdgpu_hwmon_show_power_avg, NULL, 1);
3372-
static SENSOR_DEVICE_ATTR(power2_cap_max, S_IRUGO, amdgpu_hwmon_show_power_cap_max, NULL, 1);
3373-
static SENSOR_DEVICE_ATTR(power2_cap_min, S_IRUGO, amdgpu_hwmon_show_power_cap_min, NULL, 1);
3374-
static SENSOR_DEVICE_ATTR(power2_cap, S_IRUGO | S_IWUSR, amdgpu_hwmon_show_power_cap, amdgpu_hwmon_set_power_cap, 1);
3375-
static SENSOR_DEVICE_ATTR(power2_label, S_IRUGO, amdgpu_hwmon_show_power_label, NULL, 1);
3376-
static SENSOR_DEVICE_ATTR(freq1_input, S_IRUGO, amdgpu_hwmon_show_sclk, NULL, 0);
3377-
static SENSOR_DEVICE_ATTR(freq1_label, S_IRUGO, amdgpu_hwmon_show_sclk_label, NULL, 0);
3378-
static SENSOR_DEVICE_ATTR(freq2_input, S_IRUGO, amdgpu_hwmon_show_mclk, NULL, 0);
3379-
static SENSOR_DEVICE_ATTR(freq2_label, S_IRUGO, amdgpu_hwmon_show_mclk_label, NULL, 0);
3338+
static SENSOR_DEVICE_ATTR(temp1_input, 0444, amdgpu_hwmon_show_temp, NULL, PP_TEMP_EDGE);
3339+
static SENSOR_DEVICE_ATTR(temp1_crit, 0444, amdgpu_hwmon_show_temp_thresh, NULL, 0);
3340+
static SENSOR_DEVICE_ATTR(temp1_crit_hyst, 0444, amdgpu_hwmon_show_temp_thresh, NULL, 1);
3341+
static SENSOR_DEVICE_ATTR(temp1_emergency, 0444, amdgpu_hwmon_show_temp_emergency, NULL, PP_TEMP_EDGE);
3342+
static SENSOR_DEVICE_ATTR(temp2_input, 0444, amdgpu_hwmon_show_temp, NULL, PP_TEMP_JUNCTION);
3343+
static SENSOR_DEVICE_ATTR(temp2_crit, 0444, amdgpu_hwmon_show_hotspot_temp_thresh, NULL, 0);
3344+
static SENSOR_DEVICE_ATTR(temp2_crit_hyst, 0444, amdgpu_hwmon_show_hotspot_temp_thresh, NULL, 1);
3345+
static SENSOR_DEVICE_ATTR(temp2_emergency, 0444, amdgpu_hwmon_show_temp_emergency, NULL, PP_TEMP_JUNCTION);
3346+
static SENSOR_DEVICE_ATTR(temp3_input, 0444, amdgpu_hwmon_show_temp, NULL, PP_TEMP_MEM);
3347+
static SENSOR_DEVICE_ATTR(temp3_crit, 0444, amdgpu_hwmon_show_mem_temp_thresh, NULL, 0);
3348+
static SENSOR_DEVICE_ATTR(temp3_crit_hyst, 0444, amdgpu_hwmon_show_mem_temp_thresh, NULL, 1);
3349+
static SENSOR_DEVICE_ATTR(temp3_emergency, 0444, amdgpu_hwmon_show_temp_emergency, NULL, PP_TEMP_MEM);
3350+
static SENSOR_DEVICE_ATTR(temp1_label, 0444, amdgpu_hwmon_show_temp_label, NULL, PP_TEMP_EDGE);
3351+
static SENSOR_DEVICE_ATTR(temp2_label, 0444, amdgpu_hwmon_show_temp_label, NULL, PP_TEMP_JUNCTION);
3352+
static SENSOR_DEVICE_ATTR(temp3_label, 0444, amdgpu_hwmon_show_temp_label, NULL, PP_TEMP_MEM);
3353+
static SENSOR_DEVICE_ATTR(pwm1, 0644, amdgpu_hwmon_get_pwm1, amdgpu_hwmon_set_pwm1, 0);
3354+
static SENSOR_DEVICE_ATTR(pwm1_enable, 0644, amdgpu_hwmon_get_pwm1_enable, amdgpu_hwmon_set_pwm1_enable, 0);
3355+
static SENSOR_DEVICE_ATTR(pwm1_min, 0444, amdgpu_hwmon_get_pwm1_min, NULL, 0);
3356+
static SENSOR_DEVICE_ATTR(pwm1_max, 0444, amdgpu_hwmon_get_pwm1_max, NULL, 0);
3357+
static SENSOR_DEVICE_ATTR(fan1_input, 0444, amdgpu_hwmon_get_fan1_input, NULL, 0);
3358+
static SENSOR_DEVICE_ATTR(fan1_min, 0444, amdgpu_hwmon_get_fan1_min, NULL, 0);
3359+
static SENSOR_DEVICE_ATTR(fan1_max, 0444, amdgpu_hwmon_get_fan1_max, NULL, 0);
3360+
static SENSOR_DEVICE_ATTR(fan1_target, 0644, amdgpu_hwmon_get_fan1_target, amdgpu_hwmon_set_fan1_target, 0);
3361+
static SENSOR_DEVICE_ATTR(fan1_enable, 0644, amdgpu_hwmon_get_fan1_enable, amdgpu_hwmon_set_fan1_enable, 0);
3362+
static SENSOR_DEVICE_ATTR(in0_input, 0444, amdgpu_hwmon_show_vddgfx, NULL, 0);
3363+
static SENSOR_DEVICE_ATTR(in0_label, 0444, amdgpu_hwmon_show_vddgfx_label, NULL, 0);
3364+
static SENSOR_DEVICE_ATTR(in1_input, 0444, amdgpu_hwmon_show_vddnb, NULL, 0);
3365+
static SENSOR_DEVICE_ATTR(in1_label, 0444, amdgpu_hwmon_show_vddnb_label, NULL, 0);
3366+
static SENSOR_DEVICE_ATTR(power1_average, 0444, amdgpu_hwmon_show_power_avg, NULL, 0);
3367+
static SENSOR_DEVICE_ATTR(power1_cap_max, 0444, amdgpu_hwmon_show_power_cap_max, NULL, 0);
3368+
static SENSOR_DEVICE_ATTR(power1_cap_min, 0444, amdgpu_hwmon_show_power_cap_min, NULL, 0);
3369+
static SENSOR_DEVICE_ATTR(power1_cap, 0644, amdgpu_hwmon_show_power_cap, amdgpu_hwmon_set_power_cap, 0);
3370+
static SENSOR_DEVICE_ATTR(power1_label, 0444, amdgpu_hwmon_show_power_label, NULL, 0);
3371+
static SENSOR_DEVICE_ATTR(power2_average, 0444, amdgpu_hwmon_show_power_avg, NULL, 1);
3372+
static SENSOR_DEVICE_ATTR(power2_cap_max, 0444, amdgpu_hwmon_show_power_cap_max, NULL, 1);
3373+
static SENSOR_DEVICE_ATTR(power2_cap_min, 0444, amdgpu_hwmon_show_power_cap_min, NULL, 1);
3374+
static SENSOR_DEVICE_ATTR(power2_cap, 0644, amdgpu_hwmon_show_power_cap, amdgpu_hwmon_set_power_cap, 1);
3375+
static SENSOR_DEVICE_ATTR(power2_label, 0444, amdgpu_hwmon_show_power_label, NULL, 1);
3376+
static SENSOR_DEVICE_ATTR(freq1_input, 0444, amdgpu_hwmon_show_sclk, NULL, 0);
3377+
static SENSOR_DEVICE_ATTR(freq1_label, 0444, amdgpu_hwmon_show_sclk_label, NULL, 0);
3378+
static SENSOR_DEVICE_ATTR(freq2_input, 0444, amdgpu_hwmon_show_mclk, NULL, 0);
3379+
static SENSOR_DEVICE_ATTR(freq2_label, 0444, amdgpu_hwmon_show_mclk_label, NULL, 0);
33803380

33813381
static struct attribute *hwmon_attributes[] = {
33823382
&sensor_dev_attr_temp1_input.dev_attr.attr,
@@ -3500,13 +3500,13 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
35003500
attr == &sensor_dev_attr_pwm1.dev_attr.attr) || /* can't query fan */
35013501
(!adev->powerplay.pp_funcs->get_fan_control_mode &&
35023502
attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr)) /* can't query state */
3503-
effective_mode &= ~S_IRUGO;
3503+
effective_mode &= ~0444;
35043504

35053505
if ((!adev->powerplay.pp_funcs->set_fan_speed_percent &&
35063506
attr == &sensor_dev_attr_pwm1.dev_attr.attr) || /* can't manage fan */
35073507
(!adev->powerplay.pp_funcs->set_fan_control_mode &&
35083508
attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr)) /* can't manage state */
3509-
effective_mode &= ~S_IWUSR;
3509+
effective_mode &= ~0200;
35103510
}
35113511

35123512
if (((adev->family == AMDGPU_FAMILY_SI) ||

drivers/gpu/drm/amd/pm/inc/amdgpu_pm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ struct amdgpu_device_attr_entry {
7171
_flags, ##__VA_ARGS__)
7272

7373
#define AMDGPU_DEVICE_ATTR_RW(_name, _flags, ...) \
74-
AMDGPU_DEVICE_ATTR(_name, S_IRUGO | S_IWUSR, \
74+
AMDGPU_DEVICE_ATTR(_name, 0644, \
7575
_flags, ##__VA_ARGS__)
7676

7777
#define AMDGPU_DEVICE_ATTR_RO(_name, _flags, ...) \
78-
__AMDGPU_DEVICE_ATTR(_name, S_IRUGO, \
78+
__AMDGPU_DEVICE_ATTR(_name, 0444, \
7979
amdgpu_get_##_name, NULL, \
8080
_flags, ##__VA_ARGS__)
8181

drivers/gpu/drm/arm/malidp_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ static void malidp_debugfs_init(struct drm_minor *minor)
555555
malidp_error_stats_init(&malidp->de_errors);
556556
malidp_error_stats_init(&malidp->se_errors);
557557
spin_lock_init(&malidp->errors_lock);
558-
debugfs_create_file("debug", S_IRUGO | S_IWUSR, minor->debugfs_root,
558+
debugfs_create_file("debug", 0644, minor->debugfs_root,
559559
minor->dev, &malidp_debugfs_fops);
560560
}
561561

drivers/gpu/drm/drm_debugfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void drm_debugfs_create_files(const struct drm_info_list *files, int count,
191191

192192
tmp->minor = minor;
193193
tmp->dent = debugfs_create_file(files[i].name,
194-
S_IFREG | S_IRUGO, root, tmp,
194+
S_IFREG | 0444, root, tmp,
195195
&drm_debugfs_fops);
196196
tmp->info_ent = &files[i];
197197

@@ -425,15 +425,15 @@ void drm_debugfs_connector_add(struct drm_connector *connector)
425425
connector->debugfs_entry = root;
426426

427427
/* force */
428-
debugfs_create_file("force", S_IRUGO | S_IWUSR, root, connector,
428+
debugfs_create_file("force", 0644, root, connector,
429429
&drm_connector_fops);
430430

431431
/* edid */
432-
debugfs_create_file("edid_override", S_IRUGO | S_IWUSR, root, connector,
432+
debugfs_create_file("edid_override", 0644, root, connector,
433433
&drm_edid_fops);
434434

435435
/* vrr range */
436-
debugfs_create_file("vrr_range", S_IRUGO, root, connector,
436+
debugfs_create_file("vrr_range", 0444, root, connector,
437437
&vrr_range_fops);
438438
}
439439

drivers/gpu/drm/drm_debugfs_crc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ void drm_debugfs_crtc_crc_add(struct drm_crtc *crtc)
374374

375375
crc_ent = debugfs_create_dir("crc", crtc->debugfs_entry);
376376

377-
debugfs_create_file("control", S_IRUGO | S_IWUSR, crc_ent, crtc,
377+
debugfs_create_file("control", 0644, crc_ent, crtc,
378378
&drm_crtc_crc_control_fops);
379-
debugfs_create_file("data", S_IRUGO, crc_ent, crtc,
379+
debugfs_create_file("data", 0444, crc_ent, crtc,
380380
&drm_crtc_crc_data_fops);
381381
}
382382

0 commit comments

Comments
 (0)