From patchwork Tue May 15 20:53:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 135933 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp28529lji; Tue, 15 May 2018 13:55:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqSwSIBmkAcl43YR1aItTUkVLSAL8xg8i3lGAtanLstKRZPMKJGBvq5NJ1kE3ECY8Ssnq6l X-Received: by 2002:a62:1e02:: with SMTP id e2-v6mr16783173pfe.212.1526417699881; Tue, 15 May 2018 13:54:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526417699; cv=none; d=google.com; s=arc-20160816; b=HQ91M2Laijr84ThPRnhy5/CEteSCdQPFNvR3MJAJBc63gVXhrPBBCRIoutOmNB0QxE wHZAxQtId4QRBd/x2b6anOkkhVL+cUG56USV9roH1daaJSCovUdgwouWIn3kgo6Mt94V gu7/vlPb2L3M3dmZBmzzWKye/nBB4eP8yks76x2P7VOJdh6X2kppx+ZB/yK+xf5mM+4m F5zxFrXT9GQmk1snm62jhE+YsxSwlCItrGBbiSRfcyqBoDvPhV8dPlyTPASqSDlI4PfE GbbZZxNlF4eN3l8jwW3zZiVUypTy2/TaOXNNdY4dIeqQU2ZAB3IdiJOZB9T6hXo64EGo 2sYw== 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=AQYVmhhhEfZe5pYonBXHye7W95XGf11qK5LrAzFs7q0=; b=fon9zaLBLuVXem9yWfwNG/R9jpngPbJKMA0XIvdvgh/DlmlT9KFRNgaBgO2barieMb XGNNbAIRivQTgxrYXZXbbQXZ0V3QmX/8oxN2kfr6mBUSuDVTEDBmCUKgkHcwaNl2IfSF w9/yA4myYMTyVvxI8SaWlMKfrkhA1xgI/jYoSvsFBiMu+jDNh2+8QKpqyD3YtkUEltQl ReF+NYFAJYjtRWVhF3bzdZbpnWa5wV1xR3P9Z7Qr91m62lTo8sG/3yAKWAOLN6eqswVK xNMQAOGRkJJFO94IHyz0R0tF1VV13iNgGheBsDmqu6x9HDcQILLDE7XTB2VuJOZtA+bp Z1hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PxgALhHW; 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 l187-v6si753216pge.46.2018.05.15.13.54.59; Tue, 15 May 2018 13:54:59 -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=PxgALhHW; 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 S1752803AbeEOUy5 (ORCPT + 29 others); Tue, 15 May 2018 16:54:57 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:51785 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752518AbeEOUxz (ORCPT ); Tue, 15 May 2018 16:53:55 -0400 Received: by mail-it0-f66.google.com with SMTP id n202-v6so5093108ita.1 for ; Tue, 15 May 2018 13:53:55 -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=AQYVmhhhEfZe5pYonBXHye7W95XGf11qK5LrAzFs7q0=; b=PxgALhHWxDZoyqTTedczpzdBvIUvq0OkDzMVemVINKduHlyY3wKYjwSL3mGEqtN8hf JlWuyoOtOhPnwCFrf6u+dht1ctwRKaD+sCxSBXKZUT79jeGMFOyRRX6pW+dhYtv/Zn93 6T6+F5YI/i/PrKSx9go5sAQkr3FeGwE0B6pTA= 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=AQYVmhhhEfZe5pYonBXHye7W95XGf11qK5LrAzFs7q0=; b=kqjvUk8hd2Thoj0atqLsCNCUkKDyLW+BFmvRBdoegTAPamw8bla27FnzGth4h0CPgA blD3Bdoqp/Q40LlJwQMlDL7fKinIEIcZH2X2p1ehLBBQbwWaB2t+5Oa/YBn8ZnRU7f3n Skg5oL6fLQcDhMVnKI7foOjT4Br5CSNyrgn+I/FQXhu0MNa94ZjKvxr62dY3vnoWjnzq ow8B2RzWqVRmeBOZ8EEf+4suFu2Q0nAfJB7q8DJiAZQNP0iUITPWkCoKSqO+A/Hc+cSJ 87feBLBShfD14iyDSVnjTEymrZypxqUqsPPM1et/1wbhup92S5jhpwUigYh7gbhFrdw8 6vVA== X-Gm-Message-State: ALKqPwdt1NHf8oHgB52wQhUzGpOGjOQk4LEpGk2PXpD1cyhIrS+k0Rcb BWLI9ELLmcVWnI9/8BI6IpkhcQ== X-Received: by 2002:a6b:89e0:: with SMTP id t93-v6mr16668777ioi.230.1526417635066; Tue, 15 May 2018 13:53:55 -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 t9-v6sm440407ioa.82.2018.05.15.13.53.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 13:53:54 -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 1/5] remoteproc: Rename subdev functions to start/stop Date: Tue, 15 May 2018 15:53:41 -0500 Message-Id: <20180515205345.8090-2-elder@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180515205345.8090-1-elder@linaro.org> References: <20180515205345.8090-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 --- drivers/remoteproc/remoteproc_core.c | 30 ++++++++++++++-------------- include/linux/remoteproc.h | 14 ++++++------- 2 files changed, 22 insertions(+), 22 deletions(-) -- 2.17.0 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 May 15 20:53:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 135929 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp27576lji; Tue, 15 May 2018 13:54:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZprhS43Pioi9SfugiLjg72nqD3H1tCgJgtjbLVkQyrCF12mwHVhb2kBJ64V8SGWF2xIIbVn X-Received: by 2002:a62:c103:: with SMTP id i3-v6mr16691083pfg.148.1526417644266; Tue, 15 May 2018 13:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526417644; cv=none; d=google.com; s=arc-20160816; b=ZqrSj3dSiH5IqZS/S1tY+WJ9amDmirN8FmctdeC42wmrFrPoxD7Oo0V7eRnnflRLxN 98235Nb/Z1TgzZ1zSFNlz6Q+AW0zCnsrSRPyBEUA6m1MVCiK+UhtwaWrbNy9R8CJv07B 2cEHxInWkXZm/O2dd4tX6mit4x5KkiBQEDDHGkpgV2a7mUVaMiVQcQvHU8uwVG+bPcX/ RwYNwBR+mosIzoOyDY2UDBwcarfLLdRS0zzw/EcKoDbFez2j4n1SJ33MiMt2Y2zqJSn1 ckMxx+QnTRnedBktUtdVQWFYnfO2MFuwukBzMeIuW21c0QEZpt256E21Kn2dk5QwxmaL yAhg== 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=6HyQzw6NAdfB2F6Sekrf3bHu2OVNG3LO++5UtltSAQ4=; b=dHWbgp0HtKiXbHT/rQC1L/AbXe9qMUlXOSY+Yx5lyNkn396wqbDBsEAoA/7kF1zNt4 emNodvaiY19+BIA1r1ijI2Pou5FUNXMtusaJyyI1Sgarjs8WUAvqh8UpuvGGDLNiC1So d5hiF+cFsHR9qhI3XHMOceZh1aweZfEzVlH+bkT/WyH5AsWo710gTCWAEi3LEKvZxNRm Fa3XgO711ExEDcAJseVbU3QR+FwssbShV260/JL8H7JFbafkpxAlIKvYGnpuzFTsWci5 WGaNbzBVeadQ5dR13HaqRbd2YXdJWZWSk9rUbsMooTKLTAL+dgX/7Sdp5c5hOhMnd6hf Tt3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iMDy1IT8; 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 p91-v6si841704plb.457.2018.05.15.13.54.04; Tue, 15 May 2018 13:54:04 -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=iMDy1IT8; 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 S1752700AbeEOUyB (ORCPT + 29 others); Tue, 15 May 2018 16:54:01 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:38933 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752236AbeEOUx4 (ORCPT ); Tue, 15 May 2018 16:53:56 -0400 Received: by mail-it0-f66.google.com with SMTP id c3-v6so5345721itj.4 for ; Tue, 15 May 2018 13:53:56 -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=6HyQzw6NAdfB2F6Sekrf3bHu2OVNG3LO++5UtltSAQ4=; b=iMDy1IT8rWZu9845v0sj7CZxHPdkGjBVKfakpGfmqI5USIRex/878ndlAiusn0F/yU VZ7Y28uH/zKs0tfElCIaMieDPcKRVppPdjF6IHv9wmHkHT4/dRdAuVYcqwh9eO1H9Gce 8fFRI0HKZn4zIIz9QgFJDgd/6E81r8sm6j8yg= 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=6HyQzw6NAdfB2F6Sekrf3bHu2OVNG3LO++5UtltSAQ4=; b=IJ+/cQ+CeX9ffXuUO+7GW22y5qrGSxkL04TeRfFnFTrOc7tsJQw74y6JLIi/3hjVMd KHUFXmQHYpfhXS+WeS+ZUzjGS1Yxy2L45tlV6UEEyo0FWQzTXZO9yh2DDrar1FlwYym9 iu1GaEDueYWAQSxwfacc2tEU+Rmqf0Bi6lYwmnEc790Ds8xTHItgjrAHajOGK5QnFLZ4 NbBQoaZexPII8RodE8hjAKutMFtWajyWpsnrfGLUPHw5z2Q2Vu7lt+lRey8coe+HKUo2 rYMudQgfKbvoSb0juSpLtULnUOaAH+f/dMDB+m+fbTVrETeVGSTarIYaPRg+WbBfzVrG yH1w== X-Gm-Message-State: ALKqPwdFAUZ3pqdHsEb0eoMvtMTU50QIfKDhsu5K05fV+aUjcLGZlakE 97tR34JcQ4nKcaF17UiAW+vKehpkaas= X-Received: by 2002:a24:61ce:: with SMTP id s197-v6mr17279448itc.10.1526417636127; Tue, 15 May 2018 13:53:56 -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 t9-v6sm440407ioa.82.2018.05.15.13.53.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 13:53:55 -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 2/5] remoteproc: Make start and stop in subdev optional Date: Tue, 15 May 2018 15:53:42 -0500 Message-Id: <20180515205345.8090-3-elder@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180515205345.8090-1-elder@linaro.org> References: <20180515205345.8090-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 --- drivers/remoteproc/remoteproc_core.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) -- 2.17.0 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 May 15 20:53:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 135930 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp27643lji; Tue, 15 May 2018 13:54:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZokFwHZrfVxqbu3ftQqlwGRCfWlACOjtr7LPGj9iTJik6/UCRiUE2olFfnW8QDd5NOhicOd X-Received: by 2002:a62:3ec2:: with SMTP id y63-v6mr16836276pfj.102.1526417647143; Tue, 15 May 2018 13:54:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526417647; cv=none; d=google.com; s=arc-20160816; b=lF7YFNbYXGD0+f75o7vqOi9wurXNhVZhT+O5taansBCUgZH0a4GiLmchQR4/9b7J4B TwGubdJ89u0AcrxIHdU0AaufL+Cc/WIDv+kHvgPwZflumzZAoyxiPVB3Vnmv9YnQIddN CnoWz+QxUWZMhdrhm/eb58PKIugFsaFj6yP9MymoiGuXaxZJPONIrOpVyAp7Kw8RK3ze SBHitAgUX5QgoDihR+NigsMtOcqrA6uKCUuqHVXrubKy7rpCeKxHcx0X/kDqqe4uWrd6 7SOO+oReVbgiZAA3Wuol5b2x/kiNIxfGJzuCo4AkNV9/dH0zeXYbG8jQpysXr+wOSLN/ 8sWg== 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=1USLf+ROdp0pEraa+9s3mOQ8XazU1dl3mt/Jidd9z/0=; b=PB9BTgcuEcIXAgMCm3wA0AYjTetZwWOW2iiZKYyhKzjcLaLYcntO2c1GOMTdjaDGin nstCLMmDWloCtZ5V6xCLHjGvSptmg9UwXgJZvxs5cEPYWI4Zl11m3DRt7ScttSOH9AOC /cUqpSTiqyP/fhNewudeF16mxC+F+6dclb94KjBRIxvpJtGuRV5nQqxlydpGUN0xdlad rYB4okvU14QVV+uT2jpexbb/Scnb+UVWXifXnAGZGLURm8+6QYA9SBWwVMWlfmSFcpQT mUgZitAK9BRmVTog6LrHrWKYrinUDBMowpdLN7jhA6AIx/74G595HcH/X6XMIAymjNlh alyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HLfwoXxR; 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 h190-v6si698561pgc.663.2018.05.15.13.54.06; Tue, 15 May 2018 13:54:07 -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=HLfwoXxR; 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 S1752728AbeEOUyE (ORCPT + 29 others); Tue, 15 May 2018 16:54:04 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:37371 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752594AbeEOUx5 (ORCPT ); Tue, 15 May 2018 16:53:57 -0400 Received: by mail-it0-f66.google.com with SMTP id 70-v6so5375680ity.2 for ; Tue, 15 May 2018 13:53:57 -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=1USLf+ROdp0pEraa+9s3mOQ8XazU1dl3mt/Jidd9z/0=; b=HLfwoXxRDPM1KXXR7XXsHr7w4dSBCu1PuNjCPZlDsJOTK/B6S31Hrjcj0bW083ZEZW mG9c+mgjgBeuBiRrIs7dLTPpIh/ygre/7TMtFksauBVac7tvVOzocgtdcf30bC4/Z0M9 +2//VI2e+to8Ty+CoWj2mMguGZ6jRYjttjp7A= 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=1USLf+ROdp0pEraa+9s3mOQ8XazU1dl3mt/Jidd9z/0=; b=IjrV/X6Sve4SnlmA2tadlgQn8gj0lxdFg07vigi3zjLlvzw4BxDjscuz4mPdLvqMXo liakPvMwERuYo4J6Fz1wQJq0db1IFV3y7/oAJA7pixr7dy+YNMx5N4EZAR2gh1NxNQUT SEc7UdW8rqj8IilMNNe8OXYhdwoqlbz6p9OSoZOhGvhb/6C7pWS26URVLsGwjwFv6ssM 0FsqrPVr7OjomH7BPpUwZps/MIp20ZLKsGGDz8bHcTCerOkoQXCKIaxLWVGf6nJsTi2Q Ljt46TAFfr4Mooa3/DVRquO2/pq3F1odvJrf00uLsV9nPJD/Ezh6B0bb9bqfzPyjS0AV SEyw== X-Gm-Message-State: ALKqPwdwCprVrTTc6xV8OTFerHeXpeVJPmL+qipvKI0n4zJTgzsXQQ17 2ZiuSVtgsmuMopfggf3eFfAnlqHiC+k= X-Received: by 2002:a24:e983:: with SMTP id f125-v6mr16054954ith.36.1526417637138; Tue, 15 May 2018 13:53:57 -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 t9-v6sm440407ioa.82.2018.05.15.13.53.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 13:53:56 -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 3/5] remoteproc: Make client initialize ops in rproc_subdev Date: Tue, 15 May 2018 15:53:43 -0500 Message-Id: <20180515205345.8090-4-elder@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180515205345.8090-1-elder@linaro.org> References: <20180515205345.8090-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 --- 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.0 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 May 15 20:53:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 135932 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp28264lji; Tue, 15 May 2018 13:54:42 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqs6Cq1K9ZnRQwYvDVF+jCjvG6w/nbzX4ELft/nmA5VxpiR3SDh0d/nEkGenrwG/bCgTlWz X-Received: by 2002:a63:31d8:: with SMTP id x207-v6mr13432780pgx.411.1526417682751; Tue, 15 May 2018 13:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526417682; cv=none; d=google.com; s=arc-20160816; b=ktsHcxnUuKjDYkP0KgG8XxqJE+IMRYmt90010PnEE9JTtfiI8D//86EuufjGX07eZk Yna8q7qnPwetJFVtXghH5A19ygat0Jwk2ANZIdzOReEsfEXHBmlKMaDuwCEu/J4+AXO6 RcLdOTjhRma4Uzsi8ZGWlsktiMOJNUvFXSJnnAOhWgt6QjqrJpYWN9dCZxTQWxgcWUbh MK9bkojU4yvGbbbJu6FxFfJBD0SCY5qtOTpC3N2KfbInGiuloQcs23fcwv+crefl30JC OtVqwrxYoPlCE8Uv6Ucyxfnwi92jiNsrA7v2K4Dcm0aF28WFUhNIGfoZbSCo7JmUu+bp qPqA== 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=nJJ8R5MJEX4f2cvyuWALD7kxLki+PWqpOrr/NPYCEZE=; b=a9JjXpIPSonRnHDD2juetEfp5BZoQXZhHzpwWcIUvVI75RTckhNaKHOnnt0tPV4H+H U+FZW66lLS2yF0gHhGdyHNOWS9Oz/lhEtU1nxmf5BZhKiYXf03nFiXBmR9fN1Ikf7c31 8VOHfMgkYnq09XLAszi/5o5rMKFlxbnOKcDndP8Su1+xByPRohS2u13LAdJpjbv4crFF QWLQ57Ucvt5YkPMpJQP5VkxkXkl8bPkmzIVS2yvAWQvxTRxHgYTJe1/S0k9PS2xNiYHu Lg+k+yWNRqp9sGg0sbAvlWvaBMTqLnwVizeZPz8Agf9Gh2TkctikHiG2VqIBEGKKf1CH c3rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P7+vpAfX; 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 r12-v6si918423pfk.83.2018.05.15.13.54.42; Tue, 15 May 2018 13:54:42 -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=P7+vpAfX; 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 S1752770AbeEOUyj (ORCPT + 29 others); Tue, 15 May 2018 16:54:39 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:55167 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752627AbeEOUx7 (ORCPT ); Tue, 15 May 2018 16:53:59 -0400 Received: by mail-it0-f68.google.com with SMTP id z6-v6so5060994iti.4 for ; Tue, 15 May 2018 13:53:58 -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=nJJ8R5MJEX4f2cvyuWALD7kxLki+PWqpOrr/NPYCEZE=; b=P7+vpAfXTIv+T+EpUU/OX8peYIBi1wIe0tJAXYQEUJ9a6uUTrGJAaIEvXq5hHh/JQ5 5pBDb/zIk8XHUMcJ4o8gObgU+SkzaKSeofnub4NhZv3r8X3g9Dg6HMErXbByNFl4JBr5 /KnTh2CIQ4U+JShWzVglkz5q86h3IORP2zk0E= 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=nJJ8R5MJEX4f2cvyuWALD7kxLki+PWqpOrr/NPYCEZE=; b=kPreN3YaHdQ8qVGBwqgdt2soMacDGTRtmPzko4ZyQdbuErNL4d0wAmEuRzAcF9qJvY yOr8g2ZyODCGA12sSK9biERu+bBxxNBL7/azt7Y4xxVpXOiBSENKLfJrWsgvJJIKqplL aOzTqgCqKhLyUxJBHuwe2AHTET6sbUMMmyuapB2icBzgbzdNw/MrXekW4GtXRdUEKBtm MxUqxIJBceAD+DVfYFCcgEb01EgelDrNmpR9uXIvG40kbdP46pTPb/4iVtKXwOeYdcsb c+QIPpP8fFD2eFa5urWC+RcWmB0D3vp9/4sQ913ZgFQ2fuDeCZeit12O2Nwd18NtA1I+ Hxvw== X-Gm-Message-State: ALKqPwcp2Y5MnVQIg+c4Ij/tZaE2wZHXTi5Ryhhyr/FwXJWnVnjbhmu4 o7MXWHMIlCHR3wim5U1ptty0CQ== X-Received: by 2002:a24:16d2:: with SMTP id a201-v6mr15974631ita.145.1526417638066; Tue, 15 May 2018 13:53:58 -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 t9-v6sm440407ioa.82.2018.05.15.13.53.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 13:53:57 -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 4/5] remoteproc: rename subdev probe and remove functions Date: Tue, 15 May 2018 15:53:44 -0500 Message-Id: <20180515205345.8090-5-elder@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180515205345.8090-1-elder@linaro.org> References: <20180515205345.8090-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 --- drivers/remoteproc/qcom_common.c | 16 ++++++++-------- drivers/remoteproc/remoteproc_core.c | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) -- 2.17.0 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 May 15 20:53:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 135931 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp27912lji; Tue, 15 May 2018 13:54:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZohWwtZEcxVwPjolM+Ig4geW+JkkN/px3qLm/HEEIch61qf1HIzjAriTNntHCFLQwWxRklp X-Received: by 2002:a62:df4c:: with SMTP id u73-v6mr16576620pfg.10.1526417662587; Tue, 15 May 2018 13:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526417662; cv=none; d=google.com; s=arc-20160816; b=eaPHxAFHYrYpkx/GVyUBfa+y00SklsLbYWybmuRbjTcUTBWZ19GFd1ujEs/mnMW5el FKxqQNX4+Xde1eqCqASChtw0txnRlEJzuyedd7ejzOa8mT03dcSndqmY5JvZibTMRKBY QqD4SqwXOKe2Nh1qWYTYqSgBGD14X811cvLDh2DpIFgbPBAD7Ho8ZR4mPG9OyV26KvFg 4PT9kipn0hHjLn2vC3yqUtDMWElfB9dPztDb7wV0XXZEVGxuqppe2iSgK0DkfdlsvoG+ Xe+LYxKZsKF7aHqUmocKTImnO2LywCy13lRg7sMDD+fIzxCiBJY9l9JNPajJX1jzVD2E 7xNw== 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=D3N7W54F0ZPkdgLap0aIOEK/9V7dheITVPxXL9WueC0=; b=BjyDE90SmjPYkHJnes72yevipsj0lo9zIVfe70umMvbP03wfjM7juB3wUTiozGGzn6 vQ/WWIIVYWkvESB8pYhJEI+SrxcEFeKJinqnoyy6ElLOPLEUJACVvy31rXJZyjzJHcpn v/oEs566f5kazsP/7aFcoPFG8VTw2ILSnOW/lICzA7sczHM8R7qwPaBpmnEoN95ESLdS AeJ6//0f9F/X/J8m6x6f+VOq4BLCmgJ/4P1W9xKOMvK7vICdyRoYmJmehf+ibwuRc6c1 sTbWkxIxlkuZSPkAK2CkUr+EeeJQvF6YKDZiY54L4E08K8aZSwLezyHAdF11KpXeQk/Y 4//Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aaI8htk1; 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 d29-v6si916056pfb.232.2018.05.15.13.54.22; Tue, 15 May 2018 13:54:22 -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=aaI8htk1; 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 S1752751AbeEOUyT (ORCPT + 29 others); Tue, 15 May 2018 16:54:19 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:34370 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752642AbeEOUyA (ORCPT ); Tue, 15 May 2018 16:54:00 -0400 Received: by mail-it0-f66.google.com with SMTP id c5-v6so14063857itj.1 for ; Tue, 15 May 2018 13:53:59 -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=D3N7W54F0ZPkdgLap0aIOEK/9V7dheITVPxXL9WueC0=; b=aaI8htk1b/jN2V0OKUGjQaedzxYsEJbuzR7/72euqPeC1VGXXs/oWiisdetOr69HDn /2FZa+aWQAK3wRXZyTouQ+ONShmdI9BGFWHg09f0ZUsaQfeqWL3C+x0RrYM3jiuHdIzT RlMXWThDhr86vPy0EfyvIL/0mKJRnWfXtCIDE= 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=D3N7W54F0ZPkdgLap0aIOEK/9V7dheITVPxXL9WueC0=; b=WouWOBseMmI7bzKKjEKPs0GXBStkPkjXN4SPxvBhdFoqVZGk17OaAbbcmrBa+Dbo8t 6Vu0jKjz/0hH2I04WMsXSTQNa+c9q0gQvhWAKsmDqnuGo2VgIGm/ziQG9fGXgGPBfmo2 1o2c3mdgezdetwstuH8ktYjdY+kt7Mc38SW39UUFGtPqe2zWStZ7dCyuO3gCPEgwVHGk OjIF9G19Eek6gJ9gykYp1QJnihB7yFw0tDBN/68jLgOKmnzoNSC03eMu64JROQbOXhHy 72dkYKOQK4JbDY1Uy6mJFWm/ek6w2Ma9yF6x+gEk6oot6LDA/pt1BFdd38qbKdamP36x aOXg== X-Gm-Message-State: ALKqPwcLEYL8L3yIOJ9uijyVukStXvMBTzdS3J/YfQoBYrKTQRgM0T2H wOehAjoFNPkQreNiWIlHvr9qtQ== X-Received: by 2002:a24:ca87:: with SMTP id k129-v6mr16253686itg.140.1526417639296; Tue, 15 May 2018 13:53:59 -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 t9-v6sm440407ioa.82.2018.05.15.13.53.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 13:53:58 -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 5/5] remoteproc: Introduce prepare and unprepare for subdevices Date: Tue, 15 May 2018 15:53:45 -0500 Message-Id: <20180515205345.8090-6-elder@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180515205345.8090-1-elder@linaro.org> References: <20180515205345.8090-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 --- drivers/remoteproc/remoteproc_core.c | 56 ++++++++++++++++++++++++++-- include/linux/remoteproc.h | 4 ++ 2 files changed, 57 insertions(+), 3 deletions(-) -- 2.17.0 Tested-by: Fabien Dessenne 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 */