Message ID | 20241105173637.733589-11-Shyam-sundar.S-k@amd.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers | show |
Series | platform/x86/amd/pmc: Updates to AMD PMC driver | expand |
On 11/5/2024 11:36, Shyam Sundar S K wrote: > Instead of manually specifying num_ips, use ARRAY_SIZE() to set this value > based on the actual number of elements in the array. > > 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: Mario Limonciello <mario.limonciello@amd.com> > --- > drivers/platform/x86/amd/pmc/pmc.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c > index 5ca97712ef44..77f2c6e78139 100644 > --- a/drivers/platform/x86/amd/pmc/pmc.c > +++ b/drivers/platform/x86/amd/pmc/pmc.c > @@ -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> > @@ -120,7 +121,6 @@ static const struct amd_pmc_bit_map soc15_ip_blk_v2[] = { > {"IPU", BIT(22)}, > {"UMSCH", BIT(23)}, > {"VPE", BIT(24)}, > - {} > }; > > static const struct amd_pmc_bit_map soc15_ip_blk[] = { > @@ -146,7 +146,6 @@ static const struct amd_pmc_bit_map soc15_ip_blk[] = { > {"IPU", BIT(19)}, > {"UMSCH", BIT(20)}, > {"VPE", BIT(21)}, > - {} > }; > > static bool disable_workarounds; > @@ -201,10 +200,10 @@ static void amd_pmc_get_ip_info(struct amd_pmc_dev *dev) > case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT: > case PCI_DEVICE_ID_AMD_1AH_M60H_ROOT: > if (boot_cpu_data.x86_model == 0x70) { > - dev->num_ips = 25; > + dev->num_ips = ARRAY_SIZE(soc15_ip_blk_v2); > dev->ptr = (struct amd_pmc_bit_map *)soc15_ip_blk_v2; > } else { > - dev->num_ips = 22; > + dev->num_ips = ARRAY_SIZE(soc15_ip_blk); > dev->ptr = (struct amd_pmc_bit_map *)soc15_ip_blk; > } > dev->smu_msg = 0x938;
diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c index 5ca97712ef44..77f2c6e78139 100644 --- a/drivers/platform/x86/amd/pmc/pmc.c +++ b/drivers/platform/x86/amd/pmc/pmc.c @@ -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> @@ -120,7 +121,6 @@ static const struct amd_pmc_bit_map soc15_ip_blk_v2[] = { {"IPU", BIT(22)}, {"UMSCH", BIT(23)}, {"VPE", BIT(24)}, - {} }; static const struct amd_pmc_bit_map soc15_ip_blk[] = { @@ -146,7 +146,6 @@ static const struct amd_pmc_bit_map soc15_ip_blk[] = { {"IPU", BIT(19)}, {"UMSCH", BIT(20)}, {"VPE", BIT(21)}, - {} }; static bool disable_workarounds; @@ -201,10 +200,10 @@ static void amd_pmc_get_ip_info(struct amd_pmc_dev *dev) case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT: case PCI_DEVICE_ID_AMD_1AH_M60H_ROOT: if (boot_cpu_data.x86_model == 0x70) { - dev->num_ips = 25; + dev->num_ips = ARRAY_SIZE(soc15_ip_blk_v2); dev->ptr = (struct amd_pmc_bit_map *)soc15_ip_blk_v2; } else { - dev->num_ips = 22; + dev->num_ips = ARRAY_SIZE(soc15_ip_blk); dev->ptr = (struct amd_pmc_bit_map *)soc15_ip_blk; } dev->smu_msg = 0x938;