Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3293728pxk; Mon, 5 Oct 2020 06:19:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPImLNJpMEKrE4GFw5O0LX/0Ec8ATo5d5O7SLp/oJR9XvlUYc358lXa2rCu45K3gji5+zg X-Received: by 2002:a17:906:fa99:: with SMTP id lt25mr5685277ejb.511.1601903966945; Mon, 05 Oct 2020 06:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601903966; cv=none; d=google.com; s=arc-20160816; b=tJ2sauLiVFt37QJB66YeQwXXpNpmMmnpkirGbbJ0CcOJgJh/TjypQT47NQrDHHeJjH xjqzHCUuVOxb+Qp5iDqSqU0AK7zn5GxzfAL3CX11SJ3JAdqiBupjs5q0oGypeOtkM8Gs 9bZveeqIZIYwP5P8+6ZHZFiGr6QYZea4q7or/6d7B4TMWRZxWgAGHMufWELdCL7f23YM wrliNfDN1m0+meL5IrsNHFvn/5kiZMyqSVCEknXTWZsAR4UXVvMts+FmL1jA/9hG4uvL +NYCaqwrJ1QmgpEfGHEtED2XkluD3r0gM9Bbc2xJww+GE8DkUZ7q7aPVsj6MeVGU/BLc xntw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=L1NzlDJAeXCHzvhGIHrH+qeoAQyPtSfC2U8I9hFEYNQ=; b=T4vb4CpSBFzx42lSZ6he3XhlARVoKbp1xjPId3amsplGY3dZA0x6dcY63r8lm4IMDR 5qtUsDOg7m3FY2Uyb/xe/RFyBLUUbbOw3wHFiHWGOoelJWzg7XHGp1jL8ryNGOlBuNPi x1RhtgOOqGpYN347ApdTx1eBzsVIknmXziy3LJI0PKVCjbNVi92CCnfwYignEXo5PVVC 9CD/EmOvx480EIpcDZ1ooVBGNLV0GnUl2sIlESA3JnCq2JGI9mEETDffjEEqPtYmH0gM 9hKm/4Qqjc4j8Dky5d8rzivgzqKfNQoVZ8rz8jgt9NdvNQTJKNjOqtOKr7rUuDZ8I75h QwTQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si6811286ejx.265.2020.10.05.06.19.02; Mon, 05 Oct 2020 06:19:26 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725982AbgJENPu (ORCPT + 99 others); Mon, 5 Oct 2020 09:15:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbgJENPu (ORCPT ); Mon, 5 Oct 2020 09:15:50 -0400 Received: from albert.telenet-ops.be (albert.telenet-ops.be [IPv6:2a02:1800:110:4::f00:1a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3046C0613CE for ; Mon, 5 Oct 2020 06:15:49 -0700 (PDT) Received: from ramsan ([84.195.186.194]) by albert.telenet-ops.be with bizsmtp id cDFn2300X4C55Sk06DFnQQ; Mon, 05 Oct 2020 15:15:47 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1kPQLD-0007Fu-B9; Mon, 05 Oct 2020 15:15:47 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1kPQLD-0005qn-8R; Mon, 05 Oct 2020 15:15:47 +0200 From: Geert Uytterhoeven To: Liam Girdwood , Mark Brown , Guenter Roeck Cc: linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] regulator: Make constraint debug processing conditional on DEBUG Date: Mon, 5 Oct 2020 15:15:46 +0200 Message-Id: <20201005131546.22448-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If debugging is disabled, print_constraints() does not print the actual constraints, but still performs some processing and string formatting, only to throw away the result later. Fix this by moving all constraint debug processing to a separate function, and replacing it by a dummy when debugging is disabled. This reduces kernel size by almost 800 bytes (on arm/arm64). Fixes: 194dbaefa0da24bb ("regulator: Lower priority of constraint logging") Signed-off-by: Geert Uytterhoeven --- drivers/regulator/core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 607c2a76bb604f96..98beccef3fcd0905 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1059,7 +1059,8 @@ static int suspend_set_initial_state(struct regulator_dev *rdev) return __suspend_set_state(rdev, rstate); } -static void print_constraints(struct regulator_dev *rdev) +#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG) +static void print_constraints_debug(struct regulator_dev *rdev) { struct regulation_constraints *constraints = rdev->constraints; char buf[160] = ""; @@ -1127,6 +1128,16 @@ static void print_constraints(struct regulator_dev *rdev) _regulator_is_enabled(rdev) ? "enabled" : "disabled"); rdev_dbg(rdev, "%s\n", buf); +} +#else /* !DEBUG && !CONFIG_DYNAMIC_DEBUG */ +static inline void print_constraints_debug(struct regulator_dev *rdev) {} +#endif /* !DEBUG && !CONFIG_DYNAMIC_DEBUG */ + +static void print_constraints(struct regulator_dev *rdev) +{ + struct regulation_constraints *constraints = rdev->constraints; + + print_constraints_debug(rdev); if ((constraints->min_uV != constraints->max_uV) && !regulator_ops_is_valid(rdev, REGULATOR_CHANGE_VOLTAGE)) -- 2.17.1