lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180318215105.GA15431@seema-Inspiron-15-3567>
Date:   Mon, 19 Mar 2018 03:21:05 +0530
From:   Arushi Singhal <arushisinghal19971997@...il.com>
To:     alexander.deucher@....com
Cc:     Christian König <christian.koenig@....com>,
        "David (ChunMing) Zhou" <David1.Zhou@....com>,
        David Airlie <airlied@...ux.ie>,
        Tomi Valkeinen <tomi.valkeinen@...com>,
        amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, outreachy-kernel@...glegroups.com
Subject: [PATCH] gpu: drm: Use list_first_entry instead of list_entry

This patch replaces list_entry with list_first_entry as it makes the
code more clear.
Done using coccinelle:

@@
expression e;
@@
(
- list_entry(e->next,
+ list_first_entry(e,
  ...)
|
- list_entry(e->prev,
+ list_last_entry(e,
  ...)
)

Signed-off-by: Arushi Singhal <arushisinghal19971997@...il.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 4 ++--
 drivers/gpu/drm/omapdrm/dss/display.c  | 4 ++--
 drivers/gpu/drm/radeon/radeon_sa.c     | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
index 3144400..646f593 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c
@@ -158,7 +158,7 @@ static void amdgpu_sa_bo_try_free(struct amdgpu_sa_manager *sa_manager)
 	if (sa_manager->hole->next == &sa_manager->olist)
 		return;
 
-	sa_bo = list_entry(sa_manager->hole->next, struct amdgpu_sa_bo, olist);
+	sa_bo = list_first_entry(sa_manager->hole, struct amdgpu_sa_bo, olist);
 	list_for_each_entry_safe_from(sa_bo, tmp, &sa_manager->olist, olist) {
 		if (sa_bo->fence == NULL ||
 		    !dma_fence_is_signaled(sa_bo->fence)) {
@@ -183,7 +183,7 @@ static inline unsigned amdgpu_sa_bo_hole_eoffset(struct amdgpu_sa_manager *sa_ma
 	struct list_head *hole = sa_manager->hole;
 
 	if (hole->next != &sa_manager->olist) {
-		return list_entry(hole->next, struct amdgpu_sa_bo, olist)->soffset;
+		return list_first_entry(hole, struct amdgpu_sa_bo, olist)->soffset;
 	}
 	return sa_manager->size;
 }
diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
index 0c9480b..fb9ecae 100644
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ b/drivers/gpu/drm/omapdrm/dss/display.c
@@ -158,8 +158,8 @@ struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from)
 				goto out;
 			}
 
-			dssdev = list_entry(l->next, struct omap_dss_device,
-					panel_list);
+			dssdev = list_first_entry(l, struct omap_dss_device,
+						  panel_list);
 			omap_dss_get_device(dssdev);
 			goto out;
 		}
diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c
index 197b157..66c0482 100644
--- a/drivers/gpu/drm/radeon/radeon_sa.c
+++ b/drivers/gpu/drm/radeon/radeon_sa.c
@@ -158,7 +158,7 @@ static void radeon_sa_bo_try_free(struct radeon_sa_manager *sa_manager)
 	if (sa_manager->hole->next == &sa_manager->olist)
 		return;
 
-	sa_bo = list_entry(sa_manager->hole->next, struct radeon_sa_bo, olist);
+	sa_bo = list_first_entry(sa_manager->hole, struct radeon_sa_bo, olist);
 	list_for_each_entry_safe_from(sa_bo, tmp, &sa_manager->olist, olist) {
 		if (sa_bo->fence == NULL || !radeon_fence_signaled(sa_bo->fence)) {
 			return;
@@ -182,7 +182,7 @@ static inline unsigned radeon_sa_bo_hole_eoffset(struct radeon_sa_manager *sa_ma
 	struct list_head *hole = sa_manager->hole;
 
 	if (hole->next != &sa_manager->olist) {
-		return list_entry(hole->next, struct radeon_sa_bo, olist)->soffset;
+		return list_first_entry(hole, struct radeon_sa_bo, olist)->soffset;
 	}
 	return sa_manager->size;
 }
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ