From patchwork Tue Aug 16 14:26:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 74019 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp2035852qga; Tue, 16 Aug 2016 07:29:31 -0700 (PDT) X-Received: by 10.66.76.9 with SMTP id g9mr64082379paw.51.1471357771610; Tue, 16 Aug 2016 07:29:31 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si8995534pae.122.2016.08.16.07.29.31; Tue, 16 Aug 2016 07:29:31 -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; dkim=pass header.i=@nifty.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 S1753301AbcHPO33 (ORCPT + 27 others); Tue, 16 Aug 2016 10:29:29 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:26640 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455AbcHPO32 (ORCPT ); Tue, 16 Aug 2016 10:29:28 -0400 Received: from grover.sesame (FL1-119-242-215-193.osk.mesh.ad.jp [119.242.215.193]) (authenticated) by conuserg-07.nifty.com with ESMTP id u7GER7Rw010734; Tue, 16 Aug 2016 23:27:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com u7GER7Rw010734 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1471357641; bh=Lm3jhg5FtoUr/v9WjwM0ovMR5muk3QFqYmTRsDZUFe4=; h=From:To:Cc:Subject:Date:From; b=jYK1UiH+EV3sYnEskImAO4QDAeNnpr4BYd+AUpABXeV/PO5pEwLJvQOwY4aQt31p7 rEaFPWNX/9lCsHpShvS+Xhuftur5nhVSzj7OtNP5HIdTI7+g+VkO0g+OUshMryg9OS Jfzgmic3y/2Hj+4nJ2kwAycj1ErduFEqNR2W2okrufghSzUK2qE4p14TKyeMgbTMBj H34wQn5W0ubBkyOxkTLvwWSfYawMJD4YZ9+RuAeNlzUHMAFyrmhpLp8g82dQGLpWGb fgS0SAkAhIi59yRNVUy4DWO8wiC5NKmSyLQyBU410gX6gqIRkIWZhdBabcdLvDJMvZ 9TVD47vEspQ3w== X-Nifty-SrcIP: [119.242.215.193] From: Masahiro Yamada To: linux-kernel@vger.kernel.org, Philipp Zabel Cc: Hans de Goede , Arnd Bergmann , Axel Lin , Marek Vasut , Lee Jones , Masahiro Yamada Subject: [PATCH] reset: prepare to deprecate _optional APIs Date: Tue, 16 Aug 2016 23:26:59 +0900 Message-Id: <1471357620-21903-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the reset control sub-system was initially supported, there were no stubs, so none of reset consumers could be built without CONFIG_RESET_CONTROLLER defined. The motivation for this was to prevent the misconfigured kernel from being generated. Then, commit b424080a9e08 ("reset: Add optional resets and stubs") added some APIs with stubs for drivers that want reset controlling, but are still functional without it. The initial motivation was lost when commit 5bcd0b7f3c56 ("reset: Add (devm_)reset_control_get stub functions") added stubs also for non-optional APIs for the purpose of compilation test coverage. Since then, the difference between with/without _optional is the WARN_ON(1) that makes the console log louder when a misconfigured kernel is running. As discussed in [1], we did not see the value of the additional run-time warning for reset_control_get, where every caller checks the returned error code. This commit removes WARN_ON(1) to let all drivers migrate to non- optional reset_control_get variants. The _optional variants will be kept as aliases of the non-optional ones in the meantime. [1] http://marc.info/?t=146927313100001&r=1&w=2 Signed-off-by: Masahiro Yamada --- This commit intends to replace commit 289363fd99a17d6249ee1373541f1da43cbb22c5 ("reset: add WARN_ON(1) to non-optional reset_control_get variants") in the reset/next branch. include/linux/reset.h | 84 ++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 48 deletions(-) -- 1.9.1 diff --git a/include/linux/reset.h b/include/linux/reset.h index 5daff15..39328c7 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -18,51 +18,35 @@ void reset_control_put(struct reset_control *rstc); struct reset_control *__devm_reset_control_get(struct device *dev, const char *id, int index, int shared); -int __must_check device_reset(struct device *dev); - -static inline int device_reset_optional(struct device *dev) -{ - return device_reset(dev); -} +int device_reset(struct device *dev); #else static inline int reset_control_reset(struct reset_control *rstc) { - WARN_ON(1); return 0; } static inline int reset_control_assert(struct reset_control *rstc) { - WARN_ON(1); return 0; } static inline int reset_control_deassert(struct reset_control *rstc) { - WARN_ON(1); return 0; } static inline int reset_control_status(struct reset_control *rstc) { - WARN_ON(1); return 0; } static inline void reset_control_put(struct reset_control *rstc) { - WARN_ON(1); } -static inline int __must_check device_reset(struct device *dev) -{ - WARN_ON(1); - return -ENOTSUPP; -} - -static inline int device_reset_optional(struct device *dev) +static inline int device_reset(struct device *dev) { return -ENOTSUPP; } @@ -101,9 +85,6 @@ static inline struct reset_control *__devm_reset_control_get( static inline struct reset_control * __must_check reset_control_get_exclusive(struct device *dev, const char *id) { -#ifndef CONFIG_RESET_CONTROLLER - WARN_ON(1); -#endif return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0); } @@ -135,18 +116,6 @@ static inline struct reset_control *reset_control_get_shared( return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1); } -static inline struct reset_control *reset_control_get_optional_exclusive( - struct device *dev, const char *id) -{ - return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 0); -} - -static inline struct reset_control *reset_control_get_optional_shared( - struct device *dev, const char *id) -{ - return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, 1); -} - /** * of_reset_control_get_exclusive - Lookup and obtain an exclusive reference * to a reset controller. @@ -249,9 +218,6 @@ static inline struct reset_control * __must_check devm_reset_control_get_exclusive(struct device *dev, const char *id) { -#ifndef CONFIG_RESET_CONTROLLER - WARN_ON(1); -#endif return __devm_reset_control_get(dev, id, 0, 0); } @@ -270,18 +236,6 @@ static inline struct reset_control *devm_reset_control_get_shared( return __devm_reset_control_get(dev, id, 0, 1); } -static inline struct reset_control *devm_reset_control_get_optional_exclusive( - struct device *dev, const char *id) -{ - return __devm_reset_control_get(dev, id, 0, 0); -} - -static inline struct reset_control *devm_reset_control_get_optional_shared( - struct device *dev, const char *id) -{ - return __devm_reset_control_get(dev, id, 0, 1); -} - /** * devm_reset_control_get_exclusive_by_index - resource managed * reset_control_get_exclusive() @@ -319,6 +273,40 @@ devm_reset_control_get_shared_by_index(struct device *dev, int index) /* * TEMPORARY calls to use during transition: * + * _optional variants will be deprecated. + */ +static inline int device_reset_optional(struct device *dev) +{ + return device_reset(dev); +} + +static inline struct reset_control *reset_control_get_optional_exclusive( + struct device *dev, const char *id) +{ + return reset_control_get_exclusive(dev, id); +} + +static inline struct reset_control *reset_control_get_optional_shared( + struct device *dev, const char *id) +{ + return reset_control_get_shared(dev, id); +} + +static inline struct reset_control *devm_reset_control_get_optional_exclusive( + struct device *dev, const char *id) +{ + return devm_reset_control_get_exclusive(dev, id); +} + +static inline struct reset_control *devm_reset_control_get_optional_shared( + struct device *dev, const char *id) +{ + return devm_reset_control_get_shared(dev, id); +} + +/* + * TEMPORARY calls to use during transition: + * * of_reset_control_get() => of_reset_control_get_exclusive() * * These inline function calls will be removed once all consumers