Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10784816imu; Thu, 6 Dec 2018 06:47:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/WUwnmDLE3NjT1dmRplArd4BXz6/n1qrx0740LusUgqNJES9D9FzJvjilt0QFS6V+7Hby1x X-Received: by 2002:a63:f710:: with SMTP id x16mr23227212pgh.322.1544107644549; Thu, 06 Dec 2018 06:47:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544107644; cv=none; d=google.com; s=arc-20160816; b=0zddQ30wgmAYczinWNNqyirmfJpmPJDk5WzSfW11aBHS1sdsX5SODd5Rnu+mFAXgO7 Ff8cH9pJYPNKOSjXggEKizRszm7zEyLVbAxIv5iB5CZL9tx14n1LDsEjGcfuRXGi4IFa /nybjOAD1NLQbrEb0dNxbzM35aloh8j+7uJUwNs3OlMnVQ8jUXdN6/xOHmL4sJRTlQL+ IqBYasmkkM0kmSoNRFf3L6PfiIV/qLMx/pXtsIFcGa/izLE7Egpu4DlFG5JEHELzgKro MlycJiDA8l4Fpq/VNU040YfwnvBn24PTNShwDVnBjEzkQfDRcGuS/2Evw82w6vMhxaIF rCMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F105URpU7iU8rPaHSrjQ8LtYVtJV9srsrYv3oS6d8OU=; b=XvJxmhrWulCawKZqkbH5/zC1PItLW8X0XmjNufxlpUlh1nGNt5PtAbbyc1F2Kd7jJU oHM8Fj3qfmI78L74Sn4g0uMvMCZROIp3d0uPDL51YrM3pWFwxSudUGkPvjB8PFZQ3/d/ xSNkXxJ/ANam3UZBMBl34Bbj7LrjSqP1w0RtIf/rL/zPMSHsSqBkelcSRFz2FO7YzN1R 3ZfAqcTWoEJt2dfMdIK8/JE4x0NlXWohDKrmnmbV6CFeTauQ85v9thLtul3QYZUQ1fmE j0u2txI9u+OKCBjuaIjN/gdmDEL26ltD/y5S3Z1ICCTnXBzK3lZ0GKLxDv3XS/vpIes2 hAuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vChlvcmX; 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 d13si384083plr.403.2018.12.06.06.47.09; Thu, 06 Dec 2018 06:47:24 -0800 (PST) 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=@kernel.org header.s=default header.b=vChlvcmX; 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 S1730637AbeLFOnU (ORCPT + 99 others); Thu, 6 Dec 2018 09:43:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:47638 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730626AbeLFOnQ (ORCPT ); Thu, 6 Dec 2018 09:43:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 75A2A20661; Thu, 6 Dec 2018 14:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544107395; bh=0lNH7FkmUjViX0GGjENFXcKTbvWVrgDEOdRmaz9kEVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vChlvcmX7g5gfT3CgnGxuCDeBafTDuqH8JQqglARjhgvBvbRZxmpLlYc0UWGVX4wx Be3OJZJpyjCX3uZL+Xfm4UQlAKarz/WyQU0WzbnkbeVTT1ewIBt3Uz/xfbvAv+KczA zfESomLwwV/MDSjYml0zxDWvY16EmnFE6NSFFYiU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Philipp Zabel , Dinh Nguyen Subject: [PATCH 4.14 45/55] reset: make device_reset_optional() really optional Date: Thu, 6 Dec 2018 15:39:19 +0100 Message-Id: <20181206143004.179442054@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181206143001.749982936@linuxfoundation.org> References: <20181206143001.749982936@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Cc: Dinh Nguyen Signed-off-by: Greg Kroah-Hartman --- drivers/reset/core.c | 9 +++++---- include/linux/reset.h | 28 +++++++++++++--------------- 2 files changed, 18 insertions(+), 19 deletions(-) --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -566,17 +566,18 @@ EXPORT_SYMBOL_GPL(__devm_reset_control_g * 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. --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -20,22 +20,16 @@ struct reset_control *__reset_control_ge 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) @@ -62,15 +56,9 @@ static inline void reset_control_put(str { } -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, bool optional) { - return -ENOTSUPP; + return optional ? 0 : -ENOTSUPP; } static inline struct reset_control *__of_reset_control_get( @@ -109,6 +97,16 @@ of_reset_control_array_get(struct device #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.