2020-01-03 13:21:44

by Wambui Karuga

[permalink] [raw]
Subject: [PATCH] drm/radeon: remove boolean checks in if statements.

Remove unnecessary variable comparisions to true/false in if statements
and check the value of the variable directly.

Signed-off-by: Wambui Karuga <[email protected]>
---
drivers/gpu/drm/radeon/cik_sdma.c | 2 +-
drivers/gpu/drm/radeon/r100.c | 2 +-
drivers/gpu/drm/radeon/r600.c | 2 +-
drivers/gpu/drm/radeon/radeon_bios.c | 12 ++++++------
drivers/gpu/drm/radeon/radeon_connectors.c | 4 ++--
drivers/gpu/drm/radeon/radeon_display.c | 4 ++--
drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 4 ++--
drivers/gpu/drm/radeon/radeon_pm.c | 2 +-
8 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c
index 35b9dc6ce46a..68403e77756d 100644
--- a/drivers/gpu/drm/radeon/cik_sdma.c
+++ b/drivers/gpu/drm/radeon/cik_sdma.c
@@ -333,7 +333,7 @@ void cik_sdma_enable(struct radeon_device *rdev, bool enable)
u32 me_cntl, reg_offset;
int i;

- if (enable == false) {
+ if (!enable) {
cik_sdma_gfx_stop(rdev);
cik_sdma_rlc_stop(rdev);
}
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 0017aa7a9f17..957994258860 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -2815,7 +2815,7 @@ void r100_vga_set_state(struct radeon_device *rdev, bool state)
uint32_t temp;

temp = RREG32(RADEON_CONFIG_CNTL);
- if (state == false) {
+ if (!state) {
temp &= ~RADEON_CFG_VGA_RAM_EN;
temp |= RADEON_CFG_VGA_IO_DIS;
} else {
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 0d453aa09352..eb56fb48a6b7 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -3191,7 +3191,7 @@ void r600_vga_set_state(struct radeon_device *rdev, bool state)
uint32_t temp;

temp = RREG32(CONFIG_CNTL);
- if (state == false) {
+ if (!state) {
temp &= ~(1<<0);
temp |= (1<<1);
} else {
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index c84d965c283e..c42f73fad3e3 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -664,17 +664,17 @@ bool radeon_get_bios(struct radeon_device *rdev)
uint16_t tmp;

r = radeon_atrm_get_bios(rdev);
- if (r == false)
+ if (!r)
r = radeon_acpi_vfct_bios(rdev);
- if (r == false)
+ if (!r)
r = igp_read_bios_from_vram(rdev);
- if (r == false)
+ if (!r)
r = radeon_read_bios(rdev);
- if (r == false)
+ if (!r)
r = radeon_read_disabled_bios(rdev);
- if (r == false)
+ if (!r)
r = radeon_read_platform_bios(rdev);
- if (r == false || rdev->bios == NULL) {
+ if (!r || rdev->bios == NULL) {
DRM_ERROR("Unable to locate a BIOS ROM\n");
rdev->bios = NULL;
return false;
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 0851e6817e57..90d2f732affb 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -440,7 +440,7 @@ radeon_connector_analog_encoder_conflict_solve(struct drm_connector *connector,
if (radeon_conflict->use_digital)
continue;

- if (priority == true) {
+ if (priority) {
DRM_DEBUG_KMS("1: conflicting encoders switching off %s\n",
conflict->name);
DRM_DEBUG_KMS("in favor of %s\n",
@@ -700,7 +700,7 @@ static int radeon_connector_set_property(struct drm_connector *connector, struct
else
ret = radeon_legacy_get_tmds_info_from_combios(radeon_encoder, tmds);
}
- if (val == 1 || ret == false) {
+ if (val == 1 || !ret) {
radeon_legacy_get_tmds_info_from_table(radeon_encoder, tmds);
}
radeon_property_change_mode(&radeon_encoder->base);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index dfb921899853..e42d9e0a4b8c 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -847,11 +847,11 @@ static bool radeon_setup_enc_conn(struct drm_device *dev)
if (rdev->bios) {
if (rdev->is_atom_bios) {
ret = radeon_get_atom_connector_info_from_supported_devices_table(dev);
- if (ret == false)
+ if (!ret)
ret = radeon_get_atom_connector_info_from_object_table(dev);
} else {
ret = radeon_get_legacy_connector_info_from_bios(dev);
- if (ret == false)
+ if (!ret)
ret = radeon_get_legacy_connector_info_from_table(dev);
}
} else {
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index a33b19566b2d..44d060f75318 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -1712,7 +1712,7 @@ static struct radeon_encoder_int_tmds *radeon_legacy_get_tmds_info(struct radeon
else
ret = radeon_legacy_get_tmds_info_from_combios(encoder, tmds);

- if (ret == false)
+ if (!ret)
radeon_legacy_get_tmds_info_from_table(encoder, tmds);

return tmds;
@@ -1735,7 +1735,7 @@ static struct radeon_encoder_ext_tmds *radeon_legacy_get_ext_tmds_info(struct ra

ret = radeon_legacy_get_ext_tmds_info_from_combios(encoder, tmds);

- if (ret == false)
+ if (!ret)
radeon_legacy_get_ext_tmds_info_from_table(encoder, tmds);

return tmds;
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index b37121f2631d..8c5d6fda0d75 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -1789,7 +1789,7 @@ static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish
u32 stat_crtc = 0;
bool in_vbl = radeon_pm_in_vbl(rdev);

- if (in_vbl == false)
+ if (!in_vbl)
DRM_DEBUG_DRIVER("not in vbl for pm change %08x at %s\n", stat_crtc,
finish ? "exit" : "entry");
return in_vbl;
--
2.17.1


2020-01-06 23:00:00

by Alex Deucher

[permalink] [raw]
Subject: Re: [PATCH] drm/radeon: remove boolean checks in if statements.

On Fri, Jan 3, 2020 at 2:34 PM Wambui Karuga <[email protected]> wrote:
>
> Remove unnecessary variable comparisions to true/false in if statements
> and check the value of the variable directly.
>
> Signed-off-by: Wambui Karuga <[email protected]>

Applied. Thanks!

Alex

> ---
> drivers/gpu/drm/radeon/cik_sdma.c | 2 +-
> drivers/gpu/drm/radeon/r100.c | 2 +-
> drivers/gpu/drm/radeon/r600.c | 2 +-
> drivers/gpu/drm/radeon/radeon_bios.c | 12 ++++++------
> drivers/gpu/drm/radeon/radeon_connectors.c | 4 ++--
> drivers/gpu/drm/radeon/radeon_display.c | 4 ++--
> drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 4 ++--
> drivers/gpu/drm/radeon/radeon_pm.c | 2 +-
> 8 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c
> index 35b9dc6ce46a..68403e77756d 100644
> --- a/drivers/gpu/drm/radeon/cik_sdma.c
> +++ b/drivers/gpu/drm/radeon/cik_sdma.c
> @@ -333,7 +333,7 @@ void cik_sdma_enable(struct radeon_device *rdev, bool enable)
> u32 me_cntl, reg_offset;
> int i;
>
> - if (enable == false) {
> + if (!enable) {
> cik_sdma_gfx_stop(rdev);
> cik_sdma_rlc_stop(rdev);
> }
> diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
> index 0017aa7a9f17..957994258860 100644
> --- a/drivers/gpu/drm/radeon/r100.c
> +++ b/drivers/gpu/drm/radeon/r100.c
> @@ -2815,7 +2815,7 @@ void r100_vga_set_state(struct radeon_device *rdev, bool state)
> uint32_t temp;
>
> temp = RREG32(RADEON_CONFIG_CNTL);
> - if (state == false) {
> + if (!state) {
> temp &= ~RADEON_CFG_VGA_RAM_EN;
> temp |= RADEON_CFG_VGA_IO_DIS;
> } else {
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index 0d453aa09352..eb56fb48a6b7 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -3191,7 +3191,7 @@ void r600_vga_set_state(struct radeon_device *rdev, bool state)
> uint32_t temp;
>
> temp = RREG32(CONFIG_CNTL);
> - if (state == false) {
> + if (!state) {
> temp &= ~(1<<0);
> temp |= (1<<1);
> } else {
> diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
> index c84d965c283e..c42f73fad3e3 100644
> --- a/drivers/gpu/drm/radeon/radeon_bios.c
> +++ b/drivers/gpu/drm/radeon/radeon_bios.c
> @@ -664,17 +664,17 @@ bool radeon_get_bios(struct radeon_device *rdev)
> uint16_t tmp;
>
> r = radeon_atrm_get_bios(rdev);
> - if (r == false)
> + if (!r)
> r = radeon_acpi_vfct_bios(rdev);
> - if (r == false)
> + if (!r)
> r = igp_read_bios_from_vram(rdev);
> - if (r == false)
> + if (!r)
> r = radeon_read_bios(rdev);
> - if (r == false)
> + if (!r)
> r = radeon_read_disabled_bios(rdev);
> - if (r == false)
> + if (!r)
> r = radeon_read_platform_bios(rdev);
> - if (r == false || rdev->bios == NULL) {
> + if (!r || rdev->bios == NULL) {
> DRM_ERROR("Unable to locate a BIOS ROM\n");
> rdev->bios = NULL;
> return false;
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
> index 0851e6817e57..90d2f732affb 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -440,7 +440,7 @@ radeon_connector_analog_encoder_conflict_solve(struct drm_connector *connector,
> if (radeon_conflict->use_digital)
> continue;
>
> - if (priority == true) {
> + if (priority) {
> DRM_DEBUG_KMS("1: conflicting encoders switching off %s\n",
> conflict->name);
> DRM_DEBUG_KMS("in favor of %s\n",
> @@ -700,7 +700,7 @@ static int radeon_connector_set_property(struct drm_connector *connector, struct
> else
> ret = radeon_legacy_get_tmds_info_from_combios(radeon_encoder, tmds);
> }
> - if (val == 1 || ret == false) {
> + if (val == 1 || !ret) {
> radeon_legacy_get_tmds_info_from_table(radeon_encoder, tmds);
> }
> radeon_property_change_mode(&radeon_encoder->base);
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
> index dfb921899853..e42d9e0a4b8c 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -847,11 +847,11 @@ static bool radeon_setup_enc_conn(struct drm_device *dev)
> if (rdev->bios) {
> if (rdev->is_atom_bios) {
> ret = radeon_get_atom_connector_info_from_supported_devices_table(dev);
> - if (ret == false)
> + if (!ret)
> ret = radeon_get_atom_connector_info_from_object_table(dev);
> } else {
> ret = radeon_get_legacy_connector_info_from_bios(dev);
> - if (ret == false)
> + if (!ret)
> ret = radeon_get_legacy_connector_info_from_table(dev);
> }
> } else {
> diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> index a33b19566b2d..44d060f75318 100644
> --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
> @@ -1712,7 +1712,7 @@ static struct radeon_encoder_int_tmds *radeon_legacy_get_tmds_info(struct radeon
> else
> ret = radeon_legacy_get_tmds_info_from_combios(encoder, tmds);
>
> - if (ret == false)
> + if (!ret)
> radeon_legacy_get_tmds_info_from_table(encoder, tmds);
>
> return tmds;
> @@ -1735,7 +1735,7 @@ static struct radeon_encoder_ext_tmds *radeon_legacy_get_ext_tmds_info(struct ra
>
> ret = radeon_legacy_get_ext_tmds_info_from_combios(encoder, tmds);
>
> - if (ret == false)
> + if (!ret)
> radeon_legacy_get_ext_tmds_info_from_table(encoder, tmds);
>
> return tmds;
> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
> index b37121f2631d..8c5d6fda0d75 100644
> --- a/drivers/gpu/drm/radeon/radeon_pm.c
> +++ b/drivers/gpu/drm/radeon/radeon_pm.c
> @@ -1789,7 +1789,7 @@ static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish
> u32 stat_crtc = 0;
> bool in_vbl = radeon_pm_in_vbl(rdev);
>
> - if (in_vbl == false)
> + if (!in_vbl)
> DRM_DEBUG_DRIVER("not in vbl for pm change %08x at %s\n", stat_crtc,
> finish ? "exit" : "entry");
> return in_vbl;
> --
> 2.17.1
>
> _______________________________________________
> amd-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx