]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86/amd/pmc: Use ARRAY_SIZE() to fill num_ips information
authorShyam Sundar S K <Shyam-sundar.S-k@amd.com>
Fri, 8 Nov 2024 07:08:18 +0000 (12:38 +0530)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 2 Dec 2024 17:31:46 +0000 (19:31 +0200)
Instead of manually specifying num_ips, use ARRAY_SIZE() to set this value
based on the actual number of elements in the array.

Reviewed-by: Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241108070822.3912689-7-Shyam-sundar.S-k@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/pmc/pmc.c

index 7b3a367814b00b78c7c761140bae229f3749feb4..147644e5026b97fc39b15a0d323e57cf688b2c96 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <asm/amd_nb.h>
 #include <linux/acpi.h>
+#include <linux/array_size.h>
 #include <linux/bitfield.h>
 #include <linux/bits.h>
 #include <linux/debugfs.h>
@@ -117,7 +118,6 @@ static const struct amd_pmc_bit_map soc15_ip_blk[] = {
        {"IPU",         BIT(19)},
        {"UMSCH",       BIT(20)},
        {"VPE",         BIT(21)},
-       {}
 };
 
 static bool disable_workarounds;
@@ -169,7 +169,7 @@ static void amd_pmc_get_ip_info(struct amd_pmc_dev *dev)
                break;
        case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT:
        case PCI_DEVICE_ID_AMD_1AH_M60H_ROOT:
-               dev->num_ips = 22;
+               dev->num_ips = ARRAY_SIZE(soc15_ip_blk);
                dev->smu_msg = 0x938;
                break;
        }