[Intel-gfx] [PATCH -next] drm/i915/gvt: Use list_for_each_entry() helper
Jinjie Ruan
ruanjinjie at huawei.com
Mon Aug 28 12:35:41 UTC 2023
Convert list_for_each() to list_for_each_entry() so that the pos
list_head pointer and list_entry() call are no longer needed, which
can reduce a few lines of code. No functional changed.
Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>
---
drivers/gpu/drm/i915/gvt/dmabuf.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
index 6834f9fe40cf..f136ce140a2b 100644
--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
+++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
@@ -340,13 +340,11 @@ static struct intel_vgpu_dmabuf_obj *
pick_dmabuf_by_info(struct intel_vgpu *vgpu,
struct intel_vgpu_fb_info *latest_info)
{
- struct list_head *pos;
struct intel_vgpu_fb_info *fb_info;
struct intel_vgpu_dmabuf_obj *dmabuf_obj = NULL;
struct intel_vgpu_dmabuf_obj *ret = NULL;
- list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
+ list_for_each_entry(dmabuf_obj, &vgpu->dmabuf_obj_list_head, list) {
if (!dmabuf_obj->info)
continue;
@@ -369,12 +367,10 @@ pick_dmabuf_by_info(struct intel_vgpu *vgpu,
static struct intel_vgpu_dmabuf_obj *
pick_dmabuf_by_num(struct intel_vgpu *vgpu, u32 id)
{
- struct list_head *pos;
struct intel_vgpu_dmabuf_obj *dmabuf_obj = NULL;
struct intel_vgpu_dmabuf_obj *ret = NULL;
- list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
+ list_for_each_entry(dmabuf_obj, &vgpu->dmabuf_obj_list_head, list) {
if (dmabuf_obj->dmabuf_id == id) {
ret = dmabuf_obj;
break;
--
2.34.1
More information about the Intel-gfx
mailing list