From patchwork Mon Dec 3 21:42:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinh Nguyen X-Patchwork-Id: 152782 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp7325867ljp; Mon, 3 Dec 2018 13:42:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/XsOruu373+LGX8Jx3CknLqoWAVlBCwUD6tfs6aIRYQK36Ctstjs5pzs537wmuD20QOt3gw X-Received: by 2002:a63:f811:: with SMTP id n17mr15018419pgh.23.1543873348984; Mon, 03 Dec 2018 13:42:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543873348; cv=none; d=google.com; s=arc-20160816; b=t36LkCggx/pqEa4ORW51lF1hJ2ZUZwGqMtEW3XVzXL1M82v2vzhEiZYT0OzNzg0r+n bBoTj+tt4yh1j2G7m3AQ/r/xVW5H5jjackXKn0k6UQdxUE1gr63vUnNjcFBDygyFl9kR FvB+41tCaMGyhFGbLrJFr1l1zQYV9RQoL3E9xrFI6Yjvel3WJrTDNNRtEMkM6fEo4ujv bSQlWHeJGo6GSPrZU1x3PLja96F6G1A7iSj1NxM1rH5HR5p1gB2dQOMnbiQyJTCn4cw4 4SaPaZqOjeLUE/xiw02vSH4QhUrh2Tg/dGAV9YaVXy0FzdMkf4M8VOPmeiGB5Pa+b0hi uTxA== 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:dkim-signature; bh=s9ZthRZtpT4M3RQm+6gvNDfhX5BRr1I8rvTYc/1B4u4=; b=VMQB5X2tsiaajnXKcX6yaJilKTNCw1Sis1Zoq/bgf/oVSZDAB067dkaiprEyCK333d XtNJnf3iX+tTP40dihOfBzabVYjWsRWv4NtC5uY39gIRIQBK/9JNHIC/libr7lfTdTko H6rWOqR8+0VlbLJ9WzgZm6jPgNtm+4e87FW/eB8H86ErbHUAvuVN+Nt7Rz2J0xWABKfm Ia9njZwziMUA2Q8Zj1Y7mCQWqHOiCFyznLJAhFD48bYjxkZl7EVZR+ng+HZRJ8NkNdwR Bt/teNtB/YPwLu7CZx3g3eBjWkkjlxWJhkaDxti2Zu5ZKs5vvRZ/fzzchCn4IC7JGowb 6YJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r5cZD4R7; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi2si14671055plb.200.2018.12.03.13.42.28; Mon, 03 Dec 2018 13:42:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=@kernel.org header.s=default header.b=r5cZD4R7; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725952AbeLCVm2 (ORCPT + 15 others); Mon, 3 Dec 2018 16:42:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:50000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725972AbeLCVm2 (ORCPT ); Mon, 3 Dec 2018 16:42:28 -0500 Received: from localhost.localdomain (cpe-70-114-128-244.austin.res.rr.com [70.114.128.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 989B620864; Mon, 3 Dec 2018 21:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543873347; bh=Hkn1cjzkI1ANGZkDNKdZsM21kWfqV4MsegA+Y5dZ57I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r5cZD4R7bbG5Pi/CrAOqPQJkiDY4u3c1h4Dk7Zv8C71UqFxxg1LhxbGphj1b6eW01 d2k7TMlN0yXECtUoE1q9UGuJG3p13BWWjNZB0pdTek0r4qqrcFs9kZUhxmkBz7cadp YXgk8BrXyZ7j/5jZ2MMiV6dIjbmBaC2eLEzlMofg= From: Dinh Nguyen To: stable@vger.kernel.org Cc: dinguyen@kernel.org, gregkh@linuxfoundation.org, sashal@kernel.org, Masahiro Yamada , Philipp Zabel Subject: [PATCH for v4.19-stable 5/6] reset: make device_reset_optional() really optional Date: Mon, 3 Dec 2018 15:42:13 -0600 Message-Id: <20181203214214.28612-5-dinguyen@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181203214214.28612-1-dinguyen@kernel.org> References: <20181203214214.28612-1-dinguyen@kernel.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masahiro Yamada commit 1554bbd4ad401b7f0f916c0891874111c10befe5 upstream. 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 Signed-off-by: Philipp Zabel --- drivers/reset/core.c | 9 +++++---- include/linux/reset.h | 28 +++++++++++++--------------- 2 files changed, 18 insertions(+), 19 deletions(-) -- 2.17.1 diff --git a/drivers/reset/core.c b/drivers/reset/core.c index e8cb31616c3e..188205a55261 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -410,17 +410,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); @@ -430,4 +431,4 @@ int device_reset(struct device *dev) return ret; } -EXPORT_SYMBOL_GPL(device_reset); +EXPORT_SYMBOL_GPL(__device_reset); diff --git a/include/linux/reset.h b/include/linux/reset.h index 13d8681210d5..61a0dda3f981 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -19,17 +19,11 @@ 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); - -static inline int device_reset_optional(struct device *dev) -{ - return device_reset(dev); -} - #else static inline int reset_control_reset(struct reset_control *rstc) @@ -56,15 +50,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( @@ -91,6 +79,16 @@ static inline struct reset_control *__devm_reset_control_get( #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.