linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning
@ 2020-09-09 13:07 Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 1/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c Zheng Bin
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: Zheng Bin @ 2020-09-09 13:07 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel
  Cc: yi.zhang, zhengbin13

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH -next 1/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c
  2020-09-09 13:07 [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Zheng Bin
@ 2020-09-09 13:07 ` Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 2/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v10_0.c Zheng Bin
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Zheng Bin @ 2020-09-09 13:07 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel
  Cc: yi.zhang, zhengbin13

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:2805:5-11: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index fed2690d1380..20d8a03ca866 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH -next 2/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v10_0.c
  2020-09-09 13:07 [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 1/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c Zheng Bin
@ 2020-09-09 13:07 ` Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 3/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_0.c Zheng Bin
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Zheng Bin @ 2020-09-09 13:07 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel
  Cc: yi.zhang, zhengbin13

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3563:5-31: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 2db195ec8d0c..a78c0dbda968 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH -next 3/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_0.c
  2020-09-09 13:07 [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 1/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 2/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v10_0.c Zheng Bin
@ 2020-09-09 13:07 ` Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 4/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_2.c Zheng Bin
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Zheng Bin @ 2020-09-09 13:07 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel
  Cc: yi.zhang, zhengbin13

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c:619:5-11: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
index e2232dd12d8e..48c95a78a173 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
@@ -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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH -next 4/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_2.c
  2020-09-09 13:07 [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Zheng Bin
                   ` (2 preceding siblings ...)
  2020-09-09 13:07 ` [PATCH -next 3/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_0.c Zheng Bin
@ 2020-09-09 13:07 ` Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 5/8] drm/amd/amdgpu: fix comparison pointer to bool warning in si.c Zheng Bin
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Zheng Bin @ 2020-09-09 13:07 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel
  Cc: yi.zhang, zhengbin13

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c:562:5-11: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index 46a9617fee5f..34ccf376ee45 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH -next 5/8] drm/amd/amdgpu: fix comparison pointer to bool warning in si.c
  2020-09-09 13:07 [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Zheng Bin
                   ` (3 preceding siblings ...)
  2020-09-09 13:07 ` [PATCH -next 4/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_2.c Zheng Bin
@ 2020-09-09 13:07 ` Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 6/8] drm/amd/amdgpu: fix comparison pointer to bool warning in uvd_v6_0.c Zheng Bin
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Zheng Bin @ 2020-09-09 13:07 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel
  Cc: yi.zhang, zhengbin13

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/si.c:1342:5-10: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/si.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c
index 455d5e366c69..e5e336fd9e94 100644
--- a/drivers/gpu/drm/amd/amdgpu/si.c
+++ b/drivers/gpu/drm/amd/amdgpu/si.c
@@ -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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH -next 6/8] drm/amd/amdgpu: fix comparison pointer to bool warning in uvd_v6_0.c
  2020-09-09 13:07 [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Zheng Bin
                   ` (4 preceding siblings ...)
  2020-09-09 13:07 ` [PATCH -next 5/8] drm/amd/amdgpu: fix comparison pointer to bool warning in si.c Zheng Bin
@ 2020-09-09 13:07 ` Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 7/8] drm/amd/amdgpu: fix comparison pointer to bool warning in amdgpu_atpx_handler.c Zheng Bin
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Zheng Bin @ 2020-09-09 13:07 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel
  Cc: yi.zhang, zhengbin13

Fixes coccicheck warning:

drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:1243:14-25: WARNING: Comparison to bool

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index 0a880bc101b8..ed30fb48b9db 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
@@ -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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH -next 7/8] drm/amd/amdgpu: fix comparison pointer to bool warning in amdgpu_atpx_handler.c
  2020-09-09 13:07 [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Zheng Bin
                   ` (5 preceding siblings ...)
  2020-09-09 13:07 ` [PATCH -next 6/8] drm/amd/amdgpu: fix comparison pointer to bool warning in uvd_v6_0.c Zheng Bin
@ 2020-09-09 13:07 ` Zheng Bin
  2020-09-09 13:07 ` [PATCH -next 8/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v4_0.c Zheng Bin
  2020-09-09 13:21 ` [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Christian König
  8 siblings, 0 replies; 17+ messages in thread
From: Zheng Bin @ 2020-09-09 13:07 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel
  Cc: yi.zhang, zhengbin13

Fixes 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

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
index 3e35a8f2c5e5..7abe9500c0c6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
@@ -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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH -next 8/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v4_0.c
  2020-09-09 13:07 [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Zheng Bin
                   ` (6 preceding siblings ...)
  2020-09-09 13:07 ` [PATCH -next 7/8] drm/amd/amdgpu: fix comparison pointer to bool warning in amdgpu_atpx_handler.c Zheng Bin
@ 2020-09-09 13:07 ` Zheng Bin
  2020-09-09 13:21 ` [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Christian König
  8 siblings, 0 replies; 17+ messages in thread
From: Zheng Bin @ 2020-09-09 13:07 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel
  Cc: yi.zhang, zhengbin13

Fixes 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

Signed-off-by: Zheng Bin <zhengbin13@huawei.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index f975dc4b143a..e8e7d4228b92 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -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


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning
  2020-09-09 13:07 [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Zheng Bin
                   ` (7 preceding siblings ...)
  2020-09-09 13:07 ` [PATCH -next 8/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v4_0.c Zheng Bin
@ 2020-09-09 13:21 ` Christian König
  2020-09-15 19:16   ` Alex Deucher
  8 siblings, 1 reply; 17+ messages in thread
From: Christian König @ 2020-09-09 13:21 UTC (permalink / raw)
  To: Zheng Bin, alexander.deucher, airlied, daniel, amd-gfx,
	dri-devel, linux-kernel
  Cc: yi.zhang

Acked-by: Christian König <christian.koenig@amd.com> for the series.

Am 09.09.20 um 15:07 schrieb Zheng Bin:
> 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
>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning
  2020-09-09 13:21 ` [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Christian König
@ 2020-09-15 19:16   ` Alex Deucher
  2020-09-15 19:35     ` Ville Syrjälä
  0 siblings, 1 reply; 17+ messages in thread
From: Alex Deucher @ 2020-09-15 19:16 UTC (permalink / raw)
  To: Christian König
  Cc: Zheng Bin, Deucher, Alexander, Dave Airlie, Daniel Vetter,
	amd-gfx list, Maling list - DRI developers, LKML, yi.zhang

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

On Wed, Sep 9, 2020 at 9:21 AM Christian König <christian.koenig@amd.com> wrote:
>
> Acked-by: Christian König <christian.koenig@amd.com> for the series.
>
> Am 09.09.20 um 15:07 schrieb Zheng Bin:
> > 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
> >
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning
  2020-09-15 19:16   ` Alex Deucher
@ 2020-09-15 19:35     ` Ville Syrjälä
  2020-09-16  7:38       ` Christian König
  0 siblings, 1 reply; 17+ messages in thread
From: Ville Syrjälä @ 2020-09-15 19:35 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Christian König, yi.zhang, Dave Airlie, LKML,
	Maling list - DRI developers, Zheng Bin, amd-gfx list, Deucher,
	Alexander

On Tue, Sep 15, 2020 at 03:16:32PM -0400, Alex Deucher wrote:
> 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 :)

> 
> Alex
> 
> On Wed, Sep 9, 2020 at 9:21 AM Christian König <christian.koenig@amd.com> wrote:
> >
> > Acked-by: Christian König <christian.koenig@amd.com> for the series.
> >
> > Am 09.09.20 um 15:07 schrieb Zheng Bin:
> > > 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
> > >
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning
  2020-09-15 19:35     ` Ville Syrjälä
@ 2020-09-16  7:38       ` Christian König
  2020-09-16  7:51         ` Daniel Vetter
  0 siblings, 1 reply; 17+ messages in thread
From: Christian König @ 2020-09-16  7:38 UTC (permalink / raw)
  To: Ville Syrjälä, Alex Deucher
  Cc: yi.zhang, Dave Airlie, LKML, Maling list - DRI developers,
	Zheng Bin, amd-gfx list, Deucher, Alexander,
	Christian König

Am 15.09.20 um 21:35 schrieb Ville Syrjälä:
> On Tue, Sep 15, 2020 at 03:16:32PM -0400, Alex Deucher wrote:
>> 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.

>
>> Alex
>>
>> On Wed, Sep 9, 2020 at 9:21 AM Christian König <christian.koenig@amd.com> wrote:
>>> Acked-by: Christian König <christian.koenig@amd.com> for the series.
>>>
>>> Am 09.09.20 um 15:07 schrieb Zheng Bin:
>>>> 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
>>>>
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning
  2020-09-16  7:38       ` Christian König
@ 2020-09-16  7:51         ` Daniel Vetter
  2020-09-16 13:36           ` Alex Deucher
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel Vetter @ 2020-09-16  7:51 UTC (permalink / raw)
  To: christian.koenig
  Cc: Ville Syrjälä,
	Alex Deucher, yi.zhang, Dave Airlie, LKML, amd-gfx list,
	Zheng Bin, Maling list - DRI developers, Deucher, Alexander

On Wed, Sep 16, 2020 at 09:38:34AM +0200, Christian König wrote:
> Am 15.09.20 um 21:35 schrieb Ville Syrjälä:
> > On Tue, Sep 15, 2020 at 03:16:32PM -0400, Alex Deucher wrote:
> > > 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

+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

> 
> Christian.
> 
> > 
> > > Alex
> > > 
> > > On Wed, Sep 9, 2020 at 9:21 AM Christian König <christian.koenig@amd.com> wrote:
> > > > Acked-by: Christian König <christian.koenig@amd.com> for the series.
> > > > 
> > > > Am 09.09.20 um 15:07 schrieb Zheng Bin:
> > > > > 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
> > > > > 
> > > > _______________________________________________
> > > > amd-gfx mailing list
> > > > amd-gfx@lists.freedesktop.org
> > > > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> > > _______________________________________________
> > > dri-devel mailing list
> > > dri-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning
  2020-09-16  7:51         ` Daniel Vetter
@ 2020-09-16 13:36           ` Alex Deucher
  2020-09-16 14:02             ` Christian König
  0 siblings, 1 reply; 17+ messages in thread
From: Alex Deucher @ 2020-09-16 13:36 UTC (permalink / raw)
  To: Christian Koenig, Ville Syrjälä,
	Alex Deucher, yi.zhang, Dave Airlie, LKML, amd-gfx list,
	Zheng Bin, Maling list - DRI developers, Deucher, Alexander

On Wed, Sep 16, 2020 at 3:51 AM Daniel Vetter <daniel@ffwll.ch> wrote:
>
> On Wed, Sep 16, 2020 at 09:38:34AM +0200, Christian König wrote:
> > Am 15.09.20 um 21:35 schrieb Ville Syrjälä:
> > > On Tue, Sep 15, 2020 at 03:16:32PM -0400, Alex Deucher wrote:
> > > > 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
>
> +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 :-)

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

>
> Cheers, Daniel
>
> >
> > Christian.
> >
> > >
> > > > Alex
> > > >
> > > > On Wed, Sep 9, 2020 at 9:21 AM Christian König <christian.koenig@amd.com> wrote:
> > > > > Acked-by: Christian König <christian.koenig@amd.com> for the series.
> > > > >
> > > > > Am 09.09.20 um 15:07 schrieb Zheng Bin:
> > > > > > 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
> > > > > >
> > > > > _______________________________________________
> > > > > amd-gfx mailing list
> > > > > amd-gfx@lists.freedesktop.org
> > > > > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> > > > _______________________________________________
> > > > dri-devel mailing list
> > > > dri-devel@lists.freedesktop.org
> > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning
  2020-09-16 13:36           ` Alex Deucher
@ 2020-09-16 14:02             ` Christian König
  2020-09-16 15:31               ` Daniel Vetter
  0 siblings, 1 reply; 17+ messages in thread
From: Christian König @ 2020-09-16 14:02 UTC (permalink / raw)
  To: Alex Deucher, Ville Syrjälä,
	yi.zhang, Dave Airlie, LKML, amd-gfx list, Zheng Bin,
	Maling list - DRI developers, Deucher, Alexander

Am 16.09.20 um 15:36 schrieb Alex Deucher:
> On Wed, Sep 16, 2020 at 3:51 AM Daniel Vetter <daniel@ffwll.ch> wrote:
>> On Wed, Sep 16, 2020 at 09:38:34AM +0200, Christian König wrote:
>>> Am 15.09.20 um 21:35 schrieb Ville Syrjälä:
>>>> On Tue, Sep 15, 2020 at 03:16:32PM -0400, Alex Deucher wrote:
>>>>> 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
>> +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 :-)
> 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.

>
> Alex
>
>> Cheers, Daniel
>>
>>> Christian.
>>>
>>>>> Alex
>>>>>
>>>>> On Wed, Sep 9, 2020 at 9:21 AM Christian König <christian.koenig@amd.com> wrote:
>>>>>> Acked-by: Christian König <christian.koenig@amd.com> for the series.
>>>>>>
>>>>>> Am 09.09.20 um 15:07 schrieb Zheng Bin:
>>>>>>> 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
>>>>>>>
>>>>>> _______________________________________________
>>>>>> amd-gfx mailing list
>>>>>> amd-gfx@lists.freedesktop.org
>>>>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051676053&amp;sdata=MS0vcBcU7unXjEFlbd8kLbJkJ4sKcvIdLjc8yhX4UUI%3D&amp;reserved=0
>>>>> _______________________________________________
>>>>> dri-devel mailing list
>>>>> dri-devel@lists.freedesktop.org
>>>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&amp;sdata=MgfR%2BwCVY9gWfhQ9i5kWcKiiYkV1C8O2dEKlZYSqscE%3D&amp;reserved=0
>>> _______________________________________________
>>> dri-devel mailing list
>>> dri-devel@lists.freedesktop.org
>>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&amp;sdata=MgfR%2BwCVY9gWfhQ9i5kWcKiiYkV1C8O2dEKlZYSqscE%3D&amp;reserved=0
>> --
>> Daniel Vetter
>> Software Engineer, Intel Corporation
>> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.ffwll.ch%2F&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&amp;sdata=GvLs5OXw2Ny%2BieJxm8hjawNb0rGA966539iAwlWwPMY%3D&amp;reserved=0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning
  2020-09-16 14:02             ` Christian König
@ 2020-09-16 15:31               ` Daniel Vetter
  0 siblings, 0 replies; 17+ messages in thread
From: Daniel Vetter @ 2020-09-16 15:31 UTC (permalink / raw)
  To: Christian König
  Cc: Alex Deucher, Ville Syrjälä,
	yi.zhang, Dave Airlie, LKML, amd-gfx list, Zheng Bin,
	Maling list - DRI developers, Deucher, Alexander

On Wed, Sep 16, 2020 at 04:02:18PM +0200, Christian König wrote:
> Am 16.09.20 um 15:36 schrieb Alex Deucher:
> > On Wed, Sep 16, 2020 at 3:51 AM Daniel Vetter <daniel@ffwll.ch> wrote:
> > > On Wed, Sep 16, 2020 at 09:38:34AM +0200, Christian König wrote:
> > > > Am 15.09.20 um 21:35 schrieb Ville Syrjälä:
> > > > > On Tue, Sep 15, 2020 at 03:16:32PM -0400, Alex Deucher wrote:
> > > > > > 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
> > > +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 :-)
> > 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

> Well it isn't an error, but raising a nice warning is most likely a good
> idea.

> 
> Christian.
> 
> > 
> > Alex
> > 
> > > Cheers, Daniel
> > > 
> > > > Christian.
> > > > 
> > > > > > Alex
> > > > > > 
> > > > > > On Wed, Sep 9, 2020 at 9:21 AM Christian König <christian.koenig@amd.com> wrote:
> > > > > > > Acked-by: Christian König <christian.koenig@amd.com> for the series.
> > > > > > > 
> > > > > > > Am 09.09.20 um 15:07 schrieb Zheng Bin:
> > > > > > > > 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
> > > > > > > > 
> > > > > > > _______________________________________________
> > > > > > > amd-gfx mailing list
> > > > > > > amd-gfx@lists.freedesktop.org
> > > > > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051676053&amp;sdata=MS0vcBcU7unXjEFlbd8kLbJkJ4sKcvIdLjc8yhX4UUI%3D&amp;reserved=0
> > > > > > _______________________________________________
> > > > > > dri-devel mailing list
> > > > > > dri-devel@lists.freedesktop.org
> > > > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&amp;sdata=MgfR%2BwCVY9gWfhQ9i5kWcKiiYkV1C8O2dEKlZYSqscE%3D&amp;reserved=0
> > > > _______________________________________________
> > > > dri-devel mailing list
> > > > dri-devel@lists.freedesktop.org
> > > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&amp;sdata=MgfR%2BwCVY9gWfhQ9i5kWcKiiYkV1C8O2dEKlZYSqscE%3D&amp;reserved=0
> > > --
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.ffwll.ch%2F&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7Cdc7a8d7517d341e3a80c08d85a458ba8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637358602051686051&amp;sdata=GvLs5OXw2Ny%2BieJxm8hjawNb0rGA966539iAwlWwPMY%3D&amp;reserved=0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-09-16 20:53 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 13:07 [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Zheng Bin
2020-09-09 13:07 ` [PATCH -next 1/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v9_0.c Zheng Bin
2020-09-09 13:07 ` [PATCH -next 2/8] drm/amd/amdgpu: fix comparison pointer to bool warning in gfx_v10_0.c Zheng Bin
2020-09-09 13:07 ` [PATCH -next 3/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_0.c Zheng Bin
2020-09-09 13:07 ` [PATCH -next 4/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v5_2.c Zheng Bin
2020-09-09 13:07 ` [PATCH -next 5/8] drm/amd/amdgpu: fix comparison pointer to bool warning in si.c Zheng Bin
2020-09-09 13:07 ` [PATCH -next 6/8] drm/amd/amdgpu: fix comparison pointer to bool warning in uvd_v6_0.c Zheng Bin
2020-09-09 13:07 ` [PATCH -next 7/8] drm/amd/amdgpu: fix comparison pointer to bool warning in amdgpu_atpx_handler.c Zheng Bin
2020-09-09 13:07 ` [PATCH -next 8/8] drm/amd/amdgpu: fix comparison pointer to bool warning in sdma_v4_0.c Zheng Bin
2020-09-09 13:21 ` [PATCH -next 0/8] drm/amd/amdgpu: fix comparison pointer to bool warning Christian König
2020-09-15 19:16   ` Alex Deucher
2020-09-15 19:35     ` Ville Syrjälä
2020-09-16  7:38       ` Christian König
2020-09-16  7:51         ` Daniel Vetter
2020-09-16 13:36           ` Alex Deucher
2020-09-16 14:02             ` Christian König
2020-09-16 15:31               ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).