Skip to content

Commit 111136e

Browse files
James Morsesuryasaimadhu
authored andcommitted
x86/resctrl: Make resctrl_arch_get_config() return its value
resctrl_arch_get_config() has no return, but does pass a single value back via one of its arguments. Return the value instead. Suggested-by: Borislav Petkov <[email protected]> Signed-off-by: James Morse <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 5c3b63c commit 111136e

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

arch/x86/kernel/cpu/resctrl/ctrlmondata.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -427,16 +427,15 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
427427
return ret ?: nbytes;
428428
}
429429

430-
void resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
431-
u32 closid, enum resctrl_conf_type type, u32 *value)
430+
u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
431+
u32 closid, enum resctrl_conf_type type)
432432
{
433433
struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d);
434434
u32 idx = get_config_index(closid, type);
435435

436436
if (!is_mba_sc(r))
437-
*value = hw_dom->ctrl_val[idx];
438-
else
439-
*value = hw_dom->mbps_val[idx];
437+
return hw_dom->ctrl_val[idx];
438+
return hw_dom->mbps_val[idx];
440439
}
441440

442441
static void show_doms(struct seq_file *s, struct resctrl_schema *schema, int closid)
@@ -451,8 +450,8 @@ static void show_doms(struct seq_file *s, struct resctrl_schema *schema, int clo
451450
if (sep)
452451
seq_puts(s, ";");
453452

454-
resctrl_arch_get_config(r, dom, closid, schema->conf_type,
455-
&ctrl_val);
453+
ctrl_val = resctrl_arch_get_config(r, dom, closid,
454+
schema->conf_type);
456455
seq_printf(s, r->format_str, dom->id, max_data_width,
457456
ctrl_val);
458457
sep = true;

arch/x86/kernel/cpu/resctrl/monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_domain *dom_mbm)
442442
hw_dom_mba = resctrl_to_arch_dom(dom_mba);
443443

444444
cur_bw = pmbm_data->prev_bw;
445-
resctrl_arch_get_config(r_mba, dom_mba, closid, CDP_NONE, &user_bw);
445+
user_bw = resctrl_arch_get_config(r_mba, dom_mba, closid, CDP_NONE);
446446
delta_bw = pmbm_data->delta_bw;
447447
/*
448448
* resctrl_arch_get_config() chooses the mbps/ctrl value to return

arch/x86/kernel/cpu/resctrl/rdtgroup.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,8 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of,
923923
for (i = 0; i < closids_supported(); i++) {
924924
if (!closid_allocated(i))
925925
continue;
926-
resctrl_arch_get_config(r, dom, i, s->conf_type,
927-
&ctrl_val);
926+
ctrl_val = resctrl_arch_get_config(r, dom, i,
927+
s->conf_type);
928928
mode = rdtgroup_mode_by_closid(i);
929929
switch (mode) {
930930
case RDT_MODE_SHAREABLE:
@@ -1142,7 +1142,7 @@ static bool __rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d
11421142

11431143
/* Check for overlap with other resource groups */
11441144
for (i = 0; i < closids_supported(); i++) {
1145-
resctrl_arch_get_config(r, d, i, type, (u32 *)&ctrl_b);
1145+
ctrl_b = resctrl_arch_get_config(r, d, i, type);
11461146
mode = rdtgroup_mode_by_closid(i);
11471147
if (closid_allocated(i) && i != closid &&
11481148
mode != RDT_MODE_PSEUDO_LOCKSETUP) {
@@ -1222,7 +1222,8 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp)
12221222
continue;
12231223
has_cache = true;
12241224
list_for_each_entry(d, &r->domains, list) {
1225-
resctrl_arch_get_config(r, d, closid, s->conf_type, &ctrl);
1225+
ctrl = resctrl_arch_get_config(r, d, closid,
1226+
s->conf_type);
12261227
if (rdtgroup_cbm_overlaps(s, d, ctrl, closid, false)) {
12271228
rdt_last_cmd_puts("Schemata overlaps\n");
12281229
return false;
@@ -1395,8 +1396,9 @@ static int rdtgroup_size_show(struct kernfs_open_file *of,
13951396
if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
13961397
size = 0;
13971398
} else {
1398-
resctrl_arch_get_config(r, d, rdtgrp->closid,
1399-
schema->conf_type, &ctrl);
1399+
ctrl = resctrl_arch_get_config(r, d,
1400+
rdtgrp->closid,
1401+
schema->conf_type);
14001402
if (r->rid == RDT_RESOURCE_MBA)
14011403
size = ctrl;
14021404
else
@@ -2724,10 +2726,12 @@ static int __init_one_rdt_domain(struct rdt_domain *d, struct resctrl_schema *s,
27242726
* with an exclusive group.
27252727
*/
27262728
if (resctrl_arch_get_cdp_enabled(r->rid))
2727-
resctrl_arch_get_config(r, d, i, peer_type, &peer_ctl);
2729+
peer_ctl = resctrl_arch_get_config(r, d, i,
2730+
peer_type);
27282731
else
27292732
peer_ctl = 0;
2730-
resctrl_arch_get_config(r, d, i, s->conf_type, &ctrl_val);
2733+
ctrl_val = resctrl_arch_get_config(r, d, i,
2734+
s->conf_type);
27312735
used_b |= ctrl_val | peer_ctl;
27322736
if (mode == RDT_MODE_SHAREABLE)
27332737
cfg->new_ctrl |= ctrl_val | peer_ctl;

include/linux/resctrl.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ struct resctrl_schema {
194194
/* The number of closid supported by this resource regardless of CDP */
195195
u32 resctrl_arch_get_num_closid(struct rdt_resource *r);
196196
int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid);
197-
void resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
198-
u32 closid, enum resctrl_conf_type type,
199-
u32 *value);
197+
u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
198+
u32 closid, enum resctrl_conf_type type);
200199

201200
#endif /* _RESCTRL_H */

0 commit comments

Comments
 (0)