Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp129644ybz; Fri, 24 Apr 2020 13:03:59 -0700 (PDT) X-Google-Smtp-Source: APiQypKxY2w+Py884LsOh+qXWlWCPQpNm4dWZB0nqmsZZePxAURjvZ5nCsMDXDXHx42keBweTGOH X-Received: by 2002:a17:906:7f0c:: with SMTP id d12mr8521639ejr.40.1587758639167; Fri, 24 Apr 2020 13:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587758639; cv=none; d=google.com; s=arc-20160816; b=q3GKUYfSA/5wN0dw/UdhLWfSNMeq9m67bkmE4arO2hWd01/zH86Q6V12r7WOFkRCha twWcie9asUuzhZaDLmVWYAeQOblfB78FzKpvPOKS6sGP9Q+gASn+0uMJIvVXVJYiIlsS y7Dti4R0umpD8sVBGnfyCSfm/aG/V7o1FREP7/l4voBDd9AeUirzSGeZ0liVEJn3I94Q zd79o6iG5Y0Tgt7PBXuXrtqijVG7IIY507m0JY4hqKlD7kwdW6n0ckhY0Ar+WJl0ve6k MK3yDikuW37MleAfvsIvqM7GhwqMR5BqaKhZ9eT1E7U+72DD3FGqgb+kgVbOFi/9G0Zz wFeg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FBdqDq0VMaj7zwangCHWNwKrKJkwsKj44UAlSOD4+hI=; b=Dnr9XDbw8Qyp+BBg9XzldDvGfh1gqDYtM2v+z+zzYpLrBpYHA1whm0e3f11mfGvu42 BmjPo4aE3xYD7qrQbYGb5gcpdtpAEJ7G2QcQvYdYQoaIVArJA1aBaUh18r6DhnKbaRfv 69QiPxKyhKRnCuHc0oC6dd0iRk2MVV9gLQ3SEwBvhxoo8izMlLDSh4k+EeGM0xEz0x0D smVbvilp0LcE6oEFYSJRHj8UHICWhm06nV12WhoORbBb65G5Q1xaTPwydoQFIprAMktf HRcVuoAXhefoH19C6R/4b7iJfmYT49KWMCutro+VA6zQxLuFPVSEDFOHyIge+M7Mp5bg Gjbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d7r4l7Na; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si2826370edr.270.2020.04.24.13.03.23; Fri, 24 Apr 2020 13:03:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d7r4l7Na; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729485AbgDXUBx (ORCPT + 99 others); Fri, 24 Apr 2020 16:01:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729430AbgDXUBr (ORCPT ); Fri, 24 Apr 2020 16:01:47 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FB5CC09B048 for ; Fri, 24 Apr 2020 13:01:47 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id h12so2929672pjz.1 for ; Fri, 24 Apr 2020 13:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FBdqDq0VMaj7zwangCHWNwKrKJkwsKj44UAlSOD4+hI=; b=d7r4l7Na8FJeJ/BgUKfyHxZF4kOAr524AMcWcrx7Wl+nAP2MT1cVwKm/K0x9jC+E9V wjGCifTbwvuY97Xaq96AhpZHGRgLSPU3cdsjiiqXcQ7aW/+RmZcf82B+NWqq25RYCYDH EkbZxXecCLTk5//7lSBZE5YfxTyslPWOt3vMrME4zrLiOeJ1eeuFoHg0YEGdi7d0ImDy VNNmm0xrZIv5JnoW0JgPK4uHDhhlOqdaciDoHtcwPTvR3w8NQMWPAEdRVNuSkIOxGc76 O7g7EYBKtLjvfVeEw1Z42FjkUEqCMV+Kr1HT65HBvr86KoVlBJ+v713FQhFQq2UTZdSA NSyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FBdqDq0VMaj7zwangCHWNwKrKJkwsKj44UAlSOD4+hI=; b=JlUvkID6loA7JXY9zBANCSg4vE6dPpU5Gxd4feERg4uKONlitqTldc8DMVD+/h5TKH KMYvlrLyT7ugAoQMJ2oVKVVGzw5im2xTzX2wgzUqMNN57dzgBn9YzGTun4TseE6S57WI y0OsjqgtBaNn6dTw9oTpj6bt3GfU5hgiWPXJW7KumCUVOiIBaQfHqHjTgI4Lvl0t5QRg JRFuwiCCkWJuuOVi9ftIMM/qLVcVVCuZvkN7/kH8B8eZPT4l4EJnpCgLwdVSY6w6ZEo4 td1tASCrw+kQGVdhSu3mKApmhn0v5Bs6Y+b118nydq4KbtcwIh9s2GsXZSCfVwl5QFoZ UbFA== X-Gm-Message-State: AGi0PubZ86JvRs8ZXb69OpSbMz9r6j5VkRN0DxlHgAVpvnSxBknOxbw0 5elALnustVpOwuegVja9SXmO2g== X-Received: by 2002:a17:90a:a591:: with SMTP id b17mr8308969pjq.90.1587758506525; Fri, 24 Apr 2020 13:01:46 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id o11sm5532224pgd.58.2020.04.24.13.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 13:01:46 -0700 (PDT) From: Mathieu Poirier To: bjorn.andersson@linaro.org, ohad@wizery.com Cc: loic.pallardy@st.com, arnaud.pouliquen@st.com, s-anna@ti.com, linux-remoteproc@vger.kernel.org, corbet@lwn.net, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 07/14] remoteproc: Introducting new start and stop functions Date: Fri, 24 Apr 2020 14:01:28 -0600 Message-Id: <20200424200135.28825-8-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200424200135.28825-1-mathieu.poirier@linaro.org> References: <20200424200135.28825-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add new functions to replace direct calling of rproc->ops->start() and rproc->ops->stop(). That way different behaviour can be played out when booting a remote processor or synchronising with it. Signed-off-by: Mathieu Poirier --- drivers/remoteproc/remoteproc_core.c | 6 +++--- drivers/remoteproc/remoteproc_internal.h | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 9de0e2b7ca2b..ef88d3e84bfb 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1339,7 +1339,7 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) } /* power up the remote processor */ - ret = rproc->ops->start(rproc); + ret = rproc_start_device(rproc); if (ret) { dev_err(dev, "can't start rproc %s: %d\n", rproc->name, ret); goto unprepare_subdevices; @@ -1360,7 +1360,7 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) return 0; stop_rproc: - rproc->ops->stop(rproc); + rproc_stop_device(rproc); unprepare_subdevices: rproc_unprepare_subdevices(rproc); reset_table_ptr: @@ -1493,7 +1493,7 @@ static int rproc_stop(struct rproc *rproc, bool crashed) rproc->table_ptr = rproc->cached_table; /* power off the remote processor */ - ret = rproc->ops->stop(rproc); + ret = rproc_stop_device(rproc); if (ret) { dev_err(dev, "can't stop rproc: %d\n", ret); return ret; diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 47b500e40dd9..dda7044c4b3e 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -125,6 +125,22 @@ struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc, return NULL; } +static inline int rproc_start_device(struct rproc *rproc) +{ + if (rproc->ops && rproc->ops->start) + return rproc->ops->start(rproc); + + return 0; +} + +static inline int rproc_stop_device(struct rproc *rproc) +{ + if (rproc->ops && rproc->ops->stop) + return rproc->ops->stop(rproc); + + return 0; +} + static inline bool rproc_u64_fit_in_size_t(u64 val) { -- 2.20.1