X86 platform drivers
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Barnabás Pőcze" <pobrn@protonmail.com>,
	"Mark Pearson" <markpearson@lenovo.com>
Cc: "mgross@linux.intel.com" <mgross@linux.intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"platform-driver-x86@vger.kernel.org" 
	<platform-driver-x86@vger.kernel.org>,
	"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
	"hadess@hadess.net" <hadess@hadess.net>,
	"mario.limnociello@dell.com" <mario.limnociello@dell.com>,
	"eliadevito@gmail.com" <eliadevito@gmail.com>,
	"bberg@redhat.com" <bberg@redhat.com>,
	"dvhart@infradead.org" <dvhart@infradead.org>
Subject: Re: [PATCH v4 3/3] platform/x86: thinkpad_acpi: Add platform profile support
Date: Sat, 28 Nov 2020 16:00:50 +0100	[thread overview]
Message-ID: <8e738a62-2d1b-0357-7ef6-fb080d365064@redhat.com> (raw)
In-Reply-To: <ioprVbNER4h0HTVvyj2ElXiuNaSPjl8ycgp4XtOtj-Iwe4_6qnNRLYuvxIJKE2ULGPTRURY-1Dr9plCocTnx2S_ugBn7INWZScnn4-pTq4c=@protonmail.com>

Hi,

On 11/27/20 8:22 PM, Barnabás Pőcze wrote:
> Hi
> 
> 
> 2020. november 26., csütörtök 17:51 keltezéssel, Mark Pearson írta:
> 
>> [...]
>> +static bool dytc_ignore_next_event;
> 
> As a sidenote: can the profile switching be triggered by means that's not the
> `/sys/firmware/acpi/platform_profile` attribute (e.g. a physical button)?
> Because if so, then I'm not sure if `dytc_ignore_next_event` achieves its purpose
> robustly, although I believe it won't cause issues in practice. I think it could
> be made more robust using a mutex to serialize and synchronize access to the DYTC
> interface, but I'm not sure if the effort is worth it.
> 
> 
>> +static bool dytc_profile_available;
>> +static enum platform_profile_option dytc_current_profile;
>> [...]
>> +static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm)
>> +{
>> +	int err, output;
>> +
>> +	dytc_profile_available = false;
>> +	dytc_ignore_next_event = false;
>> +
>> +	err = dytc_command(DYTC_CMD_QUERY, &output);
>> +	/*
>> +	 * If support isn't available (ENODEV) then don't return an error
>> +	 * and don't create the sysfs group
>> +	 */
>> +	if (err == -ENODEV)
>> +		return 0;
>> +	/* For all other errors we can flag the failure */
>> +	if (err)
>> +		return err;
>> +
>> +	/* Check DYTC is enabled and supports mode setting */
>> +	if (output & BIT(DYTC_QUERY_ENABLE_BIT)) {
>> +		/* Only DYTC v5.0 and later has this feature. */
>> +		int dytc_version;
>> +
>> +		dytc_version = (output >> DYTC_QUERY_REV_BIT) & 0xF;
>> +		if (dytc_version >= 5) {
>> +			dbg_printk(TPACPI_DBG_INIT,
>> +				   "DYTC version %d: thermal mode available\n", dytc_version);
>> +			/* Create platform_profile structure and register */
>> +			do {
>> +				err = platform_profile_register(&dytc_profile);
>> +			} while (err == -EINTR);
>> [...]
> 
> I'm wondering if this loop is really necessary?

It is the result of using mutex_interruptible inside platform_profile_register(),
once that is fixed (as I just requested in my review of patch 2/3) then this loop
can go away.

Regards,

Hans


  reply	other threads:[~2020-11-28 22:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 16:51 [PATCH v4 1/3] Documentation: Add documentation for new platform_profile sysfs attribute Mark Pearson
2020-11-26 16:51 ` [PATCH v4 2/3] ACPI: platform-profile: Add platform profile support Mark Pearson
2020-11-27 19:14   ` Barnabás Pőcze
2020-11-29  1:07     ` [External] " Mark Pearson
2020-11-28 14:08   ` Hans de Goede
2020-11-28 15:37     ` Barnabás Pőcze
2020-11-29  1:19       ` [External] " Mark Pearson
2020-11-29 11:44         ` Hans de Goede
2020-11-29  1:16     ` Mark Pearson
2020-11-26 16:51 ` [PATCH v4 3/3] platform/x86: thinkpad_acpi: " Mark Pearson
2020-11-27 19:22   ` Barnabás Pőcze
2020-11-28 15:00     ` Hans de Goede [this message]
2020-11-28 15:59       ` Barnabás Pőcze
2020-11-29  1:34     ` [External] " Mark Pearson
2020-11-28 14:55   ` Hans de Goede
2020-12-01 16:51     ` [External] " Mark Pearson
2020-12-01 20:44       ` 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=8e738a62-2d1b-0357-7ef6-fb080d365064@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=bberg@redhat.com \
    --cc=dvhart@infradead.org \
    --cc=eliadevito@gmail.com \
    --cc=hadess@hadess.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mario.limnociello@dell.com \
    --cc=markpearson@lenovo.com \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=pobrn@protonmail.com \
    --cc=rjw@rjwysocki.net \
    /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