Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp445041ybl; Fri, 30 Aug 2019 02:07:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8Ox7uJpF0snfyd8BwQiaPBKJ1aNf6PMmcxsjdoYcfRny5JrBR5hgwA6Yzl4BpqVuiKtHt X-Received: by 2002:a63:fd49:: with SMTP id m9mr10548571pgj.82.1567156065828; Fri, 30 Aug 2019 02:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567156065; cv=none; d=google.com; s=arc-20160816; b=V0cLFbCuNfpLZx9XByuS36BvfBFutbGIrTEN54n2ZrXXz+kqcBO9lyP6QeWQ+RgWHF QOhoHHibINP1LON9xH4FVm2FIcQb1SBZoDj0u0uKqPkFadSmik95oyKJg3rsP1pMd6uQ 0Qjrh4/Xs0f+hW4SYnpX9nC8QspQJ9WN/yiKJktbae4Mo6voDtCvQv+y6NLD3iZ8mWqR FxEx6kIt6RXKZ1GR4FP40VX4KENNh+DcgPzdlMJwgJEkob2VuB83a3CPD5aiYid0ih41 vUZhr6XFtwH2Ps0/KzG1gRqLz5ViyR3yzBtA2n0VhM+MPILgOq/Bidh8SeBqqiAJrBR5 P7hA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=KvL9JVYcP58SzwqVc9QLEQWp8tBMLiUlLt55neSa1a8=; b=RbQb+7qr2rrFApwPTuFF/7rHtArUt2JmK/VpQf9p9zijsC994qPAlkyqSMdltPMRJg /fcnhjKQsk2POJmogGhPrPwc2LAnw2Vfm4Fk9wrZ+3xOcw0fZsBCbq+nCLjOi7li8jaJ YkwX+fVlzSHgkS/fBbCAoHI+6A4lkDxSJzhhceWc2FfVS0f2NLv9ik122OoQ2gamNTde Su4nY2aTQyjCAUs5ZvSvEgKi2FBgs9LquXYawx0pOQZgp+ThuqAFDOUHeZy6Sgs9SEnW +JPwwLc5sWvC8AZ1itBm92OkvxpU6i6Kb1y+Xs+UJVcVlaAUmnhJClWQloBzlU4JLm/E RF1g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si5553377pfq.93.2019.08.30.02.07.25; Fri, 30 Aug 2019 02:07:45 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727386AbfH3JG1 (ORCPT + 99 others); Fri, 30 Aug 2019 05:06:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:46406 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726461AbfH3JG1 (ORCPT ); Fri, 30 Aug 2019 05:06:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6B268AF93; Fri, 30 Aug 2019 09:06:25 +0000 (UTC) Date: Fri, 30 Aug 2019 11:06:24 +0200 From: Petr Mladek To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Rasmus Villemoes , Juergen Gross , Sergey Senozhatsky , Steven Rostedt , Andrew Morton , Jani Nikula , Jonathan Corbet , metux IT consult Enrico Weigelt , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] vsprintf: introduce %dE for error constants Message-ID: <20190830090624.tb2tmhbt3wzwz6rp@pathway.suse.cz> References: <20190827211244.7210-1-uwe@kleine-koenig.org> <20190828113216.p2yiha4xyupkbcbs@pathway.suse.cz> <74303921-aa95-9962-2254-27e556af54f4@kleine-koenig.org> <20190829081249.3zvvsa4ggb5pfozl@pathway.suse.cz> <45cd5b50-9854-fce7-5f08-f7660abb8691@suse.com> <002dc2a7-40a3-f52a-c8fa-5dbb42e6dd7b@kleine-koenig.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <002dc2a7-40a3-f52a-c8fa-5dbb42e6dd7b@kleine-koenig.org> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2019-08-29 19:39:45, Uwe Kleine-K?nig wrote: > On 8/29/19 11:09 AM, Rasmus Villemoes wrote: > > On 29/08/2019 10.27, Juergen Gross wrote: > >> On 29.08.19 10:12, Petr Mladek wrote: > >>> On Wed 2019-08-28 21:18:37, Uwe Kleine-K?nig? wrote: > >>>> > >>>> I'd like to postpone the discussion about "how" until we agreed about > >>>> the "if at all". > >>> > >>> It seems that all people like this feature. > >> > >> Hmm, what about already existing format strings conatining "%dE"? > >> > >> Yes, I could find only one (drivers/staging/speakup/speakup_bns.c), but > >> nevertheless... > > > > Indeed, Uwe still needs to respond to how he wants to handle that. I > > This is indeed bad and I didn't expect that. I just took a quick look > and this string is indeed used as sprintf format string. Hmm, it seems that solving this might be pretty tricky. I see this as a warning that we should not play with fire. There might be a reason why all format modifiers are put between % and the format identifier. > > still prefer making it %pE, both because it's easier to convert integers > > to ERR_PTRs than having to worry about the type of PTR_ERR() being long > > and not int, and because alphanumerics after %p have been ignored for a > > long time (10 years?) whether or not those characters have been > > recognized as a %p extension, so nobody relies on %pE putting an E after > > the %p output. It also keeps the non-standard extensions in the same > > "namespace", so to speak. > > > Oh, 'E' is taken, well, make it 'e' then. > > I like having %pe to print error valued pointers. Then maybe we could > have both %de for ints and %pe for pointers. :-) I would prefer to avoid %pe. It would make sense only when the value really contains error id. It means that it has to be used as: if (IS_ERR(p)) { pr_warn(...); The error path might handle the error using PTR_ERR() also on other locations. Also PTR_ERR() will make it clear that we are trying to print the error code. Best Regards, Petr