Skip to contentSkip to conversation

drm: Replace list_entry

PATCH Applied Arushi Singhal 4 participants 7 messages Mar 25, 2018 – Mar 26, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover drm: Replace list_entry

Replace list_entry with list_{next/prev}_entry.

Arushi Singhal (2):
gpu: drm/lease:: Use list_{next/prev}_entry instead of list_entry
gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry

 drivers/gpu/drm/drm_lease.c                    | 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 10 lines
changes in v2
*All the maintainers are added.
*More accurate coccinelle script is used
for this patch than the one used in previous version.
2.7.4

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#1 lore raw

PATCH v2 1/2 gpu: drm/lease:: Use list_{next/prev}_entry instead of list_entry

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.

---
 drivers/gpu/drm/drm_lease.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_lease.c +1 -1
index 1402c0e..4dcfb5f 100644
@@ -340,7 +340,7 @@ static void _drm_lease_revoke(struct drm_master *top)
 				break;
 
 			/* Over */
-			master = list_entry(master->lessee_list.next, struct drm_master, lessee_list);
+			master = list_next_entry(master, lessee_list);
 		}
 	}
 }
Signature · 6 lines
2.7.4

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#2 lore raw

Re: [Nouveau] [PATCH v2 1/2] gpu: drm/lease:: Use list_{next/prev}_entry instead of list_entry

Quoted 5 lines · Arushi Singhal

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.

Applied to drm-misc-next, thanks for your patch. I'll leave the other one to nouveau folks.
-Daniel

Quoted 24 lines
---
 drivers/gpu/drm/drm_lease.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_lease.c +1 -1
index 1402c0e..4dcfb5f 100644
@@ -340,7 +340,7 @@ static void _drm_lease_revoke(struct drm_master *top)
 				break;
 
 			/* Over */
-			master = list_entry(master->lessee_list.next, struct drm_master, lessee_list);
+			master = list_next_entry(master, lessee_list);
 		}
 	}
 }
Signature · 6 lines
2.7.4

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#3 lore raw

PATCH v2 2/2 gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry

In reply to Arushi Singhal

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.

---
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +1 -1
index e4c8d31..81c3567 100644
@@ -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;
 	}
Signature · 6 lines
2.7.4

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
Acked-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry

Quoted 5 lines · Arushi Singhal

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.

Quoted 18 lines
---
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +1 -2
index e4c8d31..81c3567 100644
@@ -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;
        }
--
Quoted 2 lines

2.7.4

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

#5 lore raw

Re: [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)

Quoted 20 lines
Quoted 5 lines · Arushi Singhal

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.

Quoted 11 lines
---
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +0 -0
index e4c8d31..81c3567 100644
@@ -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));
 
Quoted 3 lines

drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c nvkm_cstate_find_best(struct nvkm_clk *clk, struct nvkm_pstate *pstate, · line 137

Quoted 3 lines
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +1 -1
        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)
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +0 -1
                if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
                        break;
        }
--

2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

Re: [PATCH v2 2/2] gpu: drm: nouveau: Use list_{next/prev}_entry instead of list_entry

Quoted 9 lines · Chris Wilson

Quoting Ben Skeggs (2018-03-26 13:34:54)

Quoted 8 lines
Quoted 5 lines · Arushi Singhal

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.

Applied, thanks for ack&patch.

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
---
 drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +0 -0
index e4c8d31..81c3567 100644
@@ -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));
 
Quoted 8 lines
Quoted 3 lines

drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c nvkm_cstate_find_best(struct nvkm_clk *clk, struct nvkm_pstate *pstate, · line 137

Quoted 3 lines
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +1 -1
        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

Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +0 -1
                if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
                        break;
        }
--

2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch