drm/nouveau/clk: Add index field to nvkm_cstate
authorKarol Herbst <karolherbst@gmail.com>
Tue, 12 Jul 2016 19:36:08 +0000 (21:36 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 12 Oct 2016 07:29:22 +0000 (17:29 +1000)
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: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/subdev/clk.h
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c

index fb54417bc458898e6304b480bf58d4d783aa82e4..70c8665756ca0c0e9350e744c385bb9bd97c181f 100644 (file)
@@ -52,6 +52,7 @@ struct nvkm_cstate {
        struct list_head head;
        u8  voltage;
        u32 domain[nv_clk_src_max];
+       u8  id;
 };
 
 struct nvkm_pstate {
index 9ee24ec2869b654cd0d90de5424c67e42ea40912..23cc04c37c07c90ff183c163d54ffeab9958f176 100644 (file)
@@ -160,6 +160,7 @@ nvkm_cstate_new(struct nvkm_clk *clk, int idx, struct nvkm_pstate *pstate)
 
        *cstate = pstate->base;
        cstate->voltage = cstepX.voltage;
+       cstate->id = idx;
 
        while (domain && domain->name != nv_clk_src_max) {
                if (domain->flags & NVKM_CLK_DOM_FLAG_CORE) {