<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 27, 2018 at 2:44 PM, Ben Skeggs <span dir="ltr"><<a href="mailto:skeggsb@gmail.com" target="_blank">skeggsb@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 27 March 2018 at 19:11, Arushi Singhal<br>
<span class=""><<a href="mailto:arushisinghal19971997@gmail.com">arushisinghal19971997@gmail.<wbr>com</a>> wrote:<br>
> It's better to use "list_for_each_entry_from_<wbr>reverse" for iterating list<br>
> than "for loop" as it makes the code more clear to read.<br>
> This patch replace "for loop" with "list_for_each_entry_from_<wbr>reverse"<br>
> and remove "cstate" variable as it is redundant in the code.<br>
</span>I would prefer to also see "start" renamed to "cstate" with this change.<br></blockquote><div>Hello Ben<br><br>Yes, using cstate is more accurate, as most of the functions are using "cstate" variable.<br><br></div><div>Best<br></div><div>Arushi<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Ben.<br>
<div><div class="h5"><br>
><br>
> Signed-off-by: Arushi Singhal <<a href="mailto:arushisinghal19971997@gmail.com">arushisinghal19971997@gmail.<wbr>com</a>><br>
> ---<br>
> drivers/gpu/drm/nouveau/nvkm/<wbr>subdev/clk/base.c | 8 +++-----<br>
> 1 file changed, 3 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/nouveau/<wbr>nvkm/subdev/clk/base.c b/drivers/gpu/drm/nouveau/<wbr>nvkm/subdev/clk/base.c<br>
> index 81c3567..5e56f74 100644<br>
> --- a/drivers/gpu/drm/nouveau/<wbr>nvkm/subdev/clk/base.c<br>
> +++ b/drivers/gpu/drm/nouveau/<wbr>nvkm/subdev/clk/base.c<br>
> @@ -113,7 +113,6 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct nvkm_pstate *pstate,<br>
> {<br>
> struct nvkm_device *device = clk->subdev.device;<br>
> struct nvkm_volt *volt = device->volt;<br>
> - struct nvkm_cstate *cstate;<br>
> int max_volt;<br>
><br>
> if (!pstate || !start)<br>
> @@ -133,13 +132,12 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct nvkm_pstate *pstate,<br>
> max_volt = min(max_volt,<br>
> nvkm_volt_map(volt, volt->max2_id, clk->temp));<br>
><br>
> - for (cstate = start; &cstate->head != &pstate->list;<br>
> - cstate = list_prev_entry(cstate, head)) {<br>
> - if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))<br>
> + list_for_each_entry_from_<wbr>reverse(start, &pstate->list, head) {<br>
> + if (nvkm_cstate_valid(clk, start, max_volt, clk->temp))<br>
> break;<br>
> }<br>
><br>
> - return cstate;<br>
> + return start;<br>
> }<br>
><br>
> static struct nvkm_cstate *<br>
> --<br>
> 2.7.4<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> dri-devel mailing list<br>
> <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.<wbr>org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/dri-devel</a><br>
</blockquote></div><br></div></div>