* [PATCH v2] drm/i915/gem: Use list_entry to access list members
@ 2021-05-23 17:23 ` Guenter Roeck
0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-05-23 17:23 UTC (permalink / raw)
To: Zhenyu Wang
Cc: Jani Nikula, David Airlie, Daniel Vetter, intel-gvt-dev,
intel-gfx, dri-devel, linux-kernel, Guenter Roeck
Use list_entry() instead of container_of() to access list members.
Also drop unnecessary and misleading NULL checks on the result of
list_entry().
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Checkpatch fixes:
- Fix alignment
- Replace comparison against NULL with !
drivers/gpu/drm/i915/gvt/dmabuf.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
index d4f883f35b95..e3f488681484 100644
--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
+++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
@@ -148,8 +148,7 @@ static void dmabuf_gem_object_free(struct kref *kref)
if (vgpu && vgpu->active && !list_empty(&vgpu->dmabuf_obj_list_head)) {
list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos,
- struct intel_vgpu_dmabuf_obj, list);
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
if (dmabuf_obj == obj) {
list_del(pos);
intel_gvt_hypervisor_put_vfio_device(vgpu);
@@ -357,10 +356,8 @@ pick_dmabuf_by_info(struct intel_vgpu *vgpu,
struct intel_vgpu_dmabuf_obj *ret = NULL;
list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
- list);
- if ((dmabuf_obj == NULL) ||
- (dmabuf_obj->info == NULL))
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
+ if (!dmabuf_obj->info)
continue;
fb_info = (struct intel_vgpu_fb_info *)dmabuf_obj->info;
@@ -387,11 +384,7 @@ pick_dmabuf_by_num(struct intel_vgpu *vgpu, u32 id)
struct intel_vgpu_dmabuf_obj *ret = NULL;
list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
- list);
- if (!dmabuf_obj)
- continue;
-
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
if (dmabuf_obj->dmabuf_id == id) {
ret = dmabuf_obj;
break;
@@ -600,8 +593,7 @@ void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu)
mutex_lock(&vgpu->dmabuf_lock);
list_for_each_safe(pos, n, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
- list);
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
dmabuf_obj->vgpu = NULL;
idr_remove(&vgpu->object_idr, dmabuf_obj->dmabuf_id);
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] drm/i915/gem: Use list_entry to access list members
@ 2021-05-23 17:23 ` Guenter Roeck
0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-05-23 17:23 UTC (permalink / raw)
To: Zhenyu Wang
Cc: David Airlie, intel-gfx, linux-kernel, dri-devel, intel-gvt-dev,
Guenter Roeck
Use list_entry() instead of container_of() to access list members.
Also drop unnecessary and misleading NULL checks on the result of
list_entry().
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Checkpatch fixes:
- Fix alignment
- Replace comparison against NULL with !
drivers/gpu/drm/i915/gvt/dmabuf.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
index d4f883f35b95..e3f488681484 100644
--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
+++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
@@ -148,8 +148,7 @@ static void dmabuf_gem_object_free(struct kref *kref)
if (vgpu && vgpu->active && !list_empty(&vgpu->dmabuf_obj_list_head)) {
list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos,
- struct intel_vgpu_dmabuf_obj, list);
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
if (dmabuf_obj == obj) {
list_del(pos);
intel_gvt_hypervisor_put_vfio_device(vgpu);
@@ -357,10 +356,8 @@ pick_dmabuf_by_info(struct intel_vgpu *vgpu,
struct intel_vgpu_dmabuf_obj *ret = NULL;
list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
- list);
- if ((dmabuf_obj == NULL) ||
- (dmabuf_obj->info == NULL))
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
+ if (!dmabuf_obj->info)
continue;
fb_info = (struct intel_vgpu_fb_info *)dmabuf_obj->info;
@@ -387,11 +384,7 @@ pick_dmabuf_by_num(struct intel_vgpu *vgpu, u32 id)
struct intel_vgpu_dmabuf_obj *ret = NULL;
list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
- list);
- if (!dmabuf_obj)
- continue;
-
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
if (dmabuf_obj->dmabuf_id == id) {
ret = dmabuf_obj;
break;
@@ -600,8 +593,7 @@ void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu)
mutex_lock(&vgpu->dmabuf_lock);
list_for_each_safe(pos, n, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
- list);
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
dmabuf_obj->vgpu = NULL;
idr_remove(&vgpu->object_idr, dmabuf_obj->dmabuf_id);
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Intel-gfx] [PATCH v2] drm/i915/gem: Use list_entry to access list members
@ 2021-05-23 17:23 ` Guenter Roeck
0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-05-23 17:23 UTC (permalink / raw)
To: Zhenyu Wang
Cc: David Airlie, intel-gfx, linux-kernel, dri-devel, intel-gvt-dev,
Guenter Roeck
Use list_entry() instead of container_of() to access list members.
Also drop unnecessary and misleading NULL checks on the result of
list_entry().
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Checkpatch fixes:
- Fix alignment
- Replace comparison against NULL with !
drivers/gpu/drm/i915/gvt/dmabuf.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
index d4f883f35b95..e3f488681484 100644
--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
+++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
@@ -148,8 +148,7 @@ static void dmabuf_gem_object_free(struct kref *kref)
if (vgpu && vgpu->active && !list_empty(&vgpu->dmabuf_obj_list_head)) {
list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos,
- struct intel_vgpu_dmabuf_obj, list);
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
if (dmabuf_obj == obj) {
list_del(pos);
intel_gvt_hypervisor_put_vfio_device(vgpu);
@@ -357,10 +356,8 @@ pick_dmabuf_by_info(struct intel_vgpu *vgpu,
struct intel_vgpu_dmabuf_obj *ret = NULL;
list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
- list);
- if ((dmabuf_obj == NULL) ||
- (dmabuf_obj->info == NULL))
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
+ if (!dmabuf_obj->info)
continue;
fb_info = (struct intel_vgpu_fb_info *)dmabuf_obj->info;
@@ -387,11 +384,7 @@ pick_dmabuf_by_num(struct intel_vgpu *vgpu, u32 id)
struct intel_vgpu_dmabuf_obj *ret = NULL;
list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
- list);
- if (!dmabuf_obj)
- continue;
-
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
if (dmabuf_obj->dmabuf_id == id) {
ret = dmabuf_obj;
break;
@@ -600,8 +593,7 @@ void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu)
mutex_lock(&vgpu->dmabuf_lock);
list_for_each_safe(pos, n, &vgpu->dmabuf_obj_list_head) {
- dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
- list);
+ dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
dmabuf_obj->vgpu = NULL;
idr_remove(&vgpu->object_idr, dmabuf_obj->dmabuf_id);
--
2.25.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/gem: Use list_entry to access list members (rev2)
2021-05-23 17:23 ` Guenter Roeck
(?)
(?)
@ 2021-05-23 18:01 ` Patchwork
-1 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2021-05-23 18:01 UTC (permalink / raw)
To: Guenter Roeck; +Cc: intel-gfx
[-- Attachment #1.1: Type: text/plain, Size: 4389 bytes --]
== Series Details ==
Series: drm/i915/gem: Use list_entry to access list members (rev2)
URL : https://patchwork.freedesktop.org/series/90449/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_10123 -> Patchwork_20177
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20177/index.html
Known issues
------------
Here are the changes found in Patchwork_20177 that come from known issues:
### IGT changes ###
#### Warnings ####
* igt@i915_selftest@live@execlists:
- fi-cfl-8109u: [DMESG-FAIL][1] ([i915#3462]) -> [INCOMPLETE][2] ([i915#3462])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10123/fi-cfl-8109u/igt@i915_selftest@live@execlists.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20177/fi-cfl-8109u/igt@i915_selftest@live@execlists.html
- fi-bsw-nick: [INCOMPLETE][3] ([i915#2782] / [i915#2940] / [i915#3462]) -> [DMESG-FAIL][4] ([i915#3462])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10123/fi-bsw-nick/igt@i915_selftest@live@execlists.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20177/fi-bsw-nick/igt@i915_selftest@live@execlists.html
- fi-bsw-kefka: [DMESG-FAIL][5] ([i915#3462]) -> [INCOMPLETE][6] ([i915#2782] / [i915#2940] / [i915#3462])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10123/fi-bsw-kefka/igt@i915_selftest@live@execlists.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20177/fi-bsw-kefka/igt@i915_selftest@live@execlists.html
* igt@runner@aborted:
- fi-bsw-kefka: [FAIL][7] ([i915#1436]) -> [FAIL][8] ([fdo#109271] / [i915#1436])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10123/fi-bsw-kefka/igt@runner@aborted.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20177/fi-bsw-kefka/igt@runner@aborted.html
- fi-cfl-8109u: [FAIL][9] ([i915#2426] / [i915#3363]) -> [FAIL][10] ([i915#3363])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10123/fi-cfl-8109u/igt@runner@aborted.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20177/fi-cfl-8109u/igt@runner@aborted.html
- fi-bsw-nick: [FAIL][11] ([i915#1436]) -> [FAIL][12] ([fdo#109271] / [i915#1436])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10123/fi-bsw-nick/igt@runner@aborted.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20177/fi-bsw-nick/igt@runner@aborted.html
- fi-kbl-soraka: [FAIL][13] ([i915#1436] / [i915#3363]) -> [FAIL][14] ([i915#1436] / [i915#2426] / [i915#3363])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10123/fi-kbl-soraka/igt@runner@aborted.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20177/fi-kbl-soraka/igt@runner@aborted.html
- fi-kbl-7567u: [FAIL][15] ([i915#1436] / [i915#3363]) -> [FAIL][16] ([i915#1436] / [i915#2426] / [i915#3363])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10123/fi-kbl-7567u/igt@runner@aborted.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20177/fi-kbl-7567u/igt@runner@aborted.html
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
[i915#2782]: https://gitlab.freedesktop.org/drm/intel/issues/2782
[i915#2940]: https://gitlab.freedesktop.org/drm/intel/issues/2940
[i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
[i915#3462]: https://gitlab.freedesktop.org/drm/intel/issues/3462
Participating hosts (42 -> 39)
------------------------------
Missing (3): fi-bsw-cyan fi-bdw-samus fi-hsw-4200u
Build changes
-------------
* Linux: CI_DRM_10123 -> Patchwork_20177
CI-20190529: 20190529
CI_DRM_10123: 6b2a86ddd31f336e2d0884889bd642650f1d805f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6092: d87087c321da07035d4f96d98c34e451b3ccb809 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_20177: 3fc93a4dedb1738f73c16ff301a6cc66a7412cbe @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
3fc93a4dedb1 drm/i915/gem: Use list_entry to access list members
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20177/index.html
[-- Attachment #1.2: Type: text/html, Size: 6538 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] drm/i915/gem: Use list_entry to access list members
2021-05-23 17:23 ` Guenter Roeck
(?)
@ 2021-06-01 8:28 ` Zhenyu Wang
-1 siblings, 0 replies; 7+ messages in thread
From: Zhenyu Wang @ 2021-06-01 8:28 UTC (permalink / raw)
To: Guenter Roeck
Cc: David Airlie, intel-gfx, linux-kernel, dri-devel, Jani Nikula,
Daniel Vetter, intel-gvt-dev
[-- Attachment #1: Type: text/plain, Size: 2707 bytes --]
On 2021.05.23 10:23:04 -0700, Guenter Roeck wrote:
> Use list_entry() instead of container_of() to access list members.
> Also drop unnecessary and misleading NULL checks on the result of
> list_entry().
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2: Checkpatch fixes:
> - Fix alignment
> - Replace comparison against NULL with !
>
> drivers/gpu/drm/i915/gvt/dmabuf.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
> index d4f883f35b95..e3f488681484 100644
> --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> @@ -148,8 +148,7 @@ static void dmabuf_gem_object_free(struct kref *kref)
>
> if (vgpu && vgpu->active && !list_empty(&vgpu->dmabuf_obj_list_head)) {
> list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos,
> - struct intel_vgpu_dmabuf_obj, list);
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> if (dmabuf_obj == obj) {
> list_del(pos);
> intel_gvt_hypervisor_put_vfio_device(vgpu);
> @@ -357,10 +356,8 @@ pick_dmabuf_by_info(struct intel_vgpu *vgpu,
> struct intel_vgpu_dmabuf_obj *ret = NULL;
>
> list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
> - list);
> - if ((dmabuf_obj == NULL) ||
> - (dmabuf_obj->info == NULL))
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> + if (!dmabuf_obj->info)
> continue;
>
> fb_info = (struct intel_vgpu_fb_info *)dmabuf_obj->info;
> @@ -387,11 +384,7 @@ pick_dmabuf_by_num(struct intel_vgpu *vgpu, u32 id)
> struct intel_vgpu_dmabuf_obj *ret = NULL;
>
> list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
> - list);
> - if (!dmabuf_obj)
> - continue;
> -
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> if (dmabuf_obj->dmabuf_id == id) {
> ret = dmabuf_obj;
> break;
> @@ -600,8 +593,7 @@ void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu)
>
> mutex_lock(&vgpu->dmabuf_lock);
> list_for_each_safe(pos, n, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
> - list);
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> dmabuf_obj->vgpu = NULL;
>
> idr_remove(&vgpu->object_idr, dmabuf_obj->dmabuf_id);
> --
Sorry for late reply! Looks good to me.
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] drm/i915/gem: Use list_entry to access list members
@ 2021-06-01 8:28 ` Zhenyu Wang
0 siblings, 0 replies; 7+ messages in thread
From: Zhenyu Wang @ 2021-06-01 8:28 UTC (permalink / raw)
To: Guenter Roeck
Cc: David Airlie, intel-gfx, linux-kernel, dri-devel, intel-gvt-dev
[-- Attachment #1: Type: text/plain, Size: 2707 bytes --]
On 2021.05.23 10:23:04 -0700, Guenter Roeck wrote:
> Use list_entry() instead of container_of() to access list members.
> Also drop unnecessary and misleading NULL checks on the result of
> list_entry().
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2: Checkpatch fixes:
> - Fix alignment
> - Replace comparison against NULL with !
>
> drivers/gpu/drm/i915/gvt/dmabuf.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
> index d4f883f35b95..e3f488681484 100644
> --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> @@ -148,8 +148,7 @@ static void dmabuf_gem_object_free(struct kref *kref)
>
> if (vgpu && vgpu->active && !list_empty(&vgpu->dmabuf_obj_list_head)) {
> list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos,
> - struct intel_vgpu_dmabuf_obj, list);
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> if (dmabuf_obj == obj) {
> list_del(pos);
> intel_gvt_hypervisor_put_vfio_device(vgpu);
> @@ -357,10 +356,8 @@ pick_dmabuf_by_info(struct intel_vgpu *vgpu,
> struct intel_vgpu_dmabuf_obj *ret = NULL;
>
> list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
> - list);
> - if ((dmabuf_obj == NULL) ||
> - (dmabuf_obj->info == NULL))
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> + if (!dmabuf_obj->info)
> continue;
>
> fb_info = (struct intel_vgpu_fb_info *)dmabuf_obj->info;
> @@ -387,11 +384,7 @@ pick_dmabuf_by_num(struct intel_vgpu *vgpu, u32 id)
> struct intel_vgpu_dmabuf_obj *ret = NULL;
>
> list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
> - list);
> - if (!dmabuf_obj)
> - continue;
> -
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> if (dmabuf_obj->dmabuf_id == id) {
> ret = dmabuf_obj;
> break;
> @@ -600,8 +593,7 @@ void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu)
>
> mutex_lock(&vgpu->dmabuf_lock);
> list_for_each_safe(pos, n, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
> - list);
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> dmabuf_obj->vgpu = NULL;
>
> idr_remove(&vgpu->object_idr, dmabuf_obj->dmabuf_id);
> --
Sorry for late reply! Looks good to me.
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-gfx] [PATCH v2] drm/i915/gem: Use list_entry to access list members
@ 2021-06-01 8:28 ` Zhenyu Wang
0 siblings, 0 replies; 7+ messages in thread
From: Zhenyu Wang @ 2021-06-01 8:28 UTC (permalink / raw)
To: Guenter Roeck
Cc: David Airlie, intel-gfx, linux-kernel, dri-devel, intel-gvt-dev
[-- Attachment #1.1: Type: text/plain, Size: 2707 bytes --]
On 2021.05.23 10:23:04 -0700, Guenter Roeck wrote:
> Use list_entry() instead of container_of() to access list members.
> Also drop unnecessary and misleading NULL checks on the result of
> list_entry().
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2: Checkpatch fixes:
> - Fix alignment
> - Replace comparison against NULL with !
>
> drivers/gpu/drm/i915/gvt/dmabuf.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
> index d4f883f35b95..e3f488681484 100644
> --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> @@ -148,8 +148,7 @@ static void dmabuf_gem_object_free(struct kref *kref)
>
> if (vgpu && vgpu->active && !list_empty(&vgpu->dmabuf_obj_list_head)) {
> list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos,
> - struct intel_vgpu_dmabuf_obj, list);
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> if (dmabuf_obj == obj) {
> list_del(pos);
> intel_gvt_hypervisor_put_vfio_device(vgpu);
> @@ -357,10 +356,8 @@ pick_dmabuf_by_info(struct intel_vgpu *vgpu,
> struct intel_vgpu_dmabuf_obj *ret = NULL;
>
> list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
> - list);
> - if ((dmabuf_obj == NULL) ||
> - (dmabuf_obj->info == NULL))
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> + if (!dmabuf_obj->info)
> continue;
>
> fb_info = (struct intel_vgpu_fb_info *)dmabuf_obj->info;
> @@ -387,11 +384,7 @@ pick_dmabuf_by_num(struct intel_vgpu *vgpu, u32 id)
> struct intel_vgpu_dmabuf_obj *ret = NULL;
>
> list_for_each(pos, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
> - list);
> - if (!dmabuf_obj)
> - continue;
> -
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> if (dmabuf_obj->dmabuf_id == id) {
> ret = dmabuf_obj;
> break;
> @@ -600,8 +593,7 @@ void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu)
>
> mutex_lock(&vgpu->dmabuf_lock);
> list_for_each_safe(pos, n, &vgpu->dmabuf_obj_list_head) {
> - dmabuf_obj = container_of(pos, struct intel_vgpu_dmabuf_obj,
> - list);
> + dmabuf_obj = list_entry(pos, struct intel_vgpu_dmabuf_obj, list);
> dmabuf_obj->vgpu = NULL;
>
> idr_remove(&vgpu->object_idr, dmabuf_obj->dmabuf_id);
> --
Sorry for late reply! Looks good to me.
Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-06-01 8:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23 17:23 [PATCH v2] drm/i915/gem: Use list_entry to access list members Guenter Roeck
2021-05-23 17:23 ` [Intel-gfx] " Guenter Roeck
2021-05-23 17:23 ` Guenter Roeck
2021-05-23 18:01 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/gem: Use list_entry to access list members (rev2) Patchwork
2021-06-01 8:28 ` [PATCH v2] drm/i915/gem: Use list_entry to access list members Zhenyu Wang
2021-06-01 8:28 ` [Intel-gfx] " Zhenyu Wang
2021-06-01 8:28 ` Zhenyu Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.