From patchwork Tue May 18 11:26:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vaittinen, Matti" X-Patchwork-Id: 12264633 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05DE4C43460 for ; Tue, 18 May 2021 11:27:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF7DB61185 for ; Tue, 18 May 2021 11:27:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233708AbhERL2X (ORCPT ); Tue, 18 May 2021 07:28:23 -0400 Received: from mail-lj1-f178.google.com ([209.85.208.178]:46961 "EHLO mail-lj1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233672AbhERL2X (ORCPT ); Tue, 18 May 2021 07:28:23 -0400 Received: by mail-lj1-f178.google.com with SMTP id e11so11083050ljn.13; Tue, 18 May 2021 04:27:03 -0700 (PDT) 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; bh=5VM+aNdXZX/Tyi4SEhOD42oxW5wy9GjU50/LRNKpMwY=; b=Jr1awd99ZIpPXlqeFBbHiuDptehvc+kcj+iYOxY6Uz0Vr0PcIgRGMgrtEwDUkRmWHD UGR52shnGGXXF6qEj4ZTXcV0RmsecBY+8VSXbwRfllVYBZxrwkyUk0oZZr2fwz4+54ZB rZmmS46qz+/HesbpWyFPbJwveJY6X+ysZu6+m4nuvVjwAP/JLgzM5XCpioc6xy1ty/p6 0GqVGB0AsE+UgP8STPBC1AK6hdjlQdyVdL9IsHF6t08CAHjB8KaJ7Ht0vU5H934PDeQB cUCPz4idAuNnkFLPQtTpfnDVE8uNDPxjsSN5lCP+S1YD6nHT9anruzYlZdF78pr1tJMi xNgg== X-Gm-Message-State: AOAM530Au2ZYZAr9DATcuslbbpVbt0FMVyeQFzxYFImlcw7+ivUIxr8P BgysD11UZ1HG43D6qtaMxCY= X-Google-Smtp-Source: ABdhPJyMQv5cur2ACgBRZur0OwO8R3K9eeD/9WrAkQC/iapgD4D/x/enA5tn0bAi7CJ4PjaemxvTGw== X-Received: by 2002:a2e:8e99:: with SMTP id z25mr3822412ljk.146.1621337222883; Tue, 18 May 2021 04:27:02 -0700 (PDT) Received: from localhost.localdomain (dc7vkhyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16e2:8300::1]) by smtp.gmail.com with ESMTPSA id b24sm2254340lff.93.2021.05.18.04.27.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 04:27:02 -0700 (PDT) Date: Tue, 18 May 2021 14:26:55 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Mark Brown , Kees Cook , Andy Shevchenko , Zhang Rui , Guenter Roeck , "agross@kernel.org" , "devicetree@vger.kernel.org" , linux-power , "linux-kernel@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" , "bjorn.andersson@linaro.org" , "lgirdwood@gmail.com" , "robh+dt@kernel.org" Subject: [PATCH v10 05/11] regulator: move rdev_print helpers to internal.h Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The rdev print helpers are a nice way to print messages related to a specific regulator device. Move them from core.c to internal.h As the rdev print helpers use rdev_get_name() export it from core.c. Also move the declaration from coupler.h to driver.h because the rdev name is not just a coupled regulator property. I guess the main audience for rdev_get_name() will be the regulator core and drivers. Signed-off-by: Matti Vaittinen --- Changelog: - v10 New Patch. --- drivers/regulator/core.c | 12 +----------- drivers/regulator/internal.h | 11 +++++++++++ include/linux/regulator/coupler.h | 5 ----- include/linux/regulator/driver.h | 10 ++++++++++ 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index f192bf19492e..a8188f7e5072 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -33,17 +33,6 @@ #include "dummy.h" #include "internal.h" -#define rdev_crit(rdev, fmt, ...) \ - pr_crit("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) -#define rdev_err(rdev, fmt, ...) \ - pr_err("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) -#define rdev_warn(rdev, fmt, ...) \ - pr_warn("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) -#define rdev_info(rdev, fmt, ...) \ - pr_info("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) -#define rdev_dbg(rdev, fmt, ...) \ - pr_debug("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) - static DEFINE_WW_CLASS(regulator_ww_class); static DEFINE_MUTEX(regulator_nesting_mutex); static DEFINE_MUTEX(regulator_list_mutex); @@ -117,6 +106,7 @@ const char *rdev_get_name(struct regulator_dev *rdev) else return ""; } +EXPORT_SYMBOL_GPL(rdev_get_name); static bool have_full_constraints(void) { diff --git a/drivers/regulator/internal.h b/drivers/regulator/internal.h index 2391b565ef11..1e9c71642143 100644 --- a/drivers/regulator/internal.h +++ b/drivers/regulator/internal.h @@ -15,6 +15,17 @@ #define REGULATOR_STATES_NUM (PM_SUSPEND_MAX + 1) +#define rdev_crit(rdev, fmt, ...) \ + pr_crit("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) +#define rdev_err(rdev, fmt, ...) \ + pr_err("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) +#define rdev_warn(rdev, fmt, ...) \ + pr_warn("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) +#define rdev_info(rdev, fmt, ...) \ + pr_info("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) +#define rdev_dbg(rdev, fmt, ...) \ + pr_debug("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) + struct regulator_voltage { int min_uV; int max_uV; diff --git a/include/linux/regulator/coupler.h b/include/linux/regulator/coupler.h index 5f86824bd117..73291f280a23 100644 --- a/include/linux/regulator/coupler.h +++ b/include/linux/regulator/coupler.h @@ -52,7 +52,6 @@ struct regulator_coupler { #ifdef CONFIG_REGULATOR int regulator_coupler_register(struct regulator_coupler *coupler); -const char *rdev_get_name(struct regulator_dev *rdev); int regulator_check_consumers(struct regulator_dev *rdev, int *min_uV, int *max_uV, suspend_state_t state); @@ -69,10 +68,6 @@ static inline int regulator_coupler_register(struct regulator_coupler *coupler) { return 0; } -static inline const char *rdev_get_name(struct regulator_dev *rdev) -{ - return NULL; -} static inline int regulator_check_consumers(struct regulator_dev *rdev, int *min_uV, int *max_uV, suspend_state_t state) diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 4ea520c248e9..7ec0fa79d1a8 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -550,4 +550,14 @@ int regulator_desc_list_voltage_linear_range(const struct regulator_desc *desc, int regulator_desc_list_voltage_linear(const struct regulator_desc *desc, unsigned int selector); + +#ifdef CONFIG_REGULATOR +const char *rdev_get_name(struct regulator_dev *rdev); +#else +static inline const char *rdev_get_name(struct regulator_dev *rdev) +{ + return NULL; +} +#endif + #endif