diff mbox

platform/x86: hp-wmi: Actually use mask parameter in hp_wmi_hw_state

Message ID 20171128151758.9234-1-michel@daenzer.net (mailing list archive)
State Rejected, archived
Delegated to: Darren Hart
Headers show

Commit Message

Michel Dänzer Nov. 28, 2017, 3:17 p.m. UTC
We were always checking bit 0 (which represents the docked state)
regardless of the mask.

Fixes the "tablet mode" state always being reported the same as the
docked state, which with current libinput can cause the built-in input
devices of laptops to be incorrectly disabled while docked.

Cc: stable@vger.kernel.org
Fixes: ("platform/x86: hp-wmi: Refactor dock and tablet state fetchers")
Signed-off-by: Michel Dänzer <michel@daenzer.net>
---
 drivers/platform/x86/hp-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Darren Hart Nov. 28, 2017, 4:57 p.m. UTC | #1
On Tue, Nov 28, 2017 at 04:17:58PM +0100, Michel Dänzer wrote:
> We were always checking bit 0 (which represents the docked state)
> regardless of the mask.
> 
> Fixes the "tablet mode" state always being reported the same as the
> docked state, which with current libinput can cause the built-in input
> devices of laptops to be incorrectly disabled while docked.
> 
> Cc: stable@vger.kernel.org
> Fixes: ("platform/x86: hp-wmi: Refactor dock and tablet state fetchers")
> Signed-off-by: Michel Dänzer <michel@daenzer.net>
> ---
>  drivers/platform/x86/hp-wmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index b4ed3dc983d5..2bdd6bbdb353 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -297,7 +297,7 @@ static int hp_wmi_hw_state(int mask)
>  	if (state < 0)
>  		return state;
>  
> -	return state & 0x1;
> +	return (state & mask) ? 1 : 0;

The current code does:

return !!(state & mask);

See:
9968e12 platform/x86: hp-wmi: Fix tablet mode detection for convertibles

Merged in 4.15-rc1
Michel Dänzer Nov. 28, 2017, 6:06 p.m. UTC | #2
On 2017-11-28 05:57 PM, Darren Hart wrote:
> On Tue, Nov 28, 2017 at 04:17:58PM +0100, Michel Dänzer wrote:
>> We were always checking bit 0 (which represents the docked state)
>> regardless of the mask.
>>
>> Fixes the "tablet mode" state always being reported the same as the
>> docked state, which with current libinput can cause the built-in input
>> devices of laptops to be incorrectly disabled while docked.
>>
>> Cc: stable@vger.kernel.org
>> Fixes: ("platform/x86: hp-wmi: Refactor dock and tablet state fetchers")
>> Signed-off-by: Michel Dänzer <michel@daenzer.net>
>> ---
>>  drivers/platform/x86/hp-wmi.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
>> index b4ed3dc983d5..2bdd6bbdb353 100644
>> --- a/drivers/platform/x86/hp-wmi.c
>> +++ b/drivers/platform/x86/hp-wmi.c
>> @@ -297,7 +297,7 @@ static int hp_wmi_hw_state(int mask)
>>  	if (state < 0)
>>  		return state;
>>  
>> -	return state & 0x1;
>> +	return (state & mask) ? 1 : 0;
> 
> The current code does:
> 
> return !!(state & mask);
> 
> See:
> 9968e12 platform/x86: hp-wmi: Fix tablet mode detection for convertibles
> 
> Merged in 4.15-rc1

AFAIK commits without

 Cc: stable@vger.kernel.org

don't get automatically picked up for stable branches. Can you manually
nominate 9968e12 for stable?


Thanks,
Andy Shevchenko Nov. 28, 2017, 7:30 p.m. UTC | #3
On Tue, Nov 28, 2017 at 8:06 PM, Michel Dänzer <michel@daenzer.net> wrote:
> On 2017-11-28 05:57 PM, Darren Hart wrote:
>> On Tue, Nov 28, 2017 at 04:17:58PM +0100, Michel Dänzer wrote:
>>> We were always checking bit 0 (which represents the docked state)
>>> regardless of the mask.
>>>
>>> Fixes the "tablet mode" state always being reported the same as the
>>> docked state, which with current libinput can cause the built-in input
>>> devices of laptops to be incorrectly disabled while docked.

>> Merged in 4.15-rc1
>
> AFAIK commits without
>
>  Cc: stable@vger.kernel.org
>
> don't get automatically picked up for stable branches. Can you manually
> nominate 9968e12 for stable?

AFAIK Greg picks up patches based on Fixes tag as well.
Feel free to ping us or just forward that one yourself if Greg will
not pick up in reasonable (month?) time.
Michel Dänzer Nov. 28, 2017, 7:41 p.m. UTC | #4
On 2017-11-28 08:30 PM, Andy Shevchenko wrote:
> On Tue, Nov 28, 2017 at 8:06 PM, Michel Dänzer <michel@daenzer.net> wrote:
>> On 2017-11-28 05:57 PM, Darren Hart wrote:
>>> On Tue, Nov 28, 2017 at 04:17:58PM +0100, Michel Dänzer wrote:
>>>> We were always checking bit 0 (which represents the docked state)
>>>> regardless of the mask.
>>>>
>>>> Fixes the "tablet mode" state always being reported the same as the
>>>> docked state, which with current libinput can cause the built-in input
>>>> devices of laptops to be incorrectly disabled while docked.
> 
>>> Merged in 4.15-rc1
>>
>> AFAIK commits without
>>
>>  Cc: stable@vger.kernel.org
>>
>> don't get automatically picked up for stable branches. Can you manually
>> nominate 9968e12 for stable?
> 
> AFAIK Greg picks up patches based on Fixes tag as well.
> Feel free to ping us or just forward that one yourself if Greg will
> not pick up in reasonable (month?) time.

Both 4.14.1 and 4.14.2 were released after Linus merged the fix, but
neither has it. Given that, and that a fair number of people seem to be
running into this, seems like a good idea to do it ASAP.
Darren Hart Dec. 1, 2017, 7:39 p.m. UTC | #5
On Tue, Nov 28, 2017 at 08:41:47PM +0100, Michel Dänzer wrote:
> On 2017-11-28 08:30 PM, Andy Shevchenko wrote:
> > On Tue, Nov 28, 2017 at 8:06 PM, Michel Dänzer <michel@daenzer.net> wrote:
> >> On 2017-11-28 05:57 PM, Darren Hart wrote:
> >>> On Tue, Nov 28, 2017 at 04:17:58PM +0100, Michel Dänzer wrote:
> >>>> We were always checking bit 0 (which represents the docked state)
> >>>> regardless of the mask.
> >>>>
> >>>> Fixes the "tablet mode" state always being reported the same as the
> >>>> docked state, which with current libinput can cause the built-in input
> >>>> devices of laptops to be incorrectly disabled while docked.
> > 
> >>> Merged in 4.15-rc1
> >>
> >> AFAIK commits without
> >>
> >>  Cc: stable@vger.kernel.org
> >>
> >> don't get automatically picked up for stable branches. Can you manually
> >> nominate 9968e12 for stable?
> > 
> > AFAIK Greg picks up patches based on Fixes tag as well.
> > Feel free to ping us or just forward that one yourself if Greg will
> > not pick up in reasonable (month?) time.
> 
> Both 4.14.1 and 4.14.2 were released after Linus merged the fix, but

Based on Documentation/process/stable-kernel-rules.rst, this seems unlikely to
happen automatically.

> neither has it. Given that, and that a fair number of people seem to be
> running into this, seems like a good idea to do it ASAP.

This is our responsibility to check if patches are candidates for stable, and
the Fixes tag should be a trigger for us, the maintainers, to do that check.
Sometimes we miss things, sometimes the dependencies are more than they are
worth. In this case, we just missed it.

You can just send this in yourself using the original fix and following the
process in stable-kernel-rules.rst.

However, that means I need to pay closer attention when Greg's
auto-merge-bot-email lands in my Inbox asking if I object.

I'll send this one to stable myself, thanks for calling our attention to it.
Andy Shevchenko Dec. 1, 2017, 7:52 p.m. UTC | #6
On Tue, Nov 28, 2017 at 9:41 PM, Michel Dänzer <michel@daenzer.net> wrote:
> On 2017-11-28 08:30 PM, Andy Shevchenko wrote:
>> On Tue, Nov 28, 2017 at 8:06 PM, Michel Dänzer <michel@daenzer.net> wrote:
>>> On 2017-11-28 05:57 PM, Darren Hart wrote:

>>>> Merged in 4.15-rc1
>>>
>>> AFAIK commits without
>>>
>>>  Cc: stable@vger.kernel.org
>>>
>>> don't get automatically picked up for stable branches. Can you manually
>>> nominate 9968e12 for stable?
>>
>> AFAIK Greg picks up patches based on Fixes tag as well.
>> Feel free to ping us or just forward that one yourself if Greg will
>> not pick up in reasonable (month?) time.
>
> Both 4.14.1 and 4.14.2 were released after Linus merged the fix, but
> neither has it. Given that, and that a fair number of people seem to be
> running into this, seems like a good idea to do it ASAP.

JFYI:

Thu, 30 Nov 2017 14:34:39 +0000 (11/30/2017 04:34:39 PM)

This is a note to let you know that I've just added the patch titled
to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
Darren Hart Dec. 1, 2017, 8:13 p.m. UTC | #7
On Fri, Dec 01, 2017 at 09:52:27PM +0200, Andy Shevchenko wrote:
> On Tue, Nov 28, 2017 at 9:41 PM, Michel Dänzer <michel@daenzer.net> wrote:
> > On 2017-11-28 08:30 PM, Andy Shevchenko wrote:
> >> On Tue, Nov 28, 2017 at 8:06 PM, Michel Dänzer <michel@daenzer.net> wrote:
> >>> On 2017-11-28 05:57 PM, Darren Hart wrote:
> 
> >>>> Merged in 4.15-rc1
> >>>
> >>> AFAIK commits without
> >>>
> >>>  Cc: stable@vger.kernel.org
> >>>
> >>> don't get automatically picked up for stable branches. Can you manually
> >>> nominate 9968e12 for stable?
> >>
> >> AFAIK Greg picks up patches based on Fixes tag as well.
> >> Feel free to ping us or just forward that one yourself if Greg will
> >> not pick up in reasonable (month?) time.
> >
> > Both 4.14.1 and 4.14.2 were released after Linus merged the fix, but
> > neither has it. Given that, and that a fair number of people seem to be
> > running into this, seems like a good idea to do it ASAP.
> 
> JFYI:
> 
> Thu, 30 Nov 2017 14:34:39 +0000 (11/30/2017 04:34:39 PM)
> 
> This is a note to let you know that I've just added the patch titled
> to the 4.14-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Ah well, too little too late on my part I guess.
Michel Dänzer Dec. 4, 2017, 8:31 a.m. UTC | #8
On 2017-12-01 08:39 PM, Darren Hart wrote:
> On Tue, Nov 28, 2017 at 08:41:47PM +0100, Michel Dänzer wrote:
>> On 2017-11-28 08:30 PM, Andy Shevchenko wrote:
>>> On Tue, Nov 28, 2017 at 8:06 PM, Michel Dänzer <michel@daenzer.net> wrote:
>>>> On 2017-11-28 05:57 PM, Darren Hart wrote:
>>>>> On Tue, Nov 28, 2017 at 04:17:58PM +0100, Michel Dänzer wrote:
>>>>>> We were always checking bit 0 (which represents the docked state)
>>>>>> regardless of the mask.
>>>>>>
>>>>>> Fixes the "tablet mode" state always being reported the same as the
>>>>>> docked state, which with current libinput can cause the built-in input
>>>>>> devices of laptops to be incorrectly disabled while docked.
>>>
>>>>> Merged in 4.15-rc1
>>>>
>>>> AFAIK commits without
>>>>
>>>>  Cc: stable@vger.kernel.org
>>>>
>>>> don't get automatically picked up for stable branches. Can you manually
>>>> nominate 9968e12 for stable?
>>>
>>> AFAIK Greg picks up patches based on Fixes tag as well.
>>> Feel free to ping us or just forward that one yourself if Greg will
>>> not pick up in reasonable (month?) time.
>>
>> Both 4.14.1 and 4.14.2 were released after Linus merged the fix, but
> 
> Based on Documentation/process/stable-kernel-rules.rst, this seems unlikely to
> happen automatically.

Right, because there's no Cc: stable@vger.kernel.org in the commit log,
that was my point above. :)


>> neither has it. Given that, and that a fair number of people seem to be
>> running into this, seems like a good idea to do it ASAP.
> 
> This is our responsibility to check if patches are candidates for stable, and
> the Fixes tag should be a trigger for us, the maintainers, to do that check.
> Sometimes we miss things, sometimes the dependencies are more than they are
> worth. In this case, we just missed it.
> 
> You can just send this in yourself using the original fix and following the
> process in stable-kernel-rules.rst.

I did, and Greg picked it up promptly. I forgot to Cc you guys on the
nomination e-mail, sorry about that.
diff mbox

Patch

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index b4ed3dc983d5..2bdd6bbdb353 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -297,7 +297,7 @@  static int hp_wmi_hw_state(int mask)
 	if (state < 0)
 		return state;
 
-	return state & 0x1;
+	return (state & mask) ? 1 : 0;
 }
 
 static int __init hp_wmi_bios_2008_later(void)