From patchwork Tue Dec 4 15:34:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinh Nguyen X-Patchwork-Id: 152818 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp8202519ljp; Tue, 4 Dec 2018 07:35:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/WYkj46F4camejI+TM61ko+0abaXp29Wa4kaY7rg4j1mAtWA3VDnkNHqa+R8KnDh+gM0/ru X-Received: by 2002:a62:f54f:: with SMTP id n76mr20498610pfh.59.1543937718103; Tue, 04 Dec 2018 07:35:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543937718; cv=none; d=google.com; s=arc-20160816; b=BZRf83PeRhJKEIsjD6/LwEXyEat29GSUXGDfwBNgVFa9mLE99HTfGRw1XxzyjXs/Kk zLYXZDX7a6bH9dQEmm7A8U35ZEBHZHxoL547okMsaqvxrcvETvw+DgnPpV1ak4aTpZNQ bmgAV3asTMGAuQRcoSbkaueW0ITOGLXhHj8Rr0ew6PJuNomobye968FvXrsi2AlsynqY DyVIHk5OcQr9Fi0o0Be7XGEmttisCqqB9mIzqSSzTx3yUXm6c/4oVmqZqOUqwigX4DOt Ft95boIPU+dhRVhb9sla1KiqgyMvT+XQf0bWkK2kyTsfxxpAoMY5ihZmgCO2dlkqQvTg i6Dg== 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=IRNkfgwoJydiZpD+T7fTmAcxJkJ3pge1vNiWYnaoKWcaDQcXjx8M8c/JF/6z9UiWOs L3c6Lz7LeHM+ZW/rWIZB94Tkm5fbYEPW5j0+jt+zf94yBc0MR7PEAjHLqkHxeQIFdZpy +SBRU9Ms7zQVTf/0W8rrmfFE0tUlfcHI45czf8Vkn/E5VfCT1d0SNcCZcvoUq5gk1MLy kUwBfbRNSMP5BXo7Q/tghlRUMUMcD+bIBaG9FUpC/9ri/da0xNkGPsvIuOC3BVz3F2x6 q1qp5K99FSJ4LzDtI4TjYOVGOG/ILT0cGGmJhHuoxEyn5yjsLyYy51Rkaan5duTFh8UL pLOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JsMR4ZGq; 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 bd3si16712495plb.286.2018.12.04.07.35.17; Tue, 04 Dec 2018 07:35:18 -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=JsMR4ZGq; 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 S1726823AbeLDPfR (ORCPT + 15 others); Tue, 4 Dec 2018 10:35:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:39742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726813AbeLDPfQ (ORCPT ); Tue, 4 Dec 2018 10:35:16 -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 481CA2082B; Tue, 4 Dec 2018 15:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543937715; bh=Hkn1cjzkI1ANGZkDNKdZsM21kWfqV4MsegA+Y5dZ57I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JsMR4ZGqIV4KUiNyIdgP7ft9R9qBB1M0EDHeC4elChMlEx8UdcREZHrVDBeT38Noa vMwnQJUgwq/hk+GtNxun93VrCVzsNwrAyWRGOqJ4SMql1/K53/BFTXwpc9OZSWppdo cZTevoZrRBRpxfBffshKaIqhGyIMvGGMT0KItSNo= From: Dinh Nguyen To: stable@vger.kernel.org Cc: dinguyen@kernel.org, gregkh@linuxfoundation.org, sashal@kernel.org, Masahiro Yamada , Philipp Zabel Subject: [PATCHv2 for v4.19-stable 5/6] reset: make device_reset_optional() really optional Date: Tue, 4 Dec 2018 09:34:47 -0600 Message-Id: <20181204153448.6189-6-dinguyen@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181204153448.6189-1-dinguyen@kernel.org> References: <20181204153448.6189-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.