platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Limonciello, Mario" <Mario.Limonciello@amd.com>,
	"S-k, Shyam-sundar" <Shyam-sundar.S-k@amd.com>,
	"markgross@kernel.org" <markgross@kernel.org>
Cc: "platform-driver-x86@vger.kernel.org" 
	<platform-driver-x86@vger.kernel.org>,
	Patil Rajesh <Patil.Reddy@amd.com>
Subject: Re: [PATCH v1 01/15] ACPI: platform_profile: Add support for notification chains
Date: Wed, 27 Jul 2022 15:24:36 +0200	[thread overview]
Message-ID: <58b9a042-a7de-a64c-ca8b-f3f187c22c83@redhat.com> (raw)
In-Reply-To: <MN0PR12MB61018FA44A015793FCF62322E2869@MN0PR12MB6101.namprd12.prod.outlook.com>

Hi,

On 7/12/22 17:03, Limonciello, Mario wrote:
> [Public]
> 
>> -----Original Message-----
>> From: S-k, Shyam-sundar <Shyam-sundar.S-k@amd.com>
>> Sent: Tuesday, July 12, 2022 09:59
>> To: hdegoede@redhat.com; markgross@kernel.org
>> Cc: platform-driver-x86@vger.kernel.org; Patil Rajesh
>> <Patil.Reddy@amd.com>; Limonciello, Mario
>> <Mario.Limonciello@amd.com>; S-k, Shyam-sundar <Shyam-sundar.S-
>> k@amd.com>
>> Subject: [PATCH v1 01/15] ACPI: platform_profile: Add support for
>> notification chains
>>
>> From: Mario Limonciello <mario.limonciello@amd.com>
>>
>> Allow other drivers to react to determine current active profile
>> and react to platform profile changes.
>>
> 
> The original patch this came from had notification chains, but as this was
> pared down to just export the get method, this commit message and title
> should be updated.
> 
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
>> ---
>>  drivers/acpi/platform_profile.c  | 26 ++++++++++++++++++++++++++
>>  include/linux/platform_profile.h |  1 +
>>  2 files changed, 27 insertions(+)
>>
>> diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
>> index d418462ab791..7e12a1f30f06 100644
>> --- a/drivers/acpi/platform_profile.c
>> +++ b/drivers/acpi/platform_profile.c
>> @@ -49,6 +49,32 @@ static ssize_t platform_profile_choices_show(struct
>> device *dev,
>>  	return len;
>>  }
>>
>> +int platform_profile_get(enum platform_profile_option *profile)
>> +{
>> +	int err;
>> +
>> +	err = mutex_lock_interruptible(&profile_lock);

Besides Mario'r remark about the commit message, this must be
mutex_lock() not mutex_lock_interruptible() since this function
is intended to be called by other kernel code, rather then from
userspace.

Regards,

Hans


>> +	if (err)
>> +		return err;
>> +
>> +	if (!cur_profile) {
>> +		mutex_unlock(&profile_lock);
>> +		return -ENODEV;
>> +	}
>> +
>> +	err = cur_profile->profile_get(cur_profile, profile);
>> +	mutex_unlock(&profile_lock);
>> +	if (err)
>> +		return err;
>> +
>> +	/* Check that profile is valid index */
>> +	if (WARN_ON((*profile < 0) || (*profile >=
>> ARRAY_SIZE(profile_names))))
>> +		return -EIO;
>> +
>> +	return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(platform_profile_get);
>> +
>>  static ssize_t platform_profile_show(struct device *dev,
>>  					struct device_attribute *attr,
>>  					char *buf)
>> diff --git a/include/linux/platform_profile.h
>> b/include/linux/platform_profile.h
>> index e5cbb6841f3a..2395be670dfd 100644
>> --- a/include/linux/platform_profile.h
>> +++ b/include/linux/platform_profile.h
>> @@ -37,5 +37,6 @@ struct platform_profile_handler {
>>  int platform_profile_register(struct platform_profile_handler *pprof);
>>  int platform_profile_remove(void);
>>  void platform_profile_notify(void);
>> +int platform_profile_get(enum platform_profile_option *profile);
>>
>>  #endif  /*_PLATFORM_PROFILE_H_*/
>> --
>> 2.25.1
> 


  reply	other threads:[~2022-07-27 13:24 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12 14:58 [PATCH v1 00/15] platform/x86/amd/pmf: Introduce AMD PMF Driver Shyam Sundar S K
2022-07-12 14:58 ` [PATCH v1 01/15] ACPI: platform_profile: Add support for notification chains Shyam Sundar S K
2022-07-12 15:03   ` Limonciello, Mario
2022-07-27 13:24     ` Hans de Goede [this message]
2022-07-27 20:38   ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 02/15] platform/x86/amd/pmf: Add support for PMF core layer Shyam Sundar S K
2022-07-27 13:57   ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 03/15] platform/x86/amd/pmf: Add support for PMF APCI layer Shyam Sundar S K
2022-07-27 13:57   ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 04/15] platform/x86/amd/pmf: Add support SPS PMF feature Shyam Sundar S K
2022-07-27 19:29   ` Hans de Goede
2022-07-27 20:26     ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 05/15] platform/x86/amd/pmf: Add debugfs information Shyam Sundar S K
2022-07-27 19:50   ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 06/15] platform/x86/amd/pmf: Add heartbeat signal support Shyam Sundar S K
2022-07-27 19:53   ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 07/15] platform/x86/amd/pmf: Add fan control support Shyam Sundar S K
2022-07-27 20:11   ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 08/15] platform/x86/amd/pmf: Get performance metrics from PMFW Shyam Sundar S K
2022-07-27 20:36   ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 09/15] platform/x86/amd/pmf: Add support for CnQF Shyam Sundar S K
2022-07-27 20:51   ` Hans de Goede
2022-07-27 21:00   ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 10/15] platform/x86/amd/pmf: Add sysfs to toggle CnQF Shyam Sundar S K
2022-07-27 20:52   ` Hans de Goede
2022-07-27 21:12     ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 11/15] Documentation/ABI/testing/sysfs-amd-pmf: Add ABI doc for AMD PMF Shyam Sundar S K
2022-07-27 20:52   ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 12/15] platform/x86/amd/pmf: Add support for Auto mode feature Shyam Sundar S K
2022-07-27 21:22   ` Hans de Goede
2022-07-28 12:57     ` Shyam Sundar S K
2022-07-28 13:15       ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 13/15] platform/x86/amd/pmf: Handle AMT and CQL events for Auto mode Shyam Sundar S K
2022-07-27 21:33   ` Hans de Goede
2022-07-27 21:44   ` Hans de Goede
2022-07-27 21:46   ` Hans de Goede
2022-07-27 23:52     ` Limonciello, Mario
2022-07-28 13:03       ` Hans de Goede
2022-07-28 13:43         ` Limonciello, Mario
2022-07-28 14:09           ` Hans de Goede
2022-07-28 14:38             ` Limonciello, Mario
2022-07-28 17:46               ` Hans de Goede
2022-07-28 18:06                 ` Limonciello, Mario
2022-07-28 18:17                   ` Hans de Goede
2022-07-28 21:01                     ` Limonciello, Mario
2022-07-29 11:03                       ` Hans de Goede
2022-07-29 15:43                         ` Limonciello, Mario
2022-07-29 17:40                           ` Shyam Sundar S K
2022-07-29 17:59                             ` Hans de Goede
2022-08-01 10:29                               ` Shyam Sundar S K
2022-08-01 11:08                                 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 14/15] platform/x86/amd/pmf: Force load driver on older supported platforms Shyam Sundar S K
2022-07-27 21:40   ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 15/15] MAINTAINERS: Add AMD PMF driver entry Shyam Sundar S K
2022-07-27 21:41   ` Hans de Goede
2022-07-28 17:44     ` Shyam Sundar S K

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=58b9a042-a7de-a64c-ca8b-f3f187c22c83@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=Mario.Limonciello@amd.com \
    --cc=Patil.Reddy@amd.com \
    --cc=Shyam-sundar.S-k@amd.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;
as well as URLs for NNTP newsgroup(s).