X86 platform drivers
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Yupeng Li <liyupeng@zbhlos.com>,
	Shyam-sundar.S-k@amd.com, markgross@kernel.org, "Limonciello,
	Mario" <Mario.Limonciello@amd.com>
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, caizp2008@163.com
Subject: Re: [PATCH 1/1] platform/x86/amd: Fix pmc compile dependency errors.
Date: Mon, 7 Nov 2022 11:28:51 +0100	[thread overview]
Message-ID: <0910bcc4-d55f-6f3a-b2df-4e30d164aeeb@redhat.com> (raw)
In-Reply-To: <20221026072531.346013-1-liyupeng@zbhlos.com>

Hi,

On 10/26/22 09:25, Yupeng Li wrote:
> When disabled CONFIG_SUSPEND and CONFIG_DEBUG_FS, get_metrics_table
> and amd_pmc_idlemask_read is defined under two conditions of this,
> pmc build with implicit declaration of function error.Some build error
> messages are as follows:
> 
>  CC [M]  drivers/platform/x86/amd/pmc.o
> drivers/platform/x86/amd/pmc.c: In function ‘smu_fw_info_show’:
> drivers/platform/x86/amd/pmc.c:436:6: error: implicit declaration of function ‘get_metrics_table’ [-Werror=implicit-function-declaration]
>   436 |  if (get_metrics_table(dev, &table))
>       |      ^~~~~~~~~~~~~~~~~
> drivers/platform/x86/amd/pmc.c: In function ‘amd_pmc_idlemask_show’:
> drivers/platform/x86/amd/pmc.c:508:8: error: implicit declaration of function ‘amd_pmc_idlemask_read’; did you mean ‘amd_pmc_idlemask_show’? [-Werror=implicit-function-declaration]
>   508 |   rc = amd_pmc_idlemask_read(dev, NULL, s);
>       |        ^~~~~~~~~~~~~~~~~~~~~
>       |        amd_pmc_idlemask_show
> cc1: some warnings being treated as errors
> 
> Signed-off-by: Yupeng Li <liyupeng@zbhlos.com>
> Reviewed-by: Caicai <caizp2008@163.com>

Thank you for your patch, however I do not believe that this is the correct fix:

> ---
>  drivers/platform/x86/amd/pmc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c
> index ce859b300712..2b08039921b8 100644
> --- a/drivers/platform/x86/amd/pmc.c
> +++ b/drivers/platform/x86/amd/pmc.c
> @@ -433,8 +433,10 @@ static int smu_fw_info_show(struct seq_file *s, void *unused)
>  	struct smu_metrics table;
>  	int idx;
>  
> +#if defined(CONFIG_SUSPEND) || defined(CONFIG_DEBUG_FS)
>  	if (get_metrics_table(dev, &table))
>  		return -EINVAL;
> +#endif
>  
>  	seq_puts(s, "\n=== SMU Statistics ===\n");
>  	seq_printf(s, "Table Version: %d\n", table.table_version);

The table variable gets used here, but now it no longer has been initialized by
get_metrics_table() so just #ifdef-ing out the get_metrics_table() call is wrong.

> @@ -503,11 +505,12 @@ static int amd_pmc_idlemask_show(struct seq_file *s, void *unused)
>  		if (rc)
>  			return rc;
>  	}
> -
>  	if (dev->major > 56 || (dev->major >= 55 && dev->minor >= 37)) {
> +#if defined(CONFIG_SUSPEND) || defined(CONFIG_DEBUG_FS)
>  		rc = amd_pmc_idlemask_read(dev, NULL, s);
>  		if (rc)
>  			return rc;
> +#endif
>  	} else {
>  		seq_puts(s, "Unsupported SMU version for Idlemask\n");
>  	}

Same thing except now nothing gets send to the struct seq_file *s,
so this is wrong too.

Shyam / Mario, can you take a look at the reported compile errors please?

Regards,

Hans


  reply	other threads:[~2022-11-07 10:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  7:25 [PATCH 1/1] platform/x86/amd: Fix pmc compile dependency errors Yupeng Li
2022-11-07 10:28 ` Hans de Goede [this message]
2022-11-07 12:27   ` Mario Limonciello
2022-11-11 15:14     ` Borislav Petkov
2022-11-11 15:16       ` Limonciello, Mario
2022-11-11 15:39         ` Borislav Petkov
2022-11-15 11:38           ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0910bcc4-d55f-6f3a-b2df-4e30d164aeeb@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=Mario.Limonciello@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=caizp2008@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liyupeng@zbhlos.com \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox