Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp401212pxf; Wed, 31 Mar 2021 06:22:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxscT2HXDTEyhA7rwh6PZUzi1xX+Rvtg9l2bAWSZEqUcrCGSg+E+DsrKilbHZvpc2vXuoJe X-Received: by 2002:a17:906:6703:: with SMTP id a3mr3486796ejp.240.1617196961341; Wed, 31 Mar 2021 06:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617196961; cv=none; d=google.com; s=arc-20160816; b=QqQCBukr0QoT7SOO+/pb3IZ0I/Zq/fUQLxJfvwqIVE30IDUK8eAoks10IUQPQ3ypAi RribtgO/UgfuuhKIUCGWK4gscg3g7JobE9q6AzuVUuEBfd0R12yZqKkLLkz2jWTJOamW 8uJP4Aax6+KU4eFJhV1lpdf0FY5XU/8yknxuvKnDSlctEEP1dfifHZ2ubxUvQuxfKUTq FSfxiwpRDZJJs7SkytH7Mohh8m+2IV+cxN+eyuU3H9mB9IHJZ1fJtweTFH4BGQBYgTCx 1RcpU4hBE0DRw5sq2W05LacjeWOOHDRvB0YvxZ3qBzCVjO0vVFhnQLjQn814/OWYZGD5 /caA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=+w8bYcPlVn3+xeHZlbF9sd7uBDTjGg53zP8/LwbnJPE=; b=mpyzX1Cty683DVppAs+pYiCqI5lWZ5//QGYwZpojaQ7wt2cgjVT5PfUFKX1BIm5il6 L809UGcGhMwgDnHrRyNnbHBEOvIYFJ5UDxo2YlUliXKSg36WycwRliS/eTE555RdEmDf aV8taFuKJhbBouNUuZrgJ9RiCJnONYp9REScgBNUrXGEet1FvB2lKGIrjGzXOw7XXbsL KuANp9e9iLyAujoOcXxyZW4ry8O+qS9+NRCiLGLYUXw004c1eQJ0rr+mcK6IDUqQAHwg XhB865imZvJg+FoqkDY3kLWsnEEgBaBwM9xURcD78lvXh393XkL2LU7Uo4IQciro/1tO e15w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r16si1714008edw.458.2021.03.31.06.22.19; Wed, 31 Mar 2021 06:22:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235634AbhCaNVl (ORCPT + 99 others); Wed, 31 Mar 2021 09:21:41 -0400 Received: from mail-m121143.qiye.163.com ([115.236.121.143]:34796 "EHLO mail-m121143.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235776AbhCaNVL (ORCPT ); Wed, 31 Mar 2021 09:21:11 -0400 Received: from ubuntu.localdomain (unknown [36.152.145.181]) by mail-m121143.qiye.163.com (Hmail) with ESMTPA id 251AD5402E5; Wed, 31 Mar 2021 21:11:52 +0800 (CST) From: Bernard Zhao To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Daniel Vetter , Luben Tuikov , Hawking Zhang , Deepak R Varma , Evan Quan , Likun Gao , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Bernard Zhao Subject: [PATCH] amd/amdgpu: code refactoring to clean code style a bit Date: Wed, 31 Mar 2021 06:11:36 -0700 Message-Id: <20210331131143.60652-1-bernard@vivo.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZT05MHxgaGEgYTE8ZVkpNSkxKQk1ISklOTU1VEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS0hKTFVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OjY6Nxw6SD8IPDUyTigMNBcK M1ZPCR1VSlVKTUpMSkJNSEpJQ05NVTMWGhIXVRkeCRUaCR87DRINFFUYFBZFWVdZEgtZQVlITVVK TklVSk9OVUpDSllXWQgBWUFNSUxONwY+ X-HM-Tid: 0a78886967bfb038kuuu251ad5402e5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix checkpatch.pl warning: Too many leading tabs - consider code refactoring WARNING: Too many leading tabs - consider code refactoring + for (j = 0; j < profile->ucLeakageBinNum; j++) { WARNING: Too many leading tabs - consider code refactoring + if (vbios_voltage_id <= leakage_bin[j]) { WARNING: Too many leading tabs - consider code refactoring + for (j = 0; j < profile->ucLeakageBinNum; j++) { WARNING: Too many leading tabs - consider code refactoring + if (vbios_voltage_id <= leakage_bin[j]) { Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 84 ++++++++------------ 1 file changed, 35 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c index 86add0f4ea4d..9968ff8ddc9c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c @@ -1283,65 +1283,51 @@ int amdgpu_atombios_get_leakage_vddc_based_on_leakage_params(struct amdgpu_devic profile = (ATOM_ASIC_PROFILING_INFO_V2_1 *) (adev->mode_info.atom_context->bios + data_offset); - switch (frev) { - case 1: + if ((frev != 2) || (crev != 1)) { + DRM_ERROR("Unknown table version %d, %d\n", frev, crev); return -EINVAL; - case 2: - switch (crev) { - case 1: - if (size < sizeof(ATOM_ASIC_PROFILING_INFO_V2_1)) - return -EINVAL; - leakage_bin = (u16 *) - (adev->mode_info.atom_context->bios + data_offset + - le16_to_cpu(profile->usLeakageBinArrayOffset)); - vddc_id_buf = (u16 *) - (adev->mode_info.atom_context->bios + data_offset + - le16_to_cpu(profile->usElbVDDC_IdArrayOffset)); - vddc_buf = (u16 *) - (adev->mode_info.atom_context->bios + data_offset + - le16_to_cpu(profile->usElbVDDC_LevelArrayOffset)); - vddci_id_buf = (u16 *) - (adev->mode_info.atom_context->bios + data_offset + - le16_to_cpu(profile->usElbVDDCI_IdArrayOffset)); - vddci_buf = (u16 *) - (adev->mode_info.atom_context->bios + data_offset + - le16_to_cpu(profile->usElbVDDCI_LevelArrayOffset)); - - if (profile->ucElbVDDC_Num > 0) { - for (i = 0; i < profile->ucElbVDDC_Num; i++) { - if (vddc_id_buf[i] == virtual_voltage_id) { - for (j = 0; j < profile->ucLeakageBinNum; j++) { - if (vbios_voltage_id <= leakage_bin[j]) { - *vddc = vddc_buf[j * profile->ucElbVDDC_Num + i]; - break; - } - } + } + + if (size < sizeof(ATOM_ASIC_PROFILING_INFO_V2_1)) + return -EINVAL; + + leakage_bin = (u16 *)(adev->mode_info.atom_context->bios + data_offset + + le16_to_cpu(profile->usLeakageBinArrayOffset)); + vddc_id_buf = (u16 *)(adev->mode_info.atom_context->bios + data_offset + + le16_to_cpu(profile->usElbVDDC_IdArrayOffset)); + vddc_buf = (u16 *)(adev->mode_info.atom_context->bios + data_offset + + le16_to_cpu(profile->usElbVDDC_LevelArrayOffset)); + vddci_id_buf = (u16 *)(adev->mode_info.atom_context->bios + data_offset + + le16_to_cpu(profile->usElbVDDCI_IdArrayOffset)); + vddci_buf = (u16 *)(adev->mode_info.atom_context->bios + data_offset + + le16_to_cpu(profile->usElbVDDCI_LevelArrayOffset)); + + if (profile->ucElbVDDC_Num > 0) { + for (i = 0; i < profile->ucElbVDDC_Num; i++) { + if (vddc_id_buf[i] == virtual_voltage_id) { + for (j = 0; j < profile->ucLeakageBinNum; j++) { + if (vbios_voltage_id <= leakage_bin[j]) { + *vddc = vddc_buf[j * profile->ucElbVDDC_Num + i]; break; } } + break; } - if (profile->ucElbVDDCI_Num > 0) { - for (i = 0; i < profile->ucElbVDDCI_Num; i++) { - if (vddci_id_buf[i] == virtual_voltage_id) { - for (j = 0; j < profile->ucLeakageBinNum; j++) { - if (vbios_voltage_id <= leakage_bin[j]) { - *vddci = vddci_buf[j * profile->ucElbVDDCI_Num + i]; - break; - } - } + } + } + + if (profile->ucElbVDDCI_Num > 0) { + for (i = 0; i < profile->ucElbVDDCI_Num; i++) { + if (vddci_id_buf[i] == virtual_voltage_id) { + for (j = 0; j < profile->ucLeakageBinNum; j++) { + if (vbios_voltage_id <= leakage_bin[j]) { + *vddci = vddci_buf[j * profile->ucElbVDDCI_Num + i]; break; } } + break; } - break; - default: - DRM_ERROR("Unknown table version %d, %d\n", frev, crev); - return -EINVAL; } - break; - default: - DRM_ERROR("Unknown table version %d, %d\n", frev, crev); - return -EINVAL; } return 0; -- 2.31.0