From: Xi Pardee <xi.pardee@linux.intel.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: rajvi0912@gmail.com, irenic.rajneesh@gmail.com,
david.e.box@linux.intel.com, Hans de Goede <hdegoede@redhat.com>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v4 4/6] platform/x86/intel/pmc: Create architecture specific callback
Date: Tue, 14 Jan 2025 08:39:35 -0800 [thread overview]
Message-ID: <a6239ca1-8eae-48e3-ba49-0bab81438b68@linux.intel.com> (raw)
In-Reply-To: <63e0fb3a-e1ab-e756-fea7-1f317eaad009@linux.intel.com>
On 1/10/2025 3:50 AM, Ilpo Järvinen wrote:
> On Thu, 9 Jan 2025, Xi Pardee wrote:
>
>> Add architecture specific callback field in pmc_dev_info structure.
>> Architecture specific action could be handled in this callback instead
>> of per architecture init functions. Convert Arrow Lake, Lunar Lake,
>> Meteor Lake and Tiger Lake platforms to use this field.
>>
>> Signed-off-by: Xi Pardee <xi.pardee@linux.intel.com>
>> ---
>> drivers/platform/x86/intel/pmc/arl.c | 15 +++++++--------
>> drivers/platform/x86/intel/pmc/core.c | 3 +++
>> drivers/platform/x86/intel/pmc/core.h | 7 +++++++
>> drivers/platform/x86/intel/pmc/lnl.c | 15 +++++++--------
>> drivers/platform/x86/intel/pmc/mtl.c | 15 +++++++--------
>> drivers/platform/x86/intel/pmc/tgl.c | 15 +++++----------
>> 6 files changed, 36 insertions(+), 34 deletions(-)
>>
>> diff --git a/drivers/platform/x86/intel/pmc/arl.c b/drivers/platform/x86/intel/pmc/arl.c
>> index dedf752237ca0..9ff90d32a635f 100644
>> --- a/drivers/platform/x86/intel/pmc/arl.c
>> +++ b/drivers/platform/x86/intel/pmc/arl.c
>> @@ -698,16 +698,15 @@ static struct pmc_dev_info arl_pmc_dev = {
>> .map = &arl_socs_reg_map,
>> .suspend = cnl_suspend,
>> .resume = arl_resume,
>> + .arch_specific = arl_specific_init,
>> };
>>
>> -int arl_core_init(struct pmc_dev *pmcdev)
>> +void arl_specific_init(struct pmc_dev *pmcdev)
>> {
>> - int ret;
>> -
>> - ret = generic_core_init(pmcdev, &arl_pmc_dev);
>> - if (ret)
>> - return ret;
>> -
>> arl_d3_fixup();
>> - return 0;
>> +}
> As I tried to explain already earlier I think the older form is better
> here because it would allow arch specific things in any order:
>
> void xx_init(struct pmc_dev *pmcdev, struct pmc_dev_info *pmc_dev_info)
> {
> int ret;
>
> xx_pre_fixup();
>
> ret = generic_core_init(pmcdev, pmc_dev_info);
> if (ret)
> return ret;
>
> xx_post_fixup();
>
> return 0;
> }
>
> If you make it a callback, you have pick either pre or post but cannot do
> both with a single callback. My suggestion would also allow replacing
> generic_core_init() completely if needed in future.
>
> Note how I pass the info parameter above to xx_init() so it can call into
> generic_core_init(). In the core, you'd do this to pick which init
> function to use:
>
> if (pmc_dev_info->init)
> ret = pmc_dev_info->init(pmcdev, pmc_dev_info);
> else
> ret = generic_core_init(pmcdev, pmc_dev_info);
Thanks for the feedback. I will change back to init function per
architect in next version.
Xi
next prev parent reply other threads:[~2025-01-14 16:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 0:26 [PATCH v4 0/6] Add Arrow Lake U/H support Xi Pardee
2025-01-10 0:26 ` [PATCH v4 1/6] platform/x86:intel/pmc: Make tgl_core_generic_init() static Xi Pardee
2025-01-10 0:26 ` [PATCH v4 2/6] platform/x86/intel/pmc: Remove duplicate enum Xi Pardee
2025-01-10 11:30 ` Ilpo Järvinen
2025-01-10 0:26 ` [PATCH v4 3/6] platform/x86:intel/pmc: Create generic_core_init() for all platforms Xi Pardee
2025-01-10 11:38 ` Ilpo Järvinen
2025-01-10 0:26 ` [PATCH v4 4/6] platform/x86/intel/pmc: Create architecture specific callback Xi Pardee
2025-01-10 11:50 ` Ilpo Järvinen
2025-01-14 16:39 ` Xi Pardee [this message]
2025-01-14 23:13 ` Xi Pardee
2025-01-10 0:26 ` [PATCH v4 5/6] platform/x86/intel/pmc: Remove init functions per architecture Xi Pardee
2025-01-10 0:26 ` [PATCH v4 6/6] platform/x86/intel/pmc: Add Arrow Lake U/H support to intel_pmc_core driver Xi Pardee
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=a6239ca1-8eae-48e3-ba49-0bab81438b68@linux.intel.com \
--to=xi.pardee@linux.intel.com \
--cc=david.e.box@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=irenic.rajneesh@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rajvi0912@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).