linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH 3/5] ACPI: button: Turn lid_blacklst dmi table into a generic quirk table
Date: Thu, 24 Oct 2019 19:44:05 +0200	[thread overview]
Message-ID: <1bf58f8c-c3d1-f61b-55f0-4b68cee280b8@redhat.com> (raw)
In-Reply-To: <20191021090826.GI32742@smile.fi.intel.com>

Hi,

On 21-10-2019 11:08, Andy Shevchenko wrote:
> On Fri, Oct 18, 2019 at 09:41:13PM +0200, Hans de Goede wrote:
>> Commit 3540c32a9ae4 ("ACPI / button: Add quirks for initial lid state
>> notification") added 3 different modes to the LID handling code to deal
>> with various buggy implementations.
>>
>> Until now users which need one of the 2 non-default modes to get their
>> hw to work have to pass a kernel commandline option for this.
>>
>> E.g. https://bugzilla.kernel.org/show_bug.cgi?id=106151 was closed with a
>> note that the user has to add "button.lid_init_state=open" to the kernel
>> commandline to get the LID code to not cause undesirable suspends on his
>> Samsung N210 Plus.
>>
>> This commit modifies the existing lid_blacklst dmi table so that it can
>> be used not only to completely disable the LID code on devices where
>> the ACPI tables are broken beyond repair, but also to select one of the 2
>> non default LID handling modes on devices where this is necessary.
>>
>> This will allow us to add quirks to make the LID work OOTB on broken
>> devices. Getting this working OOTB is esp. important because the typical
>> breakage is false LID closed reporting, causing undesirable suspends which
>> basically make the system unusable.
> 
>> +static int lid_init_state = -1;
> 
>>   static int acpi_button_register_driver(struct acpi_driver *driver)
>>   {
>> +	const struct dmi_system_id *dmi_id;
>> +
>> +	if (lid_init_state == -1) {
>> +		dmi_id = dmi_first_match(dmi_lid_quirks);
>> +		if (dmi_id)
> 
>> +			lid_init_state = (long)dmi_id->driver_data;
> 
> I would rather see here (intptr_t), though up to you and Rafael.
> Or mark a variable long itself?

I will make the variable itself long for v2.

>> +		else
>> +			lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
> 
> Can't we simple default the value to this?

No then we do not know if this value was set as module option by
the user, or if it is just the default and we should not use the
dmi based quirks when the value is set by the user, so we must
be able to distinguish the 2 cases.

Regards,

Hans


  reply	other threads:[~2019-10-24 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18 19:41 [PATCH 1/5] ACPI: button: Refactor lid_init_state module parsing code Hans de Goede
2019-10-18 19:41 ` [PATCH 2/5] ACPI: button: Allow disabling LID support with the lid_init_state module option Hans de Goede
2019-10-18 19:41 ` [PATCH 3/5] ACPI: button: Turn lid_blacklst dmi table into a generic quirk table Hans de Goede
2019-10-21  9:08   ` Andy Shevchenko
2019-10-24 17:44     ` Hans de Goede [this message]
2019-10-18 19:41 ` [PATCH 4/5] ACPI: button: Add DMI quirk for Medion Akoya E2215T Hans de Goede
2019-10-18 19:41 ` [PATCH 5/5] ACPI: button: Remove unused acpi_lid_notifier_[un]register functions Hans de Goede
2019-10-21  9:09 ` [PATCH 1/5] ACPI: button: Refactor lid_init_state module parsing code Andy Shevchenko

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=1bf58f8c-c3d1-f61b-55f0-4b68cee280b8@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.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;
as well as URLs for NNTP newsgroup(s).