Ben Skeggs
2018-Mar-26 12:34 UTC
[Nouveau] [PATCH v2 2/2] gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry
On Mon, Mar 26, 2018 at 4:01 AM, Arushi Singhal <arushisinghal19971997 at gmail.com> wrote:> It's better to use list_entry instead of list_{next/prev}_entry > as it makes the code more clear to read. > This patch replace list_entry with list_{next/prev}_entry. > > Signed-off-by: Arushi Singhal <arushisinghal19971997 at gmail.com>Acked-by: Ben Skeggs <bskeggs at redhat.com>> --- > drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c > index e4c8d31..81c3567 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c > @@ -134,7 +134,7 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct nvkm_pstate *pstate, > nvkm_volt_map(volt, volt->max2_id, clk->temp)); > > for (cstate = start; &cstate->head != &pstate->list; > - cstate = list_entry(cstate->head.prev, typeof(*cstate), head)) { > + cstate = list_prev_entry(cstate, head)) { > if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp)) > break; > } > -- > 2.7.4 >
Chris Wilson
2018-Mar-26 12:43 UTC
[Nouveau] [PATCH v2 2/2] gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry
Quoting Ben Skeggs (2018-03-26 13:34:54)> On Mon, Mar 26, 2018 at 4:01 AM, Arushi Singhal > <arushisinghal19971997 at gmail.com> wrote: > > It's better to use list_entry instead of list_{next/prev}_entry > > as it makes the code more clear to read. > > This patch replace list_entry with list_{next/prev}_entry. > > > > Signed-off-by: Arushi Singhal <arushisinghal19971997 at gmail.com> > Acked-by: Ben Skeggs <bskeggs at redhat.com> > > > --- > > drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c > > index e4c8d31..81c3567 100644 > > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c > > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c > > @@ -134,7 +134,7 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct nvkm_pstate *pstate, > > nvkm_volt_map(volt, volt->max2_id, clk->temp)); > > > > for (cstate = start; &cstate->head != &pstate->list; > > - cstate = list_entry(cstate->head.prev, typeof(*cstate), head)) { > > + cstate = list_prev_entry(cstate, head)) {This loop could be written as: cstate = start; /* cstate looks redundant here, just use start? */ list_for_each_entry_from_reverse(cstate, &pstate->list, head)> > if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp)) > > break; > > } > > -- > > 2.7.4
Daniel Vetter
2018-Mar-26 14:11 UTC
[Nouveau] [PATCH v2 2/2] gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry
On Mon, Mar 26, 2018 at 01:43:30PM +0100, Chris Wilson wrote:> Quoting Ben Skeggs (2018-03-26 13:34:54) > > On Mon, Mar 26, 2018 at 4:01 AM, Arushi Singhal > > <arushisinghal19971997 at gmail.com> wrote: > > > It's better to use list_entry instead of list_{next/prev}_entry > > > as it makes the code more clear to read. > > > This patch replace list_entry with list_{next/prev}_entry. > > > > > > Signed-off-by: Arushi Singhal <arushisinghal19971997 at gmail.com> > > Acked-by: Ben Skeggs <bskeggs at redhat.com>Applied, thanks for ack&patch.> > > > > --- > > > drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c > > > index e4c8d31..81c3567 100644 > > > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c > > > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c > > > @@ -134,7 +134,7 @@ nvkm_cstate_find_best(struct nvkm_clk *clk, struct nvkm_pstate *pstate, > > > nvkm_volt_map(volt, volt->max2_id, clk->temp)); > > > > > > for (cstate = start; &cstate->head != &pstate->list; > > > - cstate = list_entry(cstate->head.prev, typeof(*cstate), head)) { > > > + cstate = list_prev_entry(cstate, head)) { > > This loop could be written as: > > cstate = start; /* cstate looks redundant here, just use start? */ > list_for_each_entry_from_reverse(cstate, &pstate->list, head)Yeah, sounds like a good follow-up patch. -Daniel> > > > if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp)) > > > break; > > > } > > > -- > > > 2.7.4 > _______________________________________________ > dri-devel mailing list > dri-devel at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Maybe Matching Threads
- [PATCH v2 2/2] gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry
- [PATCH v2 2/2] gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry
- [Outreachy kernel] [PATCH] gpu: drm: Use list_{next/prev}_entry instead of list_entry
- [Outreachy kernel] [PATCH] gpu: drm: Use list_{next/prev}_entry instead of list_entry
- [Outreachy kernel] [PATCH] gpu: drm: Use list_{next/prev}_entry instead of list_entry