lkml.org 
[lkml]   [2014]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCHv3] tty: Set correct tty name in 'active' sysfs attribute
On Tue, Feb 25, 2014 at 10:38 AM, David Herrmann <dh.herrmann@gmail.com> wrote:
> On Tue, Feb 25, 2014 at 8:51 AM, Hannes Reinecke <hare@suse.de> wrote:

>> Positive?
>> I thought this was precisely the problem, ->device() changing the
>> index '0' into something non-zero.
>> The reports we had were that the line 'tty0' changed into 'tty1'.
>> Hence ->device() converted cs[i]->index (which is '0') into index
>> (which is '1').
>> Hence the check would be correct, wouldn't it?
>
> If "cs[i]" points to tty0, then cs[i]->index is 0. If you call
> ->device(), it will store 1 (or !=0) in "index". Thus, "(driver &&
> (index > 0))" will be true and you will write tty1 into the file
> instead of tty0. So you don't want to check whether the new value is
> non-zero, but whether the *previous* value was 0, turning this into:
>
> if (driver && (cs[i]->index > 0 || driver->major != TTY_MAJOR))
>
> So loosely speaking, we use the new code only for devices which either
> are not a VT or have an idx > 0. Otherwise, we use our fallback.

Hannes, David, care to update the patch to do that? It all sounds fine
to me. And we should get this merged again.

Kay


\
 
 \ /
  Last update: 2014-02-27 13:01    [W:0.044 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site