On 29/11/2023 12:08, Lukasz Luba wrote:
Split the process of allocation and data initialization for the EM table.
The upcoming changes for modifiable EM will use it.
This change is not expected to alter the general functionality.
NIT: IMHO, I guess you wanted to say: "No functional changes
introduced"? I.e. all not only general functionality ...
[...]
static int em_create_pd(struct device *dev, int nr_states,
@@ -234,11 +234,15 @@ static int em_create_pd(struct device *dev, int nr_states,
return -ENOMEM;
}
- ret = em_create_perf_table(dev, pd, nr_states, cb, flags);
- if (ret) {
- kfree(pd);
- return ret;
- }
+ pd->nr_perf_states = nr_states;
Why does `pd->nr_perf_states = nr_states;` have to move from
em_create_perf_table() to em_create_pd()?
+
+ ret = em_allocate_perf_table(pd, nr_states);
+ if (ret)
+ goto free_pd;
+
+ ret = em_create_perf_table(dev, pd, pd->table, nr_states, cb, flags);
If you set it in em_create_pd() then you can use 'pd->nr_perf_states' in
em_create_perf_table() and doesn't have to pass `nr_states`.
[...]