Commit 761c8f69 authored by Karol Herbst's avatar Karol Herbst Committed by Ben Skeggs

drm/nouveau/clk: Add index field to nvkm_cstate

It is better to read out the id out of the cstate struct directly instead
of iterating over the list of cstates over and over again. Especially when
we start saving pointers to a nvkm_cstate struct, it makes things easier.

v5: Rename field to id.
Signed-off-by: default avatarKarol Herbst <karolherbst@gmail.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent fa6c4d8e
...@@ -52,6 +52,7 @@ struct nvkm_cstate { ...@@ -52,6 +52,7 @@ struct nvkm_cstate {
struct list_head head; struct list_head head;
u8 voltage; u8 voltage;
u32 domain[nv_clk_src_max]; u32 domain[nv_clk_src_max];
u8 id;
}; };
struct nvkm_pstate { struct nvkm_pstate {
......
...@@ -160,6 +160,7 @@ nvkm_cstate_new(struct nvkm_clk *clk, int idx, struct nvkm_pstate *pstate) ...@@ -160,6 +160,7 @@ nvkm_cstate_new(struct nvkm_clk *clk, int idx, struct nvkm_pstate *pstate)
*cstate = pstate->base; *cstate = pstate->base;
cstate->voltage = cstepX.voltage; cstate->voltage = cstepX.voltage;
cstate->id = idx;
while (domain && domain->name != nv_clk_src_max) { while (domain && domain->name != nv_clk_src_max) {
if (domain->flags & NVKM_CLK_DOM_FLAG_CORE) { if (domain->flags & NVKM_CLK_DOM_FLAG_CORE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment