drm/amd/amdgpu: fix comparison pointer to bool warning
Subsystems (2)
cover drm/amd/amdgpu: fix comparison pointer to bool warning
Zheng Bin (8):
drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v10_0.c drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_0.c drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_2.c drm/amd/amdgpu: fix comparison pointer to bool warning in si.c drm/amd/amdgpu: fix comparison pointer to bool warning in uvd_v6_0.c drm/amd/amdgpu: fix comparison pointer to bool warning in
amdgpu_atpx_handler.c
drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v4_0.c
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 +- drivers/gpu/drm/amd/amdgpu/si.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-)
--
2.26.0.106.g9fadedd
PATCH 1/8 drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c
Fixes coccicheck warning:
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:2805:5-11: WARNING: Comparison to bool
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
@@ -2802,7 +2802,7 @@ static void pwr_10_0_gfxip_control_over_cgpg(struct amdgpu_device *adev,uint32_t default_data =0 ; default_data = data =RREG32 (SOC15_REG_OFFSET (PWR ,0 , mmPWR_MISC_CNTL_STATUS)); -if (enable == true) { +if (enable) {/* enable GFXIP control over CGPG */ data |=PWR_MISC_CNTL_STATUS__PWR_GFX_RLC_CGPG_EN_MASK ;if (default_data != data)
--
2.26.0.106.g9fadedd
Am 09.09.20 um 15:07 schrieb Zheng Bin:
Quoted 21 lines
Zheng Bin (8):
drm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v9_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v10_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_2.cdrm/amd/amdgpu: fix comparison pointer to bool warning insi.cdrm/amd/amdgpu: fix comparison pointer to bool warning inuvd_v6_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning in
amdgpu_atpx_handler.c
drm/amd/amdgpu: fix comparison pointer to bool warning insdma_v4_0.cdrivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 +- drivers/gpu/drm/amd/amdgpu/si.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-)
Quoted 3 lines
--
2.26.0.106.g9fadedd
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
I question the value of these warnings. Why even have a boolean type if you are going to get warnings when you use them...
That said, applied to avoid getting these patches again and again every time someone sees this.
Alex
Quoted 25 lines · Christian König
Am 09.09.20 um 15:07 schrieb Zheng Bin:
Quoted 21 lines
Zheng Bin (8):
drm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v9_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v10_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_2.cdrm/amd/amdgpu: fix comparison pointer to bool warning insi.cdrm/amd/amdgpu: fix comparison pointer to bool warning inuvd_v6_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning in
amdgpu_atpx_handler.c
drm/amd/amdgpu: fix comparison pointer to bool warning insdma_v4_0.cdrivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 +- drivers/gpu/drm/amd/amdgpu/si.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-)
Quoted 8 lines
Quoted 3 lines
--
2.26.0.106.g9fadedd_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 4 lines · Alex Deucher
I question the value of these warnings. Why even have a boolean type if you are going to get warnings when you use them...
That said, applied to avoid getting these patches again and again every time someone sees this.
if (this_is_sparta)
if (this_is_sparta == true)
if (this_is_sparta != false)
I think the first one reads the best, and avoids having to decide between truth and falsehood :)
Quoted 41 lines
Alex
Quoted 25 lines · Christian König
Am 09.09.20 um 15:07 schrieb Zheng Bin:
Quoted 21 lines
Zheng Bin (8):
drm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v9_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v10_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_2.cdrm/amd/amdgpu: fix comparison pointer to bool warning insi.cdrm/amd/amdgpu: fix comparison pointer to bool warning inuvd_v6_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning in
amdgpu_atpx_handler.c
drm/amd/amdgpu: fix comparison pointer to bool warning insdma_v4_0.cdrivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 +- drivers/gpu/drm/amd/amdgpu/si.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-)Quoted 8 lines
Quoted 3 lines
--
2.26.0.106.g9fadedd_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 15.09.20 um 21:35 schrieb Ville Syrjälä:
Quoted 11 lines · Alex Deucher
Quoted 4 lines
I question the value of these warnings. Why even have a boolean type if you are going to get warnings when you use them...
That said, applied to avoid getting these patches again and again every time someone sees this.if (
this_is_sparta)
if (this_is_sparta== true)
if (this_is_sparta!= false)I think the first one reads the best, and avoids having to decide between truth and falsehood :)
+1
Christian.
Quoted 31 lines
Quoted 31 lines
Alex
Quoted 27 lines · Christian König
Am 09.09.20 um 15:07 schrieb Zheng Bin:
Quoted 24 lines
Zheng Bin (8):
drm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v9_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v10_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_2.cdrm/amd/amdgpu: fix comparison pointer to bool warning insi.cdrm/amd/amdgpu: fix comparison pointer to bool warning inuvd_v6_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning in
amdgpu_atpx_handler.c
drm/amd/amdgpu: fix comparison pointer to bool warning insdma_v4_0.cdrivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 +- drivers/gpu/drm/amd/amdgpu/si.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-)--
2.26.0.106.g9fadedd
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Christian König
Am 15.09.20 um 21:35 schrieb Ville Syrjälä:
Quoted 5 lines · Alex Deucher
Quoted 4 lines
I question the value of these warnings. Why even have a boolean type if you are going to get warnings when you use them...
That said, applied to avoid getting these patches again and again every time someone sees this.
Quoted 8 lines
Quoted 6 lines
if (
this_is_sparta)
if (this_is_sparta== true)
if (this_is_sparta!= false)I think the first one reads the best, and avoids having to decide between truth and falsehood :)
+1
+1, especially because we also have the inversion when using negative errno codes for failures and 0 as success, which results in
if (errno == 0) /* success case */
but
if (bool == 0) /* failure case */
now creative people do sometimes
if (!errno) /* success case */
which I think is horribly confusing. So imo for more easier telling apart of these too I think consistently using the short form for booleans, and consistently using the more explicit long form for errno checks is a Very Good Pattern :-)
Cheers, Daniel
Quoted 47 lines
Christian.
Quoted 31 lines
Quoted 31 lines
Alex
Quoted 27 lines · Christian König
Am 09.09.20 um 15:07 schrieb Zheng Bin:
Quoted 24 lines
Zheng Bin (8):
drm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v9_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v10_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_2.cdrm/amd/amdgpu: fix comparison pointer to bool warning insi.cdrm/amd/amdgpu: fix comparison pointer to bool warning inuvd_v6_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning in
amdgpu_atpx_handler.c
drm/amd/amdgpu: fix comparison pointer to bool warning insdma_v4_0.cdrivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 +- drivers/gpu/drm/amd/amdgpu/si.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-)--
2.26.0.106.g9fadeddQuoted 8 lines
Quoted 8 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 25 lines · Daniel Vetter
Quoted 6 lines · Christian König
Am 15.09.20 um 21:35 schrieb Ville Syrjälä:
Quoted 5 lines · Alex Deucher
Quoted 4 lines
I question the value of these warnings. Why even have a boolean type if you are going to get warnings when you use them...
That said, applied to avoid getting these patches again and again every time someone sees this.Quoted 8 lines
Quoted 6 lines
if (
this_is_sparta)
if (this_is_sparta== true)
if (this_is_sparta!= false)I think the first one reads the best, and avoids having to decide between truth and falsehood :)
+1
+1, especially because we also have the inversion when using negative errno codes for failures and 0 as success, which results in
if (errno == 0) /* success case */but
if (bool == 0) /* failure case */
Quoted 8 lines
now creative people do sometimes
if (!errno) /* success case */
which I think is horribly confusing. So imo for more easier telling apart of these too I think consistently using the short form for booleans, and consistently using the more explicit long form for errno checks is a Very Good Pattern :-)
I don't disagree with your logic, but we regularly get patches to convert errno checks to drop the direct comparison because that is the "preferred kernel style". Arguably, we should be explicit in all cases as that avoids all confusion. With that in mind, my original point stands. Why have a type when comparisons against valid settings for that type produce errors?
Alex
Quoted 51 lines
Cheers, Daniel
Quoted 43 lines
Christian.
Quoted 31 lines
Quoted 31 lines
Alex
Quoted 27 lines · Christian König
Am 09.09.20 um 15:07 schrieb Zheng Bin:
Quoted 24 lines
Zheng Bin (8):
drm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v9_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v10_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_2.cdrm/amd/amdgpu: fix comparison pointer to bool warning insi.cdrm/amd/amdgpu: fix comparison pointer to bool warning inuvd_v6_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning in
amdgpu_atpx_handler.c
drm/amd/amdgpu: fix comparison pointer to bool warning insdma_v4_0.cdrivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 +- drivers/gpu/drm/amd/amdgpu/si.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-)--
2.26.0.106.g9fadeddQuoted 8 lines
Quoted 8 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develQuoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König
maintainerAm 16.09.20 um 15:36 schrieb Alex Deucher:
Quoted 31 lines · Daniel Vetter
Quoted 22 lines · Christian König
Quoted 6 lines
Am 15.09.20 um 21:35 schrieb Ville Syrjälä:
Quoted 5 lines · Alex Deucher
Quoted 4 lines
I question the value of these warnings. Why even have a boolean type if you are going to get warnings when you use them...
That said, applied to avoid getting these patches again and again every time someone sees this.Quoted 7 lines
Quoted 6 lines
if (
this_is_sparta)
if (this_is_sparta== true)
if (this_is_sparta!= false)I think the first one reads the best, and avoids having to decide between truth and falsehood :)
+1
+1, especially because we also have the inversion when using negative errno codes for failures and 0 as success, which results in
if (errno == 0) /* success case */but
if (bool == 0) /* failure case */Quoted 8 lines
now creative people do sometimes
if (!errno) /* success case */
which I think is horribly confusing. So imo for more easier telling apart of these too I think consistently using the short form for booleans, and consistently using the more explicit long form for errno checks is a Very Good Pattern :-)
Quoted 6 lines
I don't disagree with your logic, but we regularly get patches to convert errno checks to drop the direct comparison because that is the "preferred kernel style". Arguably, we should be explicit in all cases as that avoids all confusion. With that in mind, my original point stands. Why have a type when comparisons against valid settings for that type produce errors?
Well it isn't an error, but raising a nice warning is most likely a good idea.
Christian.
Quoted 53 lines
Alex
Quoted 50 lines
Cheers, Daniel
Quoted 36 lines
Christian.
Quoted 34 lines
Quoted 34 lines
Alex
Quoted 31 lines · Christian König
Am 09.09.20 um 15:07 schrieb Zheng Bin:
Quoted 21 lines
Zheng Bin (8):
drm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v9_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v10_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_2.cdrm/amd/amdgpu: fix comparison pointer to bool warning insi.cdrm/amd/amdgpu: fix comparison pointer to bool warning inuvd_v6_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning in
amdgpu_atpx_handler.c
drm/amd/amdgpu: fix comparison pointer to bool warning insdma_v4_0.c
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c| 4 ++--
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c| 2 +-
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c| 2 +-
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c| 4 ++--
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c| 2 +-
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c| 2 +-
drivers/gpu/drm/amd/amdgpu/si.c| 2 +-
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c| 4 ++--
8 files changed, 11 insertions(+), 11 deletions(-)Quoted 3 lines
--
2.26.0.106.g9fadedd_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051676053&sdata=MS0vcBcU7unXjEFlbd8kLbJkJ4sKcvIdLjc8yhX4UUI%3D&reserved=0Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&sdata=MgfR%2BwCVY9gWfhQ9i5kWcKiiYkV1C8O2dEKlZYSqscE%3D&reserved=0_______________________________________________
dri-devel mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&sdata=MgfR%2BwCVY9gWfhQ9i5kWcKiiYkV1C8O2dEKlZYSqscE%3D&reserved=0--
Daniel Vetter
Software Engineer, Intel Corporation
https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.ffwll.ch%2F&data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&sdata=GvLs5OXw2Ny%2BieJxm8hjawNb0rGA966539iAwlWwPMY%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 38 lines · Christian König
Am 16.09.20 um 15:36 schrieb Alex Deucher:
Quoted 37 lines · Daniel Vetter
Quoted 22 lines · Christian König
Quoted 6 lines
Am 15.09.20 um 21:35 schrieb Ville Syrjälä:
Quoted 5 lines · Alex Deucher
Quoted 4 lines
I question the value of these warnings. Why even have a boolean type if you are going to get warnings when you use them...
That said, applied to avoid getting these patches again and again every time someone sees this.Quoted 7 lines
Quoted 6 lines
if (
this_is_sparta)
if (this_is_sparta== true)
if (this_is_sparta!= false)I think the first one reads the best, and avoids having to decide between truth and falsehood :)
+1
+1, especially because we also have the inversion when using negative errno codes for failures and 0 as success, which results in
if (errno == 0) /* success case */but
if (bool == 0) /* failure case */Quoted 8 lines
now creative people do sometimes
if (!errno) /* success case */
which I think is horribly confusing. So imo for more easier telling apart of these too I think consistently using the short form for booleans, and consistently using the more explicit long form for errno checks is a Very Good Pattern :-)
I don't disagree with your logic, but we regularly get patches to convert errno checks to drop the direct comparison because that is the "preferred kernel style". Arguably, we should be explicit in all cases as that avoids all confusion. With that in mind, my original point stands. Why have a type when comparisons against valid settings for that type produce errors?
Oh, I didn't know that this happens for errno too.
I withdraw my +1 and concur this is a bikeshed. I guess still applying to shut up the patch stream is the most reasonable thing :-/ -Daniel
Quoted 64 lines
Well it isn't an error, but raising a nice warning is most likely a good idea.
Christian.
Quoted 53 lines
Alex
Quoted 50 lines
Cheers, Daniel
Quoted 36 lines
Christian.
Quoted 34 lines
Quoted 34 lines
Alex
Quoted 31 lines · Christian König
Am 09.09.20 um 15:07 schrieb Zheng Bin:
Quoted 21 lines
Zheng Bin (8):
drm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v9_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning ingfx_v10_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning insdma_v5_2.cdrm/amd/amdgpu: fix comparison pointer to bool warning insi.cdrm/amd/amdgpu: fix comparison pointer to bool warning inuvd_v6_0.cdrm/amd/amdgpu: fix comparison pointer to bool warning in
amdgpu_atpx_handler.c
drm/amd/amdgpu: fix comparison pointer to bool warning insdma_v4_0.c
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c| 4 ++--
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c| 2 +-
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c| 2 +-
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c| 4 ++--
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c| 2 +-
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c| 2 +-
drivers/gpu/drm/amd/amdgpu/si.c| 2 +-
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c| 4 ++--
8 files changed, 11 insertions(+), 11 deletions(-)Quoted 3 lines
--
2.26.0.106.g9fadedd_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051676053&sdata=MS0vcBcU7unXjEFlbd8kLbJkJ4sKcvIdLjc8yhX4UUI%3D&reserved=0Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&sdata=MgfR%2BwCVY9gWfhQ9i5kWcKiiYkV1C8O2dEKlZYSqscE%3D&reserved=0_______________________________________________
dri-devel mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&sdata=MgfR%2BwCVY9gWfhQ9i5kWcKiiYkV1C8O2dEKlZYSqscE%3D&reserved=0--
Daniel Vetter
Software Engineer, Intel Corporation
https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.ffwll.ch%2F&data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&sdata=GvLs5OXw2Ny%2BieJxm8hjawNb0rGA966539iAwlWwPMY%3D&reserved=0_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/8 drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v10_0.c
In reply to Zheng BinFixes coccicheck warning:
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3563:5-31: WARNING: Comparison to bool
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -1
@@ -3560,7 +3560,7 @@ static void gfx_v10_0_check_fw_write_wait(struct amdgpu_device *adev)break ; } -if (adev->gfx.cp_fw_write_wait == false) +if (!adev->gfx.cp_fw_write_wait)DRM_WARN_ONCE ("CP firmware version too old, please update!" ); }
--
2.26.0.106.g9fadedd
PATCH 3/8 drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_0.c
In reply to Zheng BinFixes coccicheck warning:
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:619:5-11: WARNING: Comparison to bool
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
@@ -616,7 +616,7 @@ static void sdma_v5_0_enable(struct amdgpu_device *adev, bool enable)u32 f32_cntl;int i; -if (enable == false) { +if (!enable) {sdma_v5_0_gfx_stop (adev);sdma_v5_0_rlc_stop (adev); }
--
2.26.0.106.g9fadedd
PATCH 4/8 drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_2.c
In reply to Zheng BinFixes coccicheck warning:
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:562:5-11: WARNING: Comparison to bool
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +1 -1
@@ -559,7 +559,7 @@ static void sdma_v5_2_enable(struct amdgpu_device *adev, bool enable)u32 f32_cntl;int i; -if (enable == false) { +if (!enable) {sdma_v5_2_gfx_stop (adev);sdma_v5_2_rlc_stop (adev); }
--
2.26.0.106.g9fadedd
PATCH 5/8 drm/amd/amdgpu: fix comparison pointer to bool warning in si.c
In reply to Zheng BinFixes coccicheck warning:
drivers/gpu/drm/amd/amdgpu/si.c:1342:5-10: WARNING: Comparison to bool
--- drivers/gpu/drm/amd/amdgpu/si.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/si.c +1 -1
@@ -1339,7 +1339,7 @@ static void si_vga_set_state(struct amdgpu_device *adev, bool state)uint32_t temp; temp =RREG32 (CONFIG_CNTL ); -if (state == false) { +if (!state) { temp &= ~(1 <<0 ); temp |= (1 <<1 ); }else {
--
2.26.0.106.g9fadedd
PATCH 6/8 drm/amd/amdgpu: fix comparison pointer to bool warning in uvd_v6_0.c
In reply to Zheng BinFixes coccicheck warning:
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:1243:14-25: WARNING: Comparison to bool
--- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2 -2
@@ -1240,8 +1240,8 @@ static int uvd_v6_0_process_interrupt(struct amdgpu_device *adev,break ; } -if (false == int_handled) -DRM_ERROR ("Unhandled interrupt: %d %d\n" , +if (!int_handled) +DRM_ERROR ("Unhandled interrupt: %d %d\n" , entry->src_id, entry->src_data[0 ]);return 0 ;
--
2.26.0.106.g9fadedd
PATCH 7/8 drm/amd/amdgpu: fix comparison pointer to bool warning in amdgpu_atpx_handler.c
In reply to Zheng BinFixes coccicheck warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c:619:15-49: WARNING: Comparison to bool drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c:629:15-49: WARNING: Comparison to bool
--- drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +2 -2
@@ -616,7 +616,7 @@ static bool amdgpu_atpx_detect(void)while ((pdev =pci_get_class (PCI_CLASS_DISPLAY_VGA <<8 , pdev)) !=NULL ) { vga_count++; - has_atpx |= (amdgpu_atpx_pci_probe_handle (pdev) == true); + has_atpx |=amdgpu_atpx_pci_probe_handle (pdev); parent_pdev =pci_upstream_bridge (pdev); d3_supported |= parent_pdev && parent_pdev->bridge_d3;
@@ -626,7 +626,7 @@ static bool amdgpu_atpx_detect(void)while ((pdev =pci_get_class (PCI_CLASS_DISPLAY_OTHER <<8 , pdev)) !=NULL ) { vga_count++; - has_atpx |= (amdgpu_atpx_pci_probe_handle (pdev) == true); + has_atpx |=amdgpu_atpx_pci_probe_handle (pdev); parent_pdev =pci_upstream_bridge (pdev); d3_supported |= parent_pdev && parent_pdev->bridge_d3;
--
2.26.0.106.g9fadedd
PATCH 8/8 drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v4_0.c
In reply to Zheng BinFixes coccicheck warning:
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1003:4-9: WARNING: Comparison to bool drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1083:5-11: WARNING: Comparison to bool
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -2
@@ -1000,7 +1000,7 @@ static void sdma_v4_0_page_stop(struct amdgpu_device *adev) sdma[i] = &adev->sdma.instance[i].page;if ((adev->mman.buffer_funcs_ring == sdma[i]) && - (unset == false)) { + (!unset)) {amdgpu_ttm_set_buffer_funcs_status (adev, false); unset = true; }
@@ -1080,7 +1080,7 @@ static void sdma_v4_0_enable(struct amdgpu_device *adev, bool enable)u32 f32_cntl;int i; -if (enable == false) { +if (!enable) {sdma_v4_0_gfx_stop (adev);sdma_v4_0_rlc_stop (adev);if (adev->sdma.has_page_queue)
--
2.26.0.106.g9fadedd