Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752461AbaB0LRA (ORCPT ); Thu, 27 Feb 2014 06:17:00 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:46870 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751962AbaB0LQ7 (ORCPT ); Thu, 27 Feb 2014 06:16:59 -0500 MIME-Version: 1.0 In-Reply-To: References: <1393253450-12217-1-git-send-email-hare@suse.de> <530C4B65.2060207@suse.de> From: Kay Sievers Date: Thu, 27 Feb 2014 12:16:37 +0100 Message-ID: Subject: Re: [PATCHv3] tty: Set correct tty name in 'active' sysfs attribute To: David Herrmann Cc: Hannes Reinecke , linux-kernel , Ray Strode , Lennart Poettering , Greg Kroah-Hartman , Jiri Slaby , Werner Fink Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 25, 2014 at 10:38 AM, David Herrmann wrote: > On Tue, Feb 25, 2014 at 8:51 AM, Hannes Reinecke 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/