From patchwork Tue Jun 26 01:34:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139912 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4639705lji; Mon, 25 Jun 2018 18:35:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI+9CP0UZZSJqiusv+SMVy00+Oz61VpaUIH84KQlmKeRrsUDfDfZiZVynuuXSBbouffhRh4 X-Received: by 2002:a17:902:24a5:: with SMTP id w34-v6mr14643796pla.52.1529976915116; Mon, 25 Jun 2018 18:35:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529976915; cv=none; d=google.com; s=arc-20160816; b=FP31ORzOY96CGB7uXBjE7qMfyEELeDJNAhiWqdQjfpci0aZxxPjJQC32pDOWlgBAyu 4rJde1TcdyB3z1xAtXxnAUToqIPAr+Hof4an2H5ye7bWfpkk2Uv4trAq3lEzK3/SgFM4 pj8XDU75PAxp20y4XOmoC2I+7Ys1HZi2bLP643ErDx+s9S/hhh3i/xEeHXFRuu/lkFxv e2XqrvfdciUfr8Mv40TfEUMkPXFNHZ5QDmgolcYrQSmvrOnIYQvnn26vBZh62ULi2xLH gN3M1mU78G8wWOz1gbxEQ5hvek5coF+EuG3qM1Mlx56uT7t6hKlYMypyQghiKn7i71cn RZMg== 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:arc-authentication-results; bh=At01+zlppAHzv2kYNufv49tmZevIJdLwkZ64Y6dFay8=; b=TnTVzQtbR7lFYNyeL002KrSLp791t5iJ8yH0JUcahXokANYFc9cZBAC2YhJNxYwUj+ 8ePG8ulXEkWW+PAsac2vtdX9+xNyOZhoTA2lGf0TLvdUyzfDtGI3TpJwgYEOYVsGKwQp kZG9mc/E3Z4oQJXxZgObhh6r7FJf64m3I0/A4R9lGdEHtB7js+WcEF0e/XWCQuTU5XqS ArkCnVGCUtl6TekQOXVy3vWrmt6iiFVKstjKIL4yrKQdMtYS71QEebuUqRQdnBlwfmVs WX59OVZiYBdRgeihAzzXkgdQW/ufQ/P8kz2qoxVZFmNbQEI4v9M+TDtkKPsaB7engUNM +8Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="j/LFOPtU"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b19-v6si360266pls.439.2018.06.25.18.35.14; Mon, 25 Jun 2018 18:35:15 -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=@linaro.org header.s=google header.b="j/LFOPtU"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935392AbeFZBfN (ORCPT + 31 others); Mon, 25 Jun 2018 21:35:13 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:55539 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935055AbeFZBeO (ORCPT ); Mon, 25 Jun 2018 21:34:14 -0400 Received: by mail-it0-f68.google.com with SMTP id 16-v6so15278095itl.5 for ; Mon, 25 Jun 2018 18:34:13 -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; bh=At01+zlppAHzv2kYNufv49tmZevIJdLwkZ64Y6dFay8=; b=j/LFOPtU8DO+umrMStbSSiJJyGGkMv8gTUlqLY2mq5CUHX9yfxJ4FrOvlZ0fJFrrHZ cym8K1fkEXi0kho12D0kxRm0+ULifCwOPBDBP0HJ+J0WUy6SdjCF4bVgxZ/iqbm2zG9b x22qod9rdXQqvhEMWcJ0PLT0Nb0qOxGp3LSIk= 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; bh=At01+zlppAHzv2kYNufv49tmZevIJdLwkZ64Y6dFay8=; b=ffqnEgDYXko405qfWZy3w5OWN4Xydz7m2INoLjc9yhgDL1+PFFRHWX7u98bOs9+Lhj 7apvqlIr+xqoW/VgpsF54+PBZmD4/9lPwTvjvfr42NKzmtNVKnNZLKm1LQdiFahnOq4Q zsBEJ9nbNB9LJvrUOPQwSHguU7Yk4CiRVUrIpL3vdwh85pYGxyTxN1+IusZcm3VuViRv ziZFTVuJJJA5FpJrKiVWxELJPGIFSyMwd+PSlUV7wi7CWzyjOuGAuT0PNDxI+lKHt8HW cobGUwfZJhfp/0JewSSjE10tcAcTkpDHCyzrEBhsCM8gPoOP1skwELQOPfH/Xqgs032p GVjQ== X-Gm-Message-State: APt69E2Q9Wwy4Cqonbqo+dda0b8bf0LeLJWdvq3Odcu+zfzaY1dxE4EQ 2Hhd4DDC41tHWZGn+/M0s+qupA== X-Received: by 2002:a02:105:: with SMTP id c5-v6mr3912816jad.139.1529976853301; Mon, 25 Jun 2018 18:34:13 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id h62-v6sm184699ioa.22.2018.06.25.18.34.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 18:34:12 -0700 (PDT) From: Alex Elder To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH resend 1/5] remoteproc: Rename subdev functions to start/stop Date: Mon, 25 Jun 2018 20:34:05 -0500 Message-Id: <20180626013409.5125-2-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626013409.5125-1-elder@linaro.org> References: <20180626013409.5125-1-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson "start" and "stop" are more suitable names for how these two operations are used, and they fit better with the upcoming introduction of two additional operations in the struct. [elder@linaro.org: minor comment edits] Signed-off-by: Bjorn Andersson Acked-by: Alex Elder Tested-by: Fabien Dessenne --- drivers/remoteproc/remoteproc_core.c | 30 ++++++++++++++-------------- include/linux/remoteproc.h | 14 ++++++------- 2 files changed, 22 insertions(+), 22 deletions(-) -- 2.17.1 Tested-by: Fabien Dessenne Signed-off-by: Bjorn Andersson Signed-off-by: Alex Elder diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index a9609d971f7f..5dd58e6bea88 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -774,13 +774,13 @@ static int rproc_handle_resources(struct rproc *rproc, return ret; } -static int rproc_probe_subdevices(struct rproc *rproc) +static int rproc_start_subdevices(struct rproc *rproc) { struct rproc_subdev *subdev; int ret; list_for_each_entry(subdev, &rproc->subdevs, node) { - ret = subdev->probe(subdev); + ret = subdev->start(subdev); if (ret) goto unroll_registration; } @@ -789,17 +789,17 @@ static int rproc_probe_subdevices(struct rproc *rproc) unroll_registration: list_for_each_entry_continue_reverse(subdev, &rproc->subdevs, node) - subdev->remove(subdev, true); + subdev->stop(subdev, true); return ret; } -static void rproc_remove_subdevices(struct rproc *rproc, bool crashed) +static void rproc_stop_subdevices(struct rproc *rproc, bool crashed) { struct rproc_subdev *subdev; list_for_each_entry_reverse(subdev, &rproc->subdevs, node) - subdev->remove(subdev, crashed); + subdev->stop(subdev, crashed); } /** @@ -901,8 +901,8 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) return ret; } - /* probe any subdevices for the remote processor */ - ret = rproc_probe_subdevices(rproc); + /* Start any subdevices for the remote processor */ + ret = rproc_start_subdevices(rproc); if (ret) { dev_err(dev, "failed to probe subdevices for %s: %d\n", rproc->name, ret); @@ -1014,8 +1014,8 @@ static int rproc_stop(struct rproc *rproc, bool crashed) struct device *dev = &rproc->dev; int ret; - /* remove any subdevices for the remote processor */ - rproc_remove_subdevices(rproc, crashed); + /* Stop any subdevices for the remote processor */ + rproc_stop_subdevices(rproc, crashed); /* the installed resource table is no longer accessible */ rproc->table_ptr = rproc->cached_table; @@ -1657,16 +1657,16 @@ EXPORT_SYMBOL(rproc_del); * rproc_add_subdev() - add a subdevice to a remoteproc * @rproc: rproc handle to add the subdevice to * @subdev: subdev handle to register - * @probe: function to call when the rproc boots - * @remove: function to call when the rproc shuts down + * @start: function to call after the rproc is started + * @stop: function to call before the rproc is stopped */ void rproc_add_subdev(struct rproc *rproc, struct rproc_subdev *subdev, - int (*probe)(struct rproc_subdev *subdev), - void (*remove)(struct rproc_subdev *subdev, bool crashed)) + int (*start)(struct rproc_subdev *subdev), + void (*stop)(struct rproc_subdev *subdev, bool crashed)) { - subdev->probe = probe; - subdev->remove = remove; + subdev->start = start; + subdev->stop = stop; list_add_tail(&subdev->node, &rproc->subdevs); } diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index dfdaede9139e..bf55bf2a5ee1 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -477,15 +477,15 @@ struct rproc { /** * struct rproc_subdev - subdevice tied to a remoteproc * @node: list node related to the rproc subdevs list - * @probe: probe function, called as the rproc is started - * @remove: remove function, called as the rproc is being stopped, the @crashed - * parameter indicates if this originates from the a recovery + * @start: start function, called after the rproc has been started + * @stop: stop function, called before the rproc is stopped; the @crashed + * parameter indicates if this originates from a recovery */ struct rproc_subdev { struct list_head node; - int (*probe)(struct rproc_subdev *subdev); - void (*remove)(struct rproc_subdev *subdev, bool crashed); + int (*start)(struct rproc_subdev *subdev); + void (*stop)(struct rproc_subdev *subdev, bool crashed); }; /* we currently support only two vrings per rvdev */ @@ -568,8 +568,8 @@ static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev) void rproc_add_subdev(struct rproc *rproc, struct rproc_subdev *subdev, - int (*probe)(struct rproc_subdev *subdev), - void (*remove)(struct rproc_subdev *subdev, bool crashed)); + int (*start)(struct rproc_subdev *subdev), + void (*stop)(struct rproc_subdev *subdev, bool crashed)); void rproc_remove_subdev(struct rproc *rproc, struct rproc_subdev *subdev); From patchwork Tue Jun 26 01:34:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139908 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4639103lji; Mon, 25 Jun 2018 18:34:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKkU3kfGGzeSItjgOIZ2jUA9JRX+ISukmBawXOMuu9GCy7L5GfETd44H/ZBbkxij1/qLkQD X-Received: by 2002:a63:b256:: with SMTP id t22-v6mr12924503pgo.101.1529976861464; Mon, 25 Jun 2018 18:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529976861; cv=none; d=google.com; s=arc-20160816; b=XxW9p/Yf0Svc/3SpihMyLZaNjbRwN0YYtldjGBANZrqmZ6Y4Wcdhs9+6D1Caxumw8q S8ZG+Oskkn0mvrcT/pQMZobk53B5CJezXYdk7EELY07z6DmjlY76wG8xNsU315liaUj7 o5PimDf5Lr59cSyAAAT9txZU3ygZVa9lHVx0qkziuTQp8wMa/GUHWUcAImF0bwvGgP7c ZsflgA/7VOEzEQGrcctrmpoqQyHxUVr56OTO1JPFwJ2hwJipJ/6eZfMEQHwBReacltb0 1AFFpjnHtedrVGtD3xulI7oK2qAwYvA6tAsB/Py7R4iLL6jaQsvKdrKZXPYYBHcBobsn GGBQ== 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:arc-authentication-results; bh=kEKesqqo+/X5Y1TJjKx05ALvbSOA18VpVMYr5WHzjvY=; b=O4/mIvJOaLrQ61F0f8jEj5D8fJ4Nti4VcV3EGVje9UXN5cUv3H1f/Rpc0JXlb9cpJi /A06hELrKiWeDoJY7f13CieaPd+3EpevinyUKSx5OmjeRlDG7zjghkY3LOF8GOD3MldR fm+xMEMW/5ThOZoDxcKYvJn+GhfRjCkjD7c7NBXeA1H4zO5GzBqe+SgRjyOFxP6YjUYR H+p4SY4z3TwnioTAFNGFEj5fBOYkHBwLuX1uEHZXqf1i11vs1SRuF1jaxbuAuf51q8pL 9/GFDSL7X1uQ63eCpuihxLlcSoYiBqNFBrcmpAOvfKUtYIwezqkgpPzroXWvUoQ16DKw sZ2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U3W6PbxJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c81-v6si409489pfj.138.2018.06.25.18.34.21; Mon, 25 Jun 2018 18:34:21 -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=@linaro.org header.s=google header.b=U3W6PbxJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935298AbeFZBeS (ORCPT + 31 others); Mon, 25 Jun 2018 21:34:18 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:38468 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935132AbeFZBeO (ORCPT ); Mon, 25 Jun 2018 21:34:14 -0400 Received: by mail-it0-f65.google.com with SMTP id v83-v6so15180698itc.3 for ; Mon, 25 Jun 2018 18:34:14 -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; bh=kEKesqqo+/X5Y1TJjKx05ALvbSOA18VpVMYr5WHzjvY=; b=U3W6PbxJjjMLlWRK/KUHAwp4zTcxydY6ckI2MEkktvhip6QD4rd1bh8wIjQR2cUrO5 cwlPv27/hrOeOnRTf8RfQTw13aFMy0GZeWQ1749Yg8J+EjnO2olrkOvh47VJS6TGUVfa qByDt8iZTsz1cNngVqJwBv1RFgF2PXYkLfXSY= 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; bh=kEKesqqo+/X5Y1TJjKx05ALvbSOA18VpVMYr5WHzjvY=; b=RzVmNOuD7yW8ok35HwGG1S8gfDB4qbj+PVTVt2xSwD+BSdVmiTJ3HOJnGfna9uUGiv vJGmi5u8J6WCBDrh+okL7Rv0AnLydnNLNkaUSxWLE2px9VQXSa2E13XhDnyFlaimrlTw iLbKJ6pBu8OqgH0Cnr9b0gc88QcmUoSu+Q4rgcoAvfo9O7nlDA8ZYzNCNCaVEU6jl8NC l6eO1jyj1VlBz6AaO44/3x7XNCFRfu61gd1BugSXUvPys4K5jiQysk/cev0M+eA5bdyO /auQOqel7D+J4sD57kiEt6VR5ruQIbLVwoKATgtKj11aaMfZ3xrUPoU8UmwhZgxIvX9A YB4Q== X-Gm-Message-State: APt69E1WzxQrKR2mjBULNq7wbFbadjAZ8nUbY+6cUvml7D/ub9p9sXDR 9vlK7cBzYyoQxR0hp/XsdcwFPQ== X-Received: by 2002:a02:a30f:: with SMTP id q15-v6mr9790170jai.66.1529976854238; Mon, 25 Jun 2018 18:34:14 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id h62-v6sm184699ioa.22.2018.06.25.18.34.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 18:34:13 -0700 (PDT) From: Alex Elder To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH resend 2/5] remoteproc: Make start and stop in subdev optional Date: Mon, 25 Jun 2018 20:34:06 -0500 Message-Id: <20180626013409.5125-3-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626013409.5125-1-elder@linaro.org> References: <20180626013409.5125-1-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson Some subdevices, such as glink ssr only care about the stop operation, so make the operations optional to reduce client code. Signed-off-by: Bjorn Andersson Acked-by: Alex Elder Tested-by: Fabien Dessenne --- drivers/remoteproc/remoteproc_core.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 5dd58e6bea88..981ae6dff145 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -780,16 +780,20 @@ static int rproc_start_subdevices(struct rproc *rproc) int ret; list_for_each_entry(subdev, &rproc->subdevs, node) { - ret = subdev->start(subdev); - if (ret) - goto unroll_registration; + if (subdev->start) { + ret = subdev->start(subdev); + if (ret) + goto unroll_registration; + } } return 0; unroll_registration: - list_for_each_entry_continue_reverse(subdev, &rproc->subdevs, node) - subdev->stop(subdev, true); + list_for_each_entry_continue_reverse(subdev, &rproc->subdevs, node) { + if (subdev->stop) + subdev->stop(subdev, true); + } return ret; } @@ -798,8 +802,10 @@ static void rproc_stop_subdevices(struct rproc *rproc, bool crashed) { struct rproc_subdev *subdev; - list_for_each_entry_reverse(subdev, &rproc->subdevs, node) - subdev->stop(subdev, crashed); + list_for_each_entry_reverse(subdev, &rproc->subdevs, node) { + if (subdev->stop) + subdev->stop(subdev, crashed); + } } /** From patchwork Tue Jun 26 01:34:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139911 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4639530lji; Mon, 25 Jun 2018 18:34:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIwVLkG5EH2Dqi00gr92RwzjQxbRXBdsVBc04QpVLMDr883ZA1Lr4XOcrfeKkA79TfrWRoj X-Received: by 2002:a63:a44a:: with SMTP id c10-v6mr12356323pgp.198.1529976898416; Mon, 25 Jun 2018 18:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529976898; cv=none; d=google.com; s=arc-20160816; b=WCnZHBB2SGNlbOszi9jqHBjbJZ7pt/ZAo2XtB6XKBKB38g3NLcwG5EfjRE2aSGKW92 9wY21LbBD72e58Gb6IZkMaErL6gb8MhyaBvbiKGhCTvZouTkM5ub2ExZKJuiBbg+4p+K 5cg8fPpR0GhimlrmQHQfgxJvQZF1HzwE6awWHOSHmGKaC3hGuMcoh/MDFO4/4yuXw7Dn x0Hxo/c3tv0AOdY3WhVXBChyiED8Tm0TJfzbivtSbtjXvExN7ds5eDGSnyIBVZGoGpZI 4MwyzAGE51tJoLnCDKibM/m3KJOA7vkEw8SqiN1O/NifwLyDdU/kdCSEdUpyL4a0vFAW 4o/Q== 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:arc-authentication-results; bh=/0D4dgUnxnyFGhUqk+RKwlNaqSx/b5/e3BH+kqEcajM=; b=lyyWeQsI/58/F8MjZeDWCM7Zn6eXbVSHR65StuW0VPTXxjTG0IFelsr5FC1UF34KsE 2cKF8ptI5r3PdpnsZRpZAkjHk6z+URDJcx8W/P9uneNt5dFZQcnFtERRmdmaiimrlH2M ZMC1eDfgrVuS+WZUyO4cC1NG3DDKmXfKcGxTu6u7kpR4uf0XwSH8Mbruu8X52X2g+4+t c+E51f0erPL1hizV/o8AZ7kJp0dQDZZWI0bwP2PJsnEL3S95UhjHrZdeYmKMkBc+qsOw qzx1bJRtieMN92ZVVUoVEpUeTWrtcgUblFV4Ed1dUkOXLhhkV85y7ik0vVu7eNHFTTh5 mjBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VYETUxHW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n15-v6si340630pgc.273.2018.06.25.18.34.58; Mon, 25 Jun 2018 18:34:58 -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=@linaro.org header.s=google header.b=VYETUxHW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935377AbeFZBez (ORCPT + 31 others); Mon, 25 Jun 2018 21:34:55 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:32870 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935232AbeFZBeQ (ORCPT ); Mon, 25 Jun 2018 21:34:16 -0400 Received: by mail-it0-f65.google.com with SMTP id k17-v6so13890610ita.0 for ; Mon, 25 Jun 2018 18:34:15 -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; bh=/0D4dgUnxnyFGhUqk+RKwlNaqSx/b5/e3BH+kqEcajM=; b=VYETUxHWJnqCGNAh6gMjY3ROfOR+9fimvNDXBSz9KJJe/7t4DS7BpZE6+UGVjNi2qJ OwjZa3jtlJTUOPjdSZ5ONKYxhvdztBzXkxrh6qbMX93vud9HgCbzZxAAIWXVWUnMBNXT mOEtGKcCUL7CldERpqjNyS5DXYx/UJ+xGBZ7c= 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; bh=/0D4dgUnxnyFGhUqk+RKwlNaqSx/b5/e3BH+kqEcajM=; b=Kp+ZPdIjHRnuCV+QsKYNpynq7mTTsVMEefnw242QnRqwDiosL5FZRV+9kNZYEeBWmy chZvmQijJ5uHFJ7HVh74Kp/iunP8LND+amPAD5UqcLb7qqvEMJJxnGwn5kEHq9CQk8C6 RyVVafNbRGF8xGtgjCemOCBv5Yt0RG0aGtCr4fs2NQDJvMeUR63rRGI15NBIqAhLOBzx e5izJ7gkzq6/WALfn6l6Z4BXU0K4OjgAoo3zpmQX/TspWTnBHGpjV16CZBrklzpEeZSU GKsRn2l3FetPE0oZKhlyHbHrz2ZlJr3OilDO+NWK2ohv1He4mf2XqiBv9Pfw17IV5Zso g+zg== X-Gm-Message-State: APt69E2hQ+MwYwAvOhFice2GNjEgT+xhf4HEDjWNEuQkN4JkaNe59/gx uWN7OgZVzayGnXQ9s5NgGEQmiGi+c2w= X-Received: by 2002:a02:4c9b:: with SMTP id q27-v6mr6429026jad.38.1529976855201; Mon, 25 Jun 2018 18:34:15 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id h62-v6sm184699ioa.22.2018.06.25.18.34.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 18:34:14 -0700 (PDT) From: Alex Elder To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH resend 3/5] remoteproc: Make client initialize ops in rproc_subdev Date: Mon, 25 Jun 2018 20:34:07 -0500 Message-Id: <20180626013409.5125-4-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626013409.5125-1-elder@linaro.org> References: <20180626013409.5125-1-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson In preparation of adding the additional prepare and unprepare operations make the client responsible for filling out the function pointers of the rproc_subdev. This makes the arguments to rproc_add_subdev() more manageable, in particular when some of the functions are left out. [elder@linaro.org: added comment about assigning function pointers] Signed-off-by: Bjorn Andersson Acked-by: Alex Elder Tested-by: Fabien Dessenne --- drivers/remoteproc/qcom_common.c | 18 ++++++++++-------- drivers/remoteproc/qcom_sysmon.c | 5 ++++- drivers/remoteproc/remoteproc_core.c | 18 +++++++----------- include/linux/remoteproc.h | 5 +---- 4 files changed, 22 insertions(+), 24 deletions(-) -- 2.17.1 diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index acfc99f82fb8..4ae87c5b8793 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -64,7 +64,10 @@ void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink) return; glink->dev = dev; - rproc_add_subdev(rproc, &glink->subdev, glink_subdev_probe, glink_subdev_remove); + glink->subdev.start = glink_subdev_probe; + glink->subdev.stop = glink_subdev_remove; + + rproc_add_subdev(rproc, &glink->subdev); } EXPORT_SYMBOL_GPL(qcom_add_glink_subdev); @@ -157,7 +160,10 @@ void qcom_add_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd) return; smd->dev = dev; - rproc_add_subdev(rproc, &smd->subdev, smd_subdev_probe, smd_subdev_remove); + smd->subdev.start = smd_subdev_probe; + smd->subdev.stop = smd_subdev_remove; + + rproc_add_subdev(rproc, &smd->subdev); } EXPORT_SYMBOL_GPL(qcom_add_smd_subdev); @@ -202,11 +208,6 @@ void qcom_unregister_ssr_notifier(struct notifier_block *nb) } EXPORT_SYMBOL_GPL(qcom_unregister_ssr_notifier); -static int ssr_notify_start(struct rproc_subdev *subdev) -{ - return 0; -} - static void ssr_notify_stop(struct rproc_subdev *subdev, bool crashed) { struct qcom_rproc_ssr *ssr = to_ssr_subdev(subdev); @@ -227,8 +228,9 @@ void qcom_add_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr, const char *ssr_name) { ssr->name = ssr_name; + ssr->subdev.stop = ssr_notify_stop; - rproc_add_subdev(rproc, &ssr->subdev, ssr_notify_start, ssr_notify_stop); + rproc_add_subdev(rproc, &ssr->subdev); } EXPORT_SYMBOL_GPL(qcom_add_ssr_subdev); diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c index f085545d7da5..e976a602b015 100644 --- a/drivers/remoteproc/qcom_sysmon.c +++ b/drivers/remoteproc/qcom_sysmon.c @@ -469,7 +469,10 @@ struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc, qmi_add_lookup(&sysmon->qmi, 43, 0, 0); - rproc_add_subdev(rproc, &sysmon->subdev, sysmon_start, sysmon_stop); + sysmon->subdev.start = sysmon_start; + sysmon->subdev.stop = sysmon_stop; + + rproc_add_subdev(rproc, &sysmon->subdev); sysmon->nb.notifier_call = sysmon_notify; blocking_notifier_chain_register(&sysmon_notifiers, &sysmon->nb); diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 981ae6dff145..ca39fad175f2 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -399,8 +399,10 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc, list_add_tail(&rvdev->node, &rproc->rvdevs); - rproc_add_subdev(rproc, &rvdev->subdev, - rproc_vdev_do_probe, rproc_vdev_do_remove); + rvdev->subdev.start = rproc_vdev_do_probe; + rvdev->subdev.stop = rproc_vdev_do_remove; + + rproc_add_subdev(rproc, &rvdev->subdev); return 0; @@ -1663,17 +1665,11 @@ EXPORT_SYMBOL(rproc_del); * rproc_add_subdev() - add a subdevice to a remoteproc * @rproc: rproc handle to add the subdevice to * @subdev: subdev handle to register - * @start: function to call after the rproc is started - * @stop: function to call before the rproc is stopped + * + * Caller is responsible for populating optional subdevice function pointers. */ -void rproc_add_subdev(struct rproc *rproc, - struct rproc_subdev *subdev, - int (*start)(struct rproc_subdev *subdev), - void (*stop)(struct rproc_subdev *subdev, bool crashed)) +void rproc_add_subdev(struct rproc *rproc, struct rproc_subdev *subdev) { - subdev->start = start; - subdev->stop = stop; - list_add_tail(&subdev->node, &rproc->subdevs); } EXPORT_SYMBOL(rproc_add_subdev); diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index bf55bf2a5ee1..8f1426330cca 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -566,10 +566,7 @@ static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev) return rvdev->rproc; } -void rproc_add_subdev(struct rproc *rproc, - struct rproc_subdev *subdev, - int (*start)(struct rproc_subdev *subdev), - void (*stop)(struct rproc_subdev *subdev, bool crashed)); +void rproc_add_subdev(struct rproc *rproc, struct rproc_subdev *subdev); void rproc_remove_subdev(struct rproc *rproc, struct rproc_subdev *subdev); From patchwork Tue Jun 26 01:34:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139910 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4639329lji; Mon, 25 Jun 2018 18:34:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLxhoikJAeH5Szdmn4NEpT5dT4cwdiunfUnNpFP3Osyu6McdY6skfb1zImRdvZwf6Pk8X1n X-Received: by 2002:a63:7983:: with SMTP id u125-v6mr12531462pgc.267.1529976881424; Mon, 25 Jun 2018 18:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529976881; cv=none; d=google.com; s=arc-20160816; b=Fb5iBgsGjRv3HS2iyTZmQz7BQ+0zyaqvDCCl3u2/hEUNru/FCY+NjPBdCCkYpW1GpZ DBRP5C+OYeD8Mv7oGkvtDKjlAzFxKXsNXyq4fC0xYS8WoeH+DI+nBe/Bur+HYo8jMOAs 9zcjVPjrBAYK2xN2sQKSQ5br+bFO0JMcD84QIhPpuYBw4rfNiyt8koOzC+mBZGvcCDWq fRLdAnc9q87vkgAMYoQVHy2OKhn+bJer9x0/C+Bko0jXxsr7sIgf2zxMAKh38ONx27ww xiapHn/XTjCg3v/v9w6YhkipDE+XyQSz3Ufk11eNzYvutpiebih9OuMpTBAIOYiT0V3L lPXw== 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:arc-authentication-results; bh=o5QeWxqEpyDQcrAm1vuw7S6DJdzLkwTzI+oUogCtYFc=; b=QmdSwoFVo4ef138td9yukCFAbvdRDseKvqVf+ZO3mWuCcTrTFyCPYL0FFwKvaGygRP XpIt0ZFxBgHcs30zdHjczgO1sOvjD1KOkb2giUPdw7Q8rwoG2bGQZwnvGzG6t3VMF3WR hf+6GXxL3dVfXGJdNLXRnUw7c2ag9qsNk3cucih1Ugot6VvOPr1PGTuPOVU6bRU0NLFe RvDru/Q/jQwiI/uuvugBWhv7YA8Igv8298k/waW1L9vsjjCMk/uQFbNXDiD1No/c6j7B xEzOS3nFCTcN02zS/GBPE+QTNjywtBKiFove8BtdZL6yisOT3vktR3bGUxcvQMNeLl8c XWbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a2iYIYiw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9-v6si377432pln.465.2018.06.25.18.34.41; Mon, 25 Jun 2018 18:34:41 -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=@linaro.org header.s=google header.b=a2iYIYiw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935356AbeFZBej (ORCPT + 31 others); Mon, 25 Jun 2018 21:34:39 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:50508 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935251AbeFZBeQ (ORCPT ); Mon, 25 Jun 2018 21:34:16 -0400 Received: by mail-it0-f65.google.com with SMTP id u4-v6so15306956itg.0 for ; Mon, 25 Jun 2018 18:34:16 -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; bh=o5QeWxqEpyDQcrAm1vuw7S6DJdzLkwTzI+oUogCtYFc=; b=a2iYIYiwPtOpeNCYlUlNTatUvNE6Oj5HspI6iCRgaCMg2F+XOQZJneS9e4tpd0s78c fg6sahQuZ9IBcSsJI9ah24B0oMNOTg6EuEJimX0i68jiJZa7aNGGXXBglQIQvH4k5lDE gGE8LMuG9bvojv4JZKDASnXvmZwTwj8lE70/Q= 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; bh=o5QeWxqEpyDQcrAm1vuw7S6DJdzLkwTzI+oUogCtYFc=; b=HiQ3hOS2ihZpfxHSOKlafmRkjZ9nJMq0DjjMykih9nkNNvtoyH0rsRWOJHWCmPeE0B lGnWhb6KmZotk1vW9lspFI1OJ4AFGdkRpByI4E3rvI3ceDfC4eeToZH+zMn+aCtv0sFS YAZvXPTUl3VrceJE+8sk2TA+S/lI+U9j/M0VRO/V512n/S/8Wqc2ebu9UmXoC/p5kEK5 +YfURH4iy0zA1suMSM6F5sHkJBzSRoiA7gV5Tc925qAxxFJ4wt0V1XI/e3PlffJmYSrS ZFCDKe/UfZBaKxnW7ScGg8VbYb2AqPsHAt1fKBqJptsl5CiNXbOZbxBNlrXyJUUNbW3+ rIGw== X-Gm-Message-State: APt69E0hYFdVfw3Y9CpcrnUwP3aK5Lmo0qhBXEo7rJeDti3Ipl96dgXl vbaVCg+zUP/jEpi3Ab6SPBhbXzg0Wuk= X-Received: by 2002:a02:a999:: with SMTP id q25-v6mr11796857jam.47.1529976856141; Mon, 25 Jun 2018 18:34:16 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id h62-v6sm184699ioa.22.2018.06.25.18.34.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 18:34:15 -0700 (PDT) From: Alex Elder To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH resend 4/5] remoteproc: rename subdev probe and remove functions Date: Mon, 25 Jun 2018 20:34:08 -0500 Message-Id: <20180626013409.5125-5-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626013409.5125-1-elder@linaro.org> References: <20180626013409.5125-1-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rename functions used when subdevices are started and stopped to reflect the new naming scheme. Signed-off-by: Alex Elder Tested-by: Fabien Dessenne --- drivers/remoteproc/qcom_common.c | 16 ++++++++-------- drivers/remoteproc/remoteproc_core.c | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index 4ae87c5b8793..6f77840140bf 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -33,7 +33,7 @@ static BLOCKING_NOTIFIER_HEAD(ssr_notifiers); -static int glink_subdev_probe(struct rproc_subdev *subdev) +static int glink_subdev_start(struct rproc_subdev *subdev) { struct qcom_rproc_glink *glink = to_glink_subdev(subdev); @@ -42,7 +42,7 @@ static int glink_subdev_probe(struct rproc_subdev *subdev) return PTR_ERR_OR_ZERO(glink->edge); } -static void glink_subdev_remove(struct rproc_subdev *subdev, bool crashed) +static void glink_subdev_stop(struct rproc_subdev *subdev, bool crashed) { struct qcom_rproc_glink *glink = to_glink_subdev(subdev); @@ -64,8 +64,8 @@ void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink) return; glink->dev = dev; - glink->subdev.start = glink_subdev_probe; - glink->subdev.stop = glink_subdev_remove; + glink->subdev.start = glink_subdev_start; + glink->subdev.stop = glink_subdev_stop; rproc_add_subdev(rproc, &glink->subdev); } @@ -129,7 +129,7 @@ int qcom_register_dump_segments(struct rproc *rproc, } EXPORT_SYMBOL_GPL(qcom_register_dump_segments); -static int smd_subdev_probe(struct rproc_subdev *subdev) +static int smd_subdev_start(struct rproc_subdev *subdev) { struct qcom_rproc_subdev *smd = to_smd_subdev(subdev); @@ -138,7 +138,7 @@ static int smd_subdev_probe(struct rproc_subdev *subdev) return PTR_ERR_OR_ZERO(smd->edge); } -static void smd_subdev_remove(struct rproc_subdev *subdev, bool crashed) +static void smd_subdev_stop(struct rproc_subdev *subdev, bool crashed) { struct qcom_rproc_subdev *smd = to_smd_subdev(subdev); @@ -160,8 +160,8 @@ void qcom_add_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd) return; smd->dev = dev; - smd->subdev.start = smd_subdev_probe; - smd->subdev.stop = smd_subdev_remove; + smd->subdev.start = smd_subdev_start; + smd->subdev.stop = smd_subdev_stop; rproc_add_subdev(rproc, &smd->subdev); } diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index ca39fad175f2..2ede7ae6f5bc 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -301,14 +301,14 @@ void rproc_free_vring(struct rproc_vring *rvring) rsc->vring[idx].notifyid = -1; } -static int rproc_vdev_do_probe(struct rproc_subdev *subdev) +static int rproc_vdev_do_start(struct rproc_subdev *subdev) { struct rproc_vdev *rvdev = container_of(subdev, struct rproc_vdev, subdev); return rproc_add_virtio_dev(rvdev, rvdev->id); } -static void rproc_vdev_do_remove(struct rproc_subdev *subdev, bool crashed) +static void rproc_vdev_do_stop(struct rproc_subdev *subdev, bool crashed) { struct rproc_vdev *rvdev = container_of(subdev, struct rproc_vdev, subdev); @@ -399,8 +399,8 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc, list_add_tail(&rvdev->node, &rproc->rvdevs); - rvdev->subdev.start = rproc_vdev_do_probe; - rvdev->subdev.stop = rproc_vdev_do_remove; + rvdev->subdev.start = rproc_vdev_do_start; + rvdev->subdev.stop = rproc_vdev_do_stop; rproc_add_subdev(rproc, &rvdev->subdev); From patchwork Tue Jun 26 01:34:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139909 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4639135lji; Mon, 25 Jun 2018 18:34:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLrQe0f4tfXQcAxeWKHa4cuftoS0XWDVTHogruQmmZ9QF6x+I6n8vqg1aUg/q3CAUx1OTHF X-Received: by 2002:a17:902:b488:: with SMTP id y8-v6mr14485430plr.157.1529976864246; Mon, 25 Jun 2018 18:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529976864; cv=none; d=google.com; s=arc-20160816; b=Ow58xk03FNda5o1H6aBn12J4CM00djwL7xwizdbQGru6Vgn0eowqDu/xDSy6ncQL2h EXZrojHAdWY1D693EyXFKKPIeu2Ssr1FWpLGDp7tHcRPS7bHEyFkJGnesNh1PtMLTu+M oJhFiKPUCTr/RtFppBGRAZkxnKAKfXuTYngF1/bOhEioP1nxkDPrlCsRjuxd3/NovYtu +WiA34itVmXR1Cv9gb5cAyUjHODz96yJGlMgx/srzbfIQFYdff6QdSTso3H+J+dG9+lz o3LpBXJqwBHLdLqGw9JjTnHpRMd8KKESixOPPF9Hb1m8qDyLeToSNP7PppW6JlHoxRyB GfDg== 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:arc-authentication-results; bh=zI5lUKlAzQRSNWtdWKX5W3a7202aqO9Sdf68xxZgub0=; b=n+bRgoTNMZrzQYAAXGG9XWFQsVc4f6BQoljvZJtJccn96HYg2buQY0Lf8CDGVKC8t0 VH3PgsibIdBanbukI9cOq0w3VOOjvl/7Lk9Dtadvhg10XYP6GD3c1LOWFE5i5m4AnJ+7 nIIXl5OMT5US0hjID6mB+QkHPU/chAqS4BY6qY9QlZG3PLuobP1cVG/zjBbyh62lPjMO 3GVfxExwBkrkm6bTYLamGjEhYYosWU541CMg6Zlf358sSEs3xwCGqVzer5tTz+4WrM/k KHUfwOMKqw7x9MaOgDlCA7lVlnI8SNDMBSaof0o7xAsjdMxkg6BdiYXqfBPkHnLIDVlH eTZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hfEHc8ef; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 187-v6si346881pgj.382.2018.06.25.18.34.23; Mon, 25 Jun 2018 18:34:24 -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=@linaro.org header.s=google header.b=hfEHc8ef; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935330AbeFZBeV (ORCPT + 31 others); Mon, 25 Jun 2018 21:34:21 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:45117 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935292AbeFZBeS (ORCPT ); Mon, 25 Jun 2018 21:34:18 -0400 Received: by mail-io0-f196.google.com with SMTP id l25-v6so14348604ioh.12 for ; Mon, 25 Jun 2018 18:34:17 -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; bh=zI5lUKlAzQRSNWtdWKX5W3a7202aqO9Sdf68xxZgub0=; b=hfEHc8efQuVe/ftrktwFiIaaIqmLCzoz8a9rNWgyNtPu54bQNAC9uAxQcbz9Fo2geS ilTEJW0rJWRnkOBwzclVRCdG4fOVVcGbPLWd5Q6WWU5N9TnsjxcaAqTCZTNKrRrPAAFL 7gKRg6J2798Y+GI3KQsAV+QuQI0dJJtmr653c= 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; bh=zI5lUKlAzQRSNWtdWKX5W3a7202aqO9Sdf68xxZgub0=; b=HEtLKKZ1IV6cikvzE64B37tgZrGHXRScHKHSkjw8S1+Zd+63zw0qpMKaNmLa/7SD4T mvylU+9hk5J16om/YJhYh2veGXCSNTXgmuGyMx3GBMkJVzDKeb5LNz99CQCKtrhnyW9m 8+HDbDkayQ2spVfiV1T+cDjpNsx3QushWS1meyXQLjB83O7ApU8nRa5RHUfBSDQVTb9x oBBuMkw96KwX3G+zoaFifZJyh85BtH9AcQLHsOsAoY9wXQ911SFpzEsj9HWmqXZsNQWp LzQBU1nZF50herw938YKkP/hVbUwClpgNn3GlPzTbONFhzdFWk0W6JJdAZnMrUnmabCa ZdtA== X-Gm-Message-State: APt69E0CyqGo5TO8HmmgtujWrBq3lQoAWJJn1LPOU7i5Br3yhp7HMfoP Z5zY0JonqZmr+q/6fuQTcw4jDgovBf0= X-Received: by 2002:a6b:1844:: with SMTP id 65-v6mr11901946ioy.16.1529976857085; Mon, 25 Jun 2018 18:34:17 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id h62-v6sm184699ioa.22.2018.06.25.18.34.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 18:34:16 -0700 (PDT) From: Alex Elder To: ohad@wizery.com, bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH resend 5/5] remoteproc: Introduce prepare and unprepare for subdevices Date: Mon, 25 Jun 2018 20:34:09 -0500 Message-Id: <20180626013409.5125-6-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626013409.5125-1-elder@linaro.org> References: <20180626013409.5125-1-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson On rare occasions a subdevice might need to prepare some hardware resources before a remote processor is booted, and clean up some state after it has been shut down. One such example is the IP Accelerator found in various Qualcomm platforms, which is accessed directly from both the modem remoteproc and the application subsystem and requires an intricate lockstep process when bringing the modem up and down. [elder@linaro.org: minor description and comment edits] Signed-off-by: Bjorn Andersson Acked-by: Alex Elder Tested-by: Fabien Dessenne --- drivers/remoteproc/remoteproc_core.c | 56 ++++++++++++++++++++++++++-- include/linux/remoteproc.h | 4 ++ 2 files changed, 57 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 2ede7ae6f5bc..283b258f5e0f 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -776,6 +776,30 @@ static int rproc_handle_resources(struct rproc *rproc, return ret; } +static int rproc_prepare_subdevices(struct rproc *rproc) +{ + struct rproc_subdev *subdev; + int ret; + + list_for_each_entry(subdev, &rproc->subdevs, node) { + if (subdev->prepare) { + ret = subdev->prepare(subdev); + if (ret) + goto unroll_preparation; + } + } + + return 0; + +unroll_preparation: + list_for_each_entry_continue_reverse(subdev, &rproc->subdevs, node) { + if (subdev->unprepare) + subdev->unprepare(subdev); + } + + return ret; +} + static int rproc_start_subdevices(struct rproc *rproc) { struct rproc_subdev *subdev; @@ -810,6 +834,16 @@ static void rproc_stop_subdevices(struct rproc *rproc, bool crashed) } } +static void rproc_unprepare_subdevices(struct rproc *rproc) +{ + struct rproc_subdev *subdev; + + list_for_each_entry_reverse(subdev, &rproc->subdevs, node) { + if (subdev->unprepare) + subdev->unprepare(subdev); + } +} + /** * rproc_coredump_cleanup() - clean up dump_segments list * @rproc: the remote processor handle @@ -902,11 +936,18 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) rproc->table_ptr = loaded_table; } + ret = rproc_prepare_subdevices(rproc); + if (ret) { + dev_err(dev, "failed to prepare subdevices for %s: %d\n", + rproc->name, ret); + return ret; + } + /* power up the remote processor */ ret = rproc->ops->start(rproc); if (ret) { dev_err(dev, "can't start rproc %s: %d\n", rproc->name, ret); - return ret; + goto unprepare_subdevices; } /* Start any subdevices for the remote processor */ @@ -914,8 +955,7 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) if (ret) { dev_err(dev, "failed to probe subdevices for %s: %d\n", rproc->name, ret); - rproc->ops->stop(rproc); - return ret; + goto stop_rproc; } rproc->state = RPROC_RUNNING; @@ -923,6 +963,14 @@ static int rproc_start(struct rproc *rproc, const struct firmware *fw) dev_info(dev, "remote processor %s is now up\n", rproc->name); return 0; + +stop_rproc: + rproc->ops->stop(rproc); + +unprepare_subdevices: + rproc_unprepare_subdevices(rproc); + + return ret; } /* @@ -1035,6 +1083,8 @@ static int rproc_stop(struct rproc *rproc, bool crashed) return ret; } + rproc_unprepare_subdevices(rproc); + rproc->state = RPROC_OFFLINE; dev_info(dev, "stopped remote processor %s\n", rproc->name); diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h index 8f1426330cca..e3c5d856b6da 100644 --- a/include/linux/remoteproc.h +++ b/include/linux/remoteproc.h @@ -477,15 +477,19 @@ struct rproc { /** * struct rproc_subdev - subdevice tied to a remoteproc * @node: list node related to the rproc subdevs list + * @prepare: prepare function, called before the rproc is started * @start: start function, called after the rproc has been started * @stop: stop function, called before the rproc is stopped; the @crashed * parameter indicates if this originates from a recovery + * @unprepare: unprepare function, called after the rproc has been stopped */ struct rproc_subdev { struct list_head node; + int (*prepare)(struct rproc_subdev *subdev); int (*start)(struct rproc_subdev *subdev); void (*stop)(struct rproc_subdev *subdev, bool crashed); + void (*unprepare)(struct rproc_subdev *subdev); }; /* we currently support only two vrings per rvdev */