[PATCH 3/5] drivers/amdgpu: Use canonical form in branch predicates

Edward O'Callaghan funfunctor at folklore1984.net
Sun Jul 10 13:05:45 UTC 2016


Hmm, OK but that is out of scope to this particular patch. The change is
specifically about using the canonical form where possible.

I can send a follow up however I would rather find all other cases and
have a patch that deals with that separate issue specifically in it's
own right, no?

Best Regards,
Edward.

On 07/10/2016 10:12 PM, StDenis, Tom wrote:
> This patch is ok but if you're going to propose it maybe ditch the
> braces on the single if line statements while you're at it?
> 
> 
> Cheers,
> 
> Tom St Denis
> 
> 
> 
> ------------------------------------------------------------------------
> *From:* amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of
> Edward O'Callaghan <funfunctor at folklore1984.net>
> *Sent:* Sunday, July 10, 2016 05:03
> *To:* amd-gfx at lists.freedesktop.org
> *Subject:* [PATCH 3/5] drivers/amdgpu: Use canonical form in branch
> predicates
>  
> Found-by: Coccinelle
> Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c         | 14 +++++++-------
>  drivers/gpu/drm/amd/amdgpu/ci_dpm.c              |  2 +-
>  drivers/gpu/drm/amd/amdgpu/cik.c                 |  2 +-
>  drivers/gpu/drm/amd/amdgpu/cik_sdma.c            |  2 +-
>  drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c           |  2 +-
>  drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c           |  2 +-
>  7 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
> index 35a1248..69942d2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
> @@ -144,7 +144,7 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx
> *atpx)
>  {
>          /* make sure required functions are enabled */
>          /* dGPU power control is required */
> -       if (atpx->functions.power_cntl == false) {
> +       if (!atpx->functions.power_cntl) {
>                  printk("ATPX dGPU power cntl not present, forcing\n");
>                  atpx->functions.power_cntl = true;
>          }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> index 99ca75b..2b6afe1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> @@ -352,22 +352,22 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
>          uint16_t tmp, bios_header_start;
>  
>          r = amdgpu_atrm_get_bios(adev);
> -       if (r == false)
> +       if (!r)
>                  r = amdgpu_acpi_vfct_bios(adev);
> -       if (r == false)
> +       if (!r)
>                  r = igp_read_bios_from_vram(adev);
> -       if (r == false)
> +       if (!r)
>                  r = amdgpu_read_bios(adev);
> -       if (r == false) {
> +       if (!r) {
>                  r = amdgpu_read_bios_from_rom(adev);
>          }
> -       if (r == false) {
> +       if (!r) {
>                  r = amdgpu_read_disabled_bios(adev);
>          }
> -       if (r == false) {
> +       if (!r) {
>                  r = amdgpu_read_platform_bios(adev);
>          }
> -       if (r == false || adev->bios == NULL) {
> +       if (!r || adev->bios == NULL) {
>                  DRM_ERROR("Unable to locate a BIOS ROM\n");
>                  adev->bios = NULL;
>                  return false;
> diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
> b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
> index 5ec1f1e..b3b17bb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
> @@ -3030,7 +3030,7 @@ static int ci_populate_single_memory_level(struct
> amdgpu_device *adev,
>  
>          if (pi->mclk_stutter_mode_threshold &&
>              (memory_clock <= pi->mclk_stutter_mode_threshold) &&
> -           (pi->uvd_enabled == false) &&
> +           (!pi->uvd_enabled) &&
>              (RREG32(mmDPG_PIPE_STUTTER_CONTROL) &
> DPG_PIPE_STUTTER_CONTROL__STUTTER_ENABLE_MASK) &&
>              (adev->pm.dpm.new_active_crtc_count <= 2))
>                  memory_level->StutterEnable = true;
> diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c
> b/drivers/gpu/drm/amd/amdgpu/cik.c
> index 9104318..0e4a8e4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/cik.c
> +++ b/drivers/gpu/drm/amd/amdgpu/cik.c
> @@ -879,7 +879,7 @@ static void cik_vga_set_state(struct amdgpu_device
> *adev, bool state)
>          uint32_t tmp;
>  
>          tmp = RREG32(mmCONFIG_CNTL);
> -       if (state == false)
> +       if (!state)
>                  tmp |= CONFIG_CNTL__VGA_DIS_MASK;
>          else
>                  tmp &= ~CONFIG_CNTL__VGA_DIS_MASK;
> diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> index 9dc4e24..554f2fd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
> @@ -365,7 +365,7 @@ static void cik_sdma_enable(struct amdgpu_device
> *adev, bool enable)
>          u32 me_cntl;
>          int i;
>  
> -       if (enable == false) {
> +       if (!enable) {
>                  cik_sdma_gfx_stop(adev);
>                  cik_sdma_rlc_stop(adev);
>          }
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> index b556bd0..959cada9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
> @@ -406,7 +406,7 @@ static void sdma_v2_4_enable(struct amdgpu_device
> *adev, bool enable)
>          u32 f32_cntl;
>          int i;
>  
> -       if (enable == false) {
> +       if (!enable) {
>                  sdma_v2_4_gfx_stop(adev);
>                  sdma_v2_4_rlc_stop(adev);
>          }
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> index 532ea88..f96fdc8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> @@ -616,7 +616,7 @@ static void sdma_v3_0_enable(struct amdgpu_device
> *adev, bool enable)
>          u32 f32_cntl;
>          int i;
>  
> -       if (enable == false) {
> +       if (!enable) {
>                  sdma_v3_0_gfx_stop(adev);
>                  sdma_v3_0_rlc_stop(adev);
>          }
> -- 
> 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> 
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160710/18c7e77c/attachment-0001.sig>


More information about the amd-gfx mailing list