Received: by 10.223.185.116 with SMTP id b49csp1137171wrg; Fri, 16 Feb 2018 13:10:12 -0800 (PST) X-Google-Smtp-Source: AH8x225WF0IKSRvCMndoJuTI9BZ4z6RLvhTpOz9MxwxQlHy+MUWtfxGP4JrEiUNtvnARVbDYdYsm X-Received: by 2002:a17:902:8e86:: with SMTP id bg6-v6mr7099458plb.402.1518815412402; Fri, 16 Feb 2018 13:10:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518815412; cv=none; d=google.com; s=arc-20160816; b=tsEBCuDZjhWwOxbTZHsqFJQPsIjYZfVgz42pOk1PFAUmBVAIZgc44Zgvn5dzh2Lm/E g8etFPBLETdiKEUuPdIDlD+4a49wBbxwjRpx5LLSauCzdGmBSoXNLSjgLG3zbt+ExrJ/ 0WDMJo6PH3g+IzCLa71icU4ghBCan2NySJXHzkiLgzgaqUPk1/bUaPv0+kiP+jlQJD3/ 8nbZkFAnlSUthD/B/6N0okOuOXdymb8dl1meY0KR7oj+gUDZ/IIVCRJOIeXkaGW0glG/ S8UFoEz3ZtzPzs1bjKNZxf+rPrC+Oxs4oj8UqC+0mZEfqwYBBXS+K6bznLFR+3PqJz1I UL9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=NGthePrFfKMKUqHA7nfm+9aDY8+1EowK4lTMwbRm6mQ=; b=kPave81TfRKoT3efmyURm2YP4Ro1Ea94lUQbZVYSfFdgFwRgNWuRjzo5qIdZNhEKeN w3tjgDJIW5CKkGy6nQ2vN2cap0ZJU1F07AM9UOW3/OfWr8XAtD07Gv8GWaodgVbgq9OS bGBZzp8EH0WcMzGwk/zNf4nG0mig2M2oWqMzVvQu1G9R01hrAbT35Ty5Cef3JGJRSGXq 7Rr8GnFP/x7VfpqzhOzOBIHaohfS2+xYrq6+wF/LdYTJHqN/1Pg6wvjVSn9SN3gvpTWU ziAT5krE2JyShAn6tHgSFRKXChcio2FVYFoGcRIGGS4Y3mVho0hqVpIVwbTWtsbSY/gL hjpQ== 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 c10si3372887pfm.263.2018.02.16.13.09.58; Fri, 16 Feb 2018 13:10:12 -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; 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 S1750817AbeBPVHR (ORCPT + 99 others); Fri, 16 Feb 2018 16:07:17 -0500 Received: from mga04.intel.com ([192.55.52.120]:5977 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750723AbeBPVHQ (ORCPT ); Fri, 16 Feb 2018 16:07:16 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Feb 2018 13:07:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,520,1511856000"; d="scan'208";a="18321969" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 16 Feb 2018 13:07:13 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0FF23B8; Fri, 16 Feb 2018 23:07:13 +0200 (EET) From: Andy Shevchenko To: "Tobin C . Harding" , linux@rasmusvillemoes.dk, Petr Mladek , Joe Perches , linux-kernel@vger.kernel.org, Andrew Morton Cc: Andy Shevchenko Subject: [PATCH v2 2/9] lib/vsprintf: Make dec_spec global Date: Fri, 16 Feb 2018 23:07:04 +0200 Message-Id: <20180216210711.79901-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180216210711.79901-1-andriy.shevchenko@linux.intel.com> References: <20180216210711.79901-1-andriy.shevchenko@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are places where default specification to print decimal numbers is in use. Make it global and convert existing users. Signed-off-by: Andy Shevchenko --- lib/vsprintf.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index d7a708f82559..8f29af063d8a 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -693,6 +693,11 @@ char *symbol_string(char *buf, char *end, void *ptr, #endif } +static const struct printf_spec default_dec_spec = { + .base = 10, + .precision = -1, +}; + static noinline_for_stack char *resource_string(char *buf, char *end, struct resource *res, struct printf_spec spec, const char *fmt) @@ -722,11 +727,6 @@ char *resource_string(char *buf, char *end, struct resource *res, .precision = -1, .flags = SMALL | ZEROPAD, }; - static const struct printf_spec dec_spec = { - .base = 10, - .precision = -1, - .flags = 0, - }; static const struct printf_spec str_spec = { .field_width = -1, .precision = 10, @@ -760,10 +760,10 @@ char *resource_string(char *buf, char *end, struct resource *res, specp = &mem_spec; } else if (res->flags & IORESOURCE_IRQ) { p = string(p, pend, "irq ", str_spec); - specp = &dec_spec; + specp = &default_dec_spec; } else if (res->flags & IORESOURCE_DMA) { p = string(p, pend, "dma ", str_spec); - specp = &dec_spec; + specp = &default_dec_spec; } else if (res->flags & IORESOURCE_BUS) { p = string(p, pend, "bus ", str_spec); specp = &bus_spec; @@ -903,9 +903,6 @@ char *bitmap_list_string(char *buf, char *end, unsigned long *bitmap, int cur, rbot, rtop; bool first = true; - /* reused to print numbers */ - spec = (struct printf_spec){ .base = 10 }; - rbot = cur = find_first_bit(bitmap, nr_bits); while (cur < nr_bits) { rtop = cur; @@ -920,13 +917,13 @@ char *bitmap_list_string(char *buf, char *end, unsigned long *bitmap, } first = false; - buf = number(buf, end, rbot, spec); + buf = number(buf, end, rbot, default_dec_spec); if (rbot < rtop) { if (buf < end) *buf = '-'; buf++; - buf = number(buf, end, rtop, spec); + buf = number(buf, end, rtop, default_dec_spec); } rbot = cur; -- 2.15.1