Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21134463ybl; Sun, 5 Jan 2020 21:17:31 -0800 (PST) X-Google-Smtp-Source: APXvYqyp7V/3s2QtzyLyljHR1AjCDy+v4IJ/dI9WvGnK3i8oBJP+vDI2TZYgs/GlDLZ7MLKJhRfx X-Received: by 2002:a05:6830:22ee:: with SMTP id t14mr110445862otc.236.1578287851821; Sun, 05 Jan 2020 21:17:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578287851; cv=none; d=google.com; s=arc-20160816; b=QfaA3LXaOneDpPy57f6/VKuhk26mRE+yaCuUVTicv+xBGhwSk+8VUJBTRhSF7SqcnH taKduGhFuv5CNmAV5UN0LO350Y87q0JYjFqeL0IsqoaOaAsVI4PZpJMUnGHW8t6GOcFc LiON/IU4r2QO/k79Y6nMh+9ycOsXNfjXh6POMYDbRvN9xUsCca2CGSanxU+GtLF37bPK 4f3oLy9rUNK6NK2n6TEZIphQvB0GEVw2dhJ/6jBo5PuRtrM3MZf1B8cky15Qt8ob/+ne 5QmDpujGZ+Yr3VPhmLR9PAxFkCxrRgFP61mu90PAIjEYIT2FfNBBhZzaQjP0nTY4BU5S ERRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dQ4dLbLTXcTsqLxkRXDmA81aLMecCPVammCzSLarEZY=; b=WqTUBFLMpjuiKZWblMV5L6WJrNHLC/7mctZFdxdjLCon88a7dMKtl/vsU6QeppJAYL ov70ldez1M0wULHRaloKXGU6pD6OLe8GS0p8cxM88UlV+yX+4OIfbzWtYZFbYx5ZSAPc b7xXH5MKASag5HdtRprUoBMPX1ag43Muhc8h7GAu4FVi/VM9K7j4rgFJdtXEjWGMYKv+ MqozqsNVa34xsiE+/HRDxnpqzZOad/9UMHj/D7w5RLvvXl/MPwZtkmh3aj5ScRKAzWQI mbh9hLloGn4EWBsC1jTGGQZboLVV0G/OM5zxSfuf4HYPk61nNOHmgVekwbDUks2f7EPu QmQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cSp0yqDT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w26si32292343otl.213.2020.01.05.21.17.19; Sun, 05 Jan 2020 21:17:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cSp0yqDT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726618AbgAFFPM (ORCPT + 99 others); Mon, 6 Jan 2020 00:15:12 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:39733 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbgAFFPM (ORCPT ); Mon, 6 Jan 2020 00:15:12 -0500 Received: by mail-pf1-f195.google.com with SMTP id q10so26401615pfs.6 for ; Sun, 05 Jan 2020 21:15:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dQ4dLbLTXcTsqLxkRXDmA81aLMecCPVammCzSLarEZY=; b=cSp0yqDTpoL9oCte+SWhRNVDo83fs8D5JQRAmcTBPjAxbPdQjoBf7lEIwk812b76c1 xqfBZFUjaVEBI5WvbCS3x6zL8b/2s4jmpbygW1dUqs9NOtDFSCJVKUIOb1gs6vyz7T36 JwUbsoJxeDZLR7nZFwllIatimP88MhozxuwxIJ+QiWIciKI2/NhN8DVWsyUolg3rlhDj Ny1SLgveqKLY+atHi8ikfEo4v59acfUmA+oEbGaZbfnyDeP0h4YZvzM1rJc6DkOp+0wc 8Jam3FohP7p3ShURpZzfoPMvM3ubLu0McAZIaNzop2Ims9uL2dl114GlS7JwT+A6TDHh mNug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dQ4dLbLTXcTsqLxkRXDmA81aLMecCPVammCzSLarEZY=; b=YQi1VWX6HCGAf/8rpm7GWskKLvoBupc3IfJ6lyEgpoaZQmfhMqsUXkFnzVkRnQK3bC lgIaVNC/qp0Dt+QskjvmZQb42iCeDhiQfXCC1TXDv3RPYwVpDh3xYevPDeF3tAz+bXOU tGcrWrsrLmttRcOF60ZSoxS6diF+SFmw+dl+kDSoAo2t1hwpDdfYWaw+YDhwMrovbxDu nXSJDTV2FUGxdlChQfnjMjtK6tiEaFA86jLwOZ8NtSa0upoqAxeYugM+OBUzomUgKjgs GM5l8oYh5Kjf0GV357e3eiZCy4McBPfauSgJG1sUPGdFXN45OsdfGHCGKFHUNpG/7wjM ES0w== X-Gm-Message-State: APjAAAV0RoYnrBLOzMrUOFHWeICsYdeTdlJ3rI1YgKTVtwhCv5JVwLKE aCOttCPP6J7DSxUZUAYn8/Q= X-Received: by 2002:a63:454a:: with SMTP id u10mr110935513pgk.248.1578287711764; Sun, 05 Jan 2020 21:15:11 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:250d:e71d:5a0a:9afe]) by smtp.gmail.com with ESMTPSA id r66sm77209408pfc.74.2020.01.05.21.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2020 21:15:10 -0800 (PST) Date: Mon, 6 Jan 2020 14:15:08 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Benjamin Herrenschmidt , linux-kernel@vger.kernel.org, Sergey Senozhatsky , Steven Rostedt , Linus Torvalds Subject: Re: [PATCH v2] printk: Fix preferred console selection with multiple matches Message-ID: <20200106051508.GA17351@google.com> References: <2712d7e2fb68bca06a33e2e062fc8e65a2652410.camel@kernel.crashing.org> <20191219135053.xr67lybhycepcxkp@pathway.suse.cz> <32fde8cd451ea0eaff38108d9f2f2d4a97a43097.camel@kernel.crashing.org> <20191220091131.4uifcbudwppjspf4@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191220091131.4uifcbudwppjspf4@pathway.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (19/12/20 10:11), Petr Mladek wrote: [..] > > > > +enum con_match { > > > > + con_matched, > > > > + con_matched_preferred, > > > > + con_braille, > > > > + con_failed, > > > > + con_no_match, > > > > +}; > > > > > > Please, replace this with int, where: > > > > > > + con_matched -> 0 > > > + con_matched_preferred -> 0 and make "has_preferred" global variable > > > + con_braile -> 0 later check for CON_BRL flag > > > + con_failed -> -EFAULT > > > + con_no_match -> -ENOENT > > > > Not fan of using -EFAULT here, it's a detail since it's rather kernel > > internal, but I'd rather use -ENXIO for no match and -EIO for failed > > (or pass the original error code up if any). That said it's really bike > > shed painting at this point :-) > > Sigh, either variant is somehow confusing. > > I think that -ENOENT is a bit better than -EIO. It is abbreviation of > "No entry or No entity" which quite fits here. Also the device might > exist but it is not used when not requested. Can we please keep the enum? Enum is super self-descriptive, can't get any better. Any other alternative - be it -EFAULT or -EIO or -ENOENT - would force one to always look at what is actually going on in try_match_new_console() and what particular errno means. None of those errnos fit, they make things cryptic. IMHO. -ss