From patchwork Sat Oct 28 16:50:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 117397 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp764273qgn; Sat, 28 Oct 2017 09:51:07 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TniflHxpRZRv1F6r1PzCW0fpNgdqJ6kPTCh/oe24TmJx6rIsqvToBq8iALog9wQBBR6OBM X-Received: by 10.99.185.79 with SMTP id v15mr3416792pgo.258.1509209467476; Sat, 28 Oct 2017 09:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509209467; cv=none; d=google.com; s=arc-20160816; b=om7J3OvHbXn1blrouj+vnRs2f5L/nK/BdryQcYhUNT4oJENq2QOkolfwEVEBJCUe0U fyLnFyukSf3NNAKU+TS5yojG12stx0zHyGo3eIyYK97mUOtFdlr2tMzHH/2VJKhYQ4dO /bFTKh8Xh5LFgrUyV2EA+WjA7RPEzZMc5KZcPIZlO1Ox76KznXQW9Z/f3Vyb+pwD9cNQ GJk4Fykkw92lM/ehvbGnkkgZPZ6tB4Yldn80yl0FdaA8db8y+Izq147lwUH7hYPd0d4I Rf83OL7N/Oi9KB5/HMvTfBwinUmZqouKIQRs7irGlHxAZ6267CRX6Ygi+pWmEx9TtBTl V6DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=zSKh6a8wvHiBzKy5yWjhISc1km1w6wTPMo1nqtlWsp8=; b=om0X9WJmbSHe0H6S8A7c/CEol35+f81tSoIz4SbxoXlYxtYjD0hdLI0ck1VUDOgrN3 snHRsFNjSIilNy93MEbnEk+eV8jg+/hWnRu7ERCF/JOPdlMhyYArET12I2y0gWf6QukW 9JVDSfrdrdw6wGYLmsq133j6+Ai8wkHUMze7dNsJn6PnQKLRD2o2RJswVDWUESDHWzZV kdzxi+J1Sznc46RtdcbsTkoVNYGOA4BFpnn73H12CMKWbpydv01zhzCvLTGMhUYgNNKb 3jmyF1j5DU+9yhxy4v4jzLQiCu/FJ5bVj4nsIenhVesT+4rH8eWIOrEP0FqyyaKX90IG eenA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=v97+PGNu; 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 204si1410018pgc.742.2017.10.28.09.51.07; Sat, 28 Oct 2017 09:51:07 -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 header.s=dec2015msa header.b=v97+PGNu; 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 S1751566AbdJ1QvE (ORCPT + 27 others); Sat, 28 Oct 2017 12:51:04 -0400 Received: from conuserg-12.nifty.com ([210.131.2.79]:39213 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751270AbdJ1QvB (ORCPT ); Sat, 28 Oct 2017 12:51:01 -0400 Received: from grover.sesame (FL1-122-131-185-176.osk.mesh.ad.jp [122.131.185.176]) (authenticated) by conuserg-12.nifty.com with ESMTP id v9SGoDXF021928; Sun, 29 Oct 2017 01:50:13 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com v9SGoDXF021928 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1509209414; bh=zSKh6a8wvHiBzKy5yWjhISc1km1w6wTPMo1nqtlWsp8=; h=From:To:Cc:Subject:Date:From; b=v97+PGNudS+o/cs5H+Dg5aMgIbUBGI4Nx7miT+TXKp47CStgEDft5aXYXV8b0wnEy R/exmldbtQes4ZMw4RmM1wQT76ZxYjggEJs029XNWRmMNOfIKU2sJ+l9GHV+L6MaPQ hr2GY3t8LFMh8ye5j9HbUoY//g2V5Xe8IK012mJtAVlUc0R93WotG1s78l4M3AXMrz A+gtzt231V/3Lpbl0djIhbj2UaOCZpwWABtcwnvXym+k8eb5gvZMV4NcLF2aFNaoI3 hKCE52Vrt+ZNpdE33pNaHMO9siifLIATqhAuPyEMKE6Mt3kxL9cai3Huoh9QdAC34w A7DsLqx58HZnQ== X-Nifty-SrcIP: [122.131.185.176] From: Masahiro Yamada To: Philipp Zabel Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 1/4] reset: make device_reset_optional() really optional Date: Sun, 29 Oct 2017 01:50:06 +0900 Message-Id: <1509209409-2698-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit bb475230b8e5 ("reset: make optional functions really optional") converted *_get_optional* functions, but device_reset_optional() was left behind. Convert it in the same way. Signed-off-by: Masahiro Yamada --- drivers/reset/core.c | 9 +++++---- include/linux/reset.h | 28 +++++++++++++--------------- 2 files changed, 18 insertions(+), 19 deletions(-) -- 2.7.4 diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 1d21c6f..da4292e 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -566,17 +566,18 @@ EXPORT_SYMBOL_GPL(__devm_reset_control_get); * device_reset - find reset controller associated with the device * and perform reset * @dev: device to be reset by the controller + * @optional: whether it is optional to reset the device * - * Convenience wrapper for reset_control_get() and reset_control_reset(). + * Convenience wrapper for __reset_control_get() and reset_control_reset(). * This is useful for the common case of devices with single, dedicated reset * lines. */ -int device_reset(struct device *dev) +int __device_reset(struct device *dev, bool optional) { struct reset_control *rstc; int ret; - rstc = reset_control_get(dev, NULL); + rstc = __reset_control_get(dev, NULL, 0, 0, optional); if (IS_ERR(rstc)) return PTR_ERR(rstc); @@ -586,7 +587,7 @@ int device_reset(struct device *dev) return ret; } -EXPORT_SYMBOL_GPL(device_reset); +EXPORT_SYMBOL_GPL(__device_reset); /** * APIs to manage an array of reset controls. diff --git a/include/linux/reset.h b/include/linux/reset.h index 56463f3..c2fe7b6 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -19,22 +19,16 @@ struct reset_control *__reset_control_get(struct device *dev, const char *id, int index, bool shared, bool optional); void reset_control_put(struct reset_control *rstc); +int __device_reset(struct device *dev, bool optional); struct reset_control *__devm_reset_control_get(struct device *dev, const char *id, int index, bool shared, bool optional); -int __must_check device_reset(struct device *dev); - struct reset_control *devm_reset_control_array_get(struct device *dev, bool shared, bool optional); struct reset_control *of_reset_control_array_get(struct device_node *np, bool shared, bool optional); -static inline int device_reset_optional(struct device *dev) -{ - return device_reset(dev); -} - #else static inline int reset_control_reset(struct reset_control *rstc) @@ -61,15 +55,9 @@ static inline void reset_control_put(struct reset_control *rstc) { } -static inline int __must_check device_reset(struct device *dev) +static inline int __device_reset(struct device *dev, bool optional) { - WARN_ON(1); - return -ENOTSUPP; -} - -static inline int device_reset_optional(struct device *dev) -{ - return -ENOTSUPP; + return optional ? 0 : -ENOTSUPP; } static inline struct reset_control *__of_reset_control_get( @@ -108,6 +96,16 @@ of_reset_control_array_get(struct device_node *np, bool shared, bool optional) #endif /* CONFIG_RESET_CONTROLLER */ +static inline int __must_check device_reset(struct device *dev) +{ + return __device_reset(dev, false); +} + +static inline int device_reset_optional(struct device *dev) +{ + return __device_reset(dev, true); +} + /** * reset_control_get_exclusive - Lookup and obtain an exclusive reference * to a reset controller.