Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp444898pxb; Wed, 11 Nov 2020 07:34:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5LtkybT5t6qay4I3J21uVZKTjKu7Xfmo5kH+Nilwp3I7HD5rQOfj9u1xV2RNJsswZjIgl X-Received: by 2002:a17:906:bce6:: with SMTP id op6mr25383727ejb.2.1605108851119; Wed, 11 Nov 2020 07:34:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605108851; cv=none; d=google.com; s=arc-20160816; b=UrXR3az2hofHuNkoFChKwL7HbRc3y35N8eaQJI2HGSyswgUc24cSYlIOUrKdQV5VVc JxfPDPb92GIbgvJN/Y47/Gm9IN/9mftBmu2AjaHZuOc635r8es3ZvbUb+D9f+bxI6Ycr 5mAB70JvkCS/BD+EJjRBH98kJnhXDVHJcvuhd/gvliTWYgzovGxLBDiBx/I1Zq/5OK2y vW/25tz4rPhvIUE6QQKQOIhkB7WA+IuO/F1RHfPMAEmFTBWOUgzgPRm41t5It4ze7syG nkhGxqyCfFCNkh1OeTFVzHB5VDfb5kDbmb5GK9o41EKKLuu0E7pe7xg88KTmysUDD4Fd nWog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0sDXXEr4je5Qj8STdejDddgjD8UXPI7WrWvNpATUfJE=; b=s3v5QhxizBeOc6imjwZEPJ1PZMKyLJ0+rhVGDxUfsbQvFr3WxeIPVj1oj8qx9G/lKm SOGd1hYRgAJM0Sf1upO7qoC5JEjDuCNH5bZp0JfzxwP08R3uNx+0CchpFQl+ddMrq2AU 0MhR2fwU2b46QK1oB/5MyNflatjXFkrRTzOrhhWdys4EawA45QP1jJz2LF/CaM3C4M+S ajRSe9oj38guyp4UhbkleT6NASeZbw/dx8bmA1g6T1zRHI8B8wTqx3zid0vRix5hjjn2 VW/vT5PMBczsqmlmpe0VHK3I3I5lRke4v0PLNNSz59Rs8N/3LBOh/WdCcLL1PJLJg36e SjpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="h+INSi/k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g20si1656330edq.426.2020.11.11.07.33.46; Wed, 11 Nov 2020 07:34:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="h+INSi/k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726774AbgKKP3g (ORCPT + 99 others); Wed, 11 Nov 2020 10:29:36 -0500 Received: from mx2.suse.de ([195.135.220.15]:42118 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726136AbgKKP3g (ORCPT ); Wed, 11 Nov 2020 10:29:36 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1605108574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0sDXXEr4je5Qj8STdejDddgjD8UXPI7WrWvNpATUfJE=; b=h+INSi/kBPnCA17voUdGQn1OAIzVkLYVyIBp78cfssukqs9oqHWB8liFUjp3MSMsIut53o qMyrzMOPXC32Pxc6PPFVOdPWUbl32V33skLWWpMmyXaSGRF2dzCJhWktb/OqqxPVRAZNTq z5PKDAmhFW5zw+12staEUeAkxnTSoP0= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 516B7ABD1; Wed, 11 Nov 2020 15:29:34 +0000 (UTC) Date: Wed, 11 Nov 2020 16:29:33 +0100 From: Petr Mladek To: Geert Uytterhoeven Cc: Jonathan Corbet , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] docs: core-api/printk-formats.rst: Clarify formatting {cpu,node}mask Message-ID: <20201111152933.GA1702@alley> References: <20201110144121.3278667-1-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201110144121.3278667-1-geert+renesas@glider.be> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2020-11-10 15:41:21, Geert Uytterhoeven wrote: > Clarify how to pass the field width for bitmaps, and mention the helper > macros that are available to ease printing cpumask and nodemask. > > Signed-off-by: Geert Uytterhoeven > --- > Documentation/core-api/printk-formats.rst | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst > index 6d26c5c6ac485cec..160e710d992f3a36 100644 > --- a/Documentation/core-api/printk-formats.rst > +++ b/Documentation/core-api/printk-formats.rst > @@ -531,7 +531,9 @@ For printing bitmap and its derivatives such as cpumask and nodemask, > %*pb outputs the bitmap with field width as the number of bits and %*pbl > output the bitmap as range list with field width as the number of bits. > > -Passed by reference. > +The field width is passed by value, the bitmap is passed by reference. > +Helper macros cpumask_pr_args() and nodemask_pr_args() are available to ease > +printing cpumask and nodemask. I like it and I would go even further. I have never used these modifiers and was really confused by the entire description. IMHO, it is just an implementation detail that the number of bits is passed via width in struct printf_spec. It is the asterisk '*' that defines that one more argument is needed. And it is up to the documentation to define what the argument is for. The following text shows the idea. I am not a native speaker. I am sure that the working might get improved. %*pb 0779 %*pbl 0,3-6,8-10 For printing bitmap and its derivatives such as cpumask and nodemask. It takes two arguments, see '*'. The first argument defines the number of bits in the mask. The second argument points to the mask. %*pb outputs the bitmap as a hex number. If the size is bigger than 32-bit then 32-bit values are separated by a comma. %*pbl outputs the bitmap as a range list. The number of bits is passed by value. The mask is passed by reference. Helper macros cpumask_pr_args() and nodemask_pr_args() are available to ease printing cpumask and nodemask. Best Regards, Petr