platform/x86: amd-pmc: Shuffle location of amd_pmc_get_smu_version()
authorNathan Chancellor <nathan@kernel.org>
Mon, 18 Apr 2022 21:38:00 +0000 (14:38 -0700)
committerHans de Goede <hdegoede@redhat.com>
Wed, 27 Apr 2022 14:25:24 +0000 (16:25 +0200)
When CONFIG_DEBUG_FS is disabled, amd_pmc_get_smu_version() is unused:

  drivers/platform/x86/amd-pmc.c:196:12: warning: unused function 'amd_pmc_get_smu_version' [-Wunused-function]
  static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
             ^
  1 warning generated.

Eliminate the warning by moving amd_pmc_get_smu_version() to the
CONFIG_DEBUG_FS block where it is used.

Fixes: b0c07116c894 ("platform/x86: amd-pmc: Avoid reading SMU version at probe time")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20220418213800.21257-1-nathan@kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/amd-pmc.c

index 668a1d6..e266492 100644 (file)
@@ -193,26 +193,6 @@ struct smu_metrics {
        u64 timecondition_notmet_totaltime[SOC_SUBSYSTEM_IP_MAX];
 } __packed;
 
-static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
-{
-       int rc;
-       u32 val;
-
-       rc = amd_pmc_send_cmd(dev, 0, &val, SMU_MSG_GETSMUVERSION, 1);
-       if (rc)
-               return rc;
-
-       dev->smu_program = (val >> 24) & GENMASK(7, 0);
-       dev->major = (val >> 16) & GENMASK(7, 0);
-       dev->minor = (val >> 8) & GENMASK(7, 0);
-       dev->rev = (val >> 0) & GENMASK(7, 0);
-
-       dev_dbg(dev->dev, "SMU program %u version is %u.%u.%u\n",
-               dev->smu_program, dev->major, dev->minor, dev->rev);
-
-       return 0;
-}
-
 static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp)
 {
        struct amd_pmc_dev *dev = filp->f_inode->i_private;
@@ -417,6 +397,26 @@ static int s0ix_stats_show(struct seq_file *s, void *unused)
 }
 DEFINE_SHOW_ATTRIBUTE(s0ix_stats);
 
+static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
+{
+       int rc;
+       u32 val;
+
+       rc = amd_pmc_send_cmd(dev, 0, &val, SMU_MSG_GETSMUVERSION, 1);
+       if (rc)
+               return rc;
+
+       dev->smu_program = (val >> 24) & GENMASK(7, 0);
+       dev->major = (val >> 16) & GENMASK(7, 0);
+       dev->minor = (val >> 8) & GENMASK(7, 0);
+       dev->rev = (val >> 0) & GENMASK(7, 0);
+
+       dev_dbg(dev->dev, "SMU program %u version is %u.%u.%u\n",
+               dev->smu_program, dev->major, dev->minor, dev->rev);
+
+       return 0;
+}
+
 static int amd_pmc_idlemask_show(struct seq_file *s, void *unused)
 {
        struct amd_pmc_dev *dev = s->private;