From patchwork Tue Jun 26 12:11:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139976 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5161987lji; Tue, 26 Jun 2018 05:12:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIj0XgxNrKZsb1EFxRzLHJ85jLeI7mY6K8qryrd6bs2qN4itAvxPkXaHMRU9bBBfulFwDuq X-Received: by 2002:a17:902:70ca:: with SMTP id l10-v6mr1378842plt.174.1530015138707; Tue, 26 Jun 2018 05:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530015138; cv=none; d=google.com; s=arc-20160816; b=GsyPt5JEgXEx8y+PB+pjNXj3JDwKmStQ3tg6aeiHK2hi5ng5pq72TuZnoEGNPFMFii VNy4jexIznMPE5nIZ/FrAPD1znVdJjh3GhjPWXtfegvhvvJUJ0mwGGkzBMMVOPBeh3YI Uzs8NQky66J4SMoljxQgKB5D/Z6SgN6H8J7IJZ48MuKAv6i3Zva2Qo2t+m8F65ySZ5dW S/MWkRtkT4L9BkZ5vUTNpL6IOjqI3AC519A8JlRWm9sln3readmObW6z4ypiDhM1D3dM gizY9MFplIjkouDzgZrMF2/k9DOU+Tl6gTl7HL0c2SN/0cihdPqfOcd0llO47MsaiYvn HQmw== 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=KUWr3sUam7AxtX0IcmLHuD9btenxzAh1xvCRgQlImR0=; b=jVvvjIgeBACk7hECKry9EXNxyvrKYoR/Ef/qXxRKQK6ZJ/TC2N/ccRHJvnjldJylP3 bXcR2uC7h/7P8AAb6fZatmU5QgqDaRBy3fw1Owpa64dEKB2wpbarkrxO+s2QOicEaiVp /uVoRiMbde/s9mXvXNKxXrpDGKWUjKnT5dKgn+cO2CSVU5fwFCrC9MC7R03xsJW71hO9 lp/28PIRlEf5+QuMhhrM4mUp0PwfjAMT0Q3kkJ8i1j7/cZtuTQTh6kuwsCLPLL1qRFSE RtQQHS9F+H2k51bVfXNnUUAHgG6Jz3hwMBgpHYdLE6UGk8iZJtXNiyb9g3vd4vOaJoOQ o5TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fvwOA5v8; 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 cf13-v6si1760748plb.175.2018.06.26.05.12.18; Tue, 26 Jun 2018 05:12:18 -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=fvwOA5v8; 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 S935324AbeFZMMQ (ORCPT + 31 others); Tue, 26 Jun 2018 08:12:16 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:36533 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935251AbeFZMML (ORCPT ); Tue, 26 Jun 2018 08:12:11 -0400 Received: by mail-io0-f194.google.com with SMTP id k3-v6so15758533iog.3 for ; Tue, 26 Jun 2018 05:12:10 -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=KUWr3sUam7AxtX0IcmLHuD9btenxzAh1xvCRgQlImR0=; b=fvwOA5v8tpw0xv0m35CcoOsJWbPOnvkn1SCUOX4abcUGDAMYuGm2ZE3CK+R8ayXMrF V8xaTHYtThBspjtLcMHb58wjnRGwbzWJkjZuqZRXXZ2a1iDn9xzGvqW9iVL9HiTkC8m/ CWCniReO3bTFntgEID4TEXsjaAK8VS1RYHR2A= 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=KUWr3sUam7AxtX0IcmLHuD9btenxzAh1xvCRgQlImR0=; b=RTY+/guiN4kqYz9UkTDk8//KxIvF6RptiSZgAzEjAidLonNXNBHFfPo0hHVvXB+Jfe izD6sDP6a4YcSqKT5bR404W1odB69DLATvedXcboalaukYjZ+ryz7oSUe9u0Gi5cvwZA 4Hc6SOoj0wG9+krP/sqsm1rbDxoS2XweaAriLiGEmEcqzmIsi0lY/jAnHsZwDd0gKHq3 Wja4Ptp87RqCG6OBCOcVb1IrK/CpbdXNCPV0Kfdq/Mw1QKEc0OyPDbntvePWJ9tBP9ew gmWEtVneIe3NQKFLU3gFtsnOkB70eXrOALyO6t+Sp7hJicThtm+u0YaPvU/oeY+EkaqL 8Taw== X-Gm-Message-State: APt69E0iDkAKfpUT/GSnaatgwrhSPwwDIrH4mXyKlhGlL2gKb18DG8UC /V3ByYjEm8wG7wMh99lzydSxeg== X-Received: by 2002:a6b:bd43:: with SMTP id n64-v6mr1041947iof.254.1530015130282; Tue, 26 Jun 2018 05:12:10 -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 y62-v6sm902309ioy.88.2018.06.26.05.12.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 05:12:09 -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 v2 1/5] remoteproc: Rename subdev functions to start/stop Date: Tue, 26 Jun 2018 07:11:55 -0500 Message-Id: <20180626121159.7267-2-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626121159.7267-1-elder@linaro.org> References: <20180626121159.7267-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. Tested-by: Fabien Dessenne Signed-off-by: Bjorn Andersson [elder@linaro.org: minor comment edits] Signed-off-by Alex Elder --- drivers/remoteproc/remoteproc_core.c | 30 ++++++++++++++-------------- include/linux/remoteproc.h | 14 ++++++------- 2 files changed, 22 insertions(+), 22 deletions(-) -- 2.17.1 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 12:11:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139977 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5162002lji; Tue, 26 Jun 2018 05:12:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLwA8qAdyUip/B/Ayz+zdU9Jt/vOKp+ZJUgxwIXkuB2A2MJ/uTHO6h8DfyRJopk7hR3v44C X-Received: by 2002:a17:902:3343:: with SMTP id a61-v6mr1319842plc.241.1530015139432; Tue, 26 Jun 2018 05:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530015139; cv=none; d=google.com; s=arc-20160816; b=0KvzbV5g2JzqQDiTE96RjkLOJ2KDj1BCkq2PJtysQiblZpkPKDn9N2tdH2Pk/p4wNw 9ExPFmqn/B2A+slfPLDDKOUyDYs4RizQQaV1LoKa8kfOXf96TAqYBz5npWXNOo57NZKj cNduyP2iX4NhVYqBE5ZnWHwovuOPtZ+lRPDX27ln4OAvyj6zZuFkfcE+mMrF0AAfWa83 ORi5udyljBA1B35Tkt+qjCq6th/Iew/KnhPg6aDpRMexEVzTqtoY/t2KlsDRVvBjb0Ur racafjR3EOmeNTexQTo+3CatDvAI6P4BW3W1Fz0u7sw+kbpinAuyKMOF/ujwgNw4x6yg pchw== 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=I57NxyETdS7bcU1Jd7YbgD9UZcuzgAQvo28u6b2l6Ek=; b=lXB9IrtQIeRHM/XENkHX74TrYJzbQO9dCUXWN9clnDmHwuBpnuZShfhiLqOLny2x0Q TJXuEOCot/VtVuLAiOjYj9d7DYKFZSPe9KGAEJQZNn9jgzzz1qDaS33q5voO6w4QNGpt j5BCLiWoaWin8U5SG1wFFWHbzG7epCBT8H5PZ43edPdVDdn7IzOe56ZdYtZEpXWupiv+ 7TTFXz+m8Sek4kn1ghQ4mfZZnnXvFL0Bu0w8Hoc/MPDdkI2Sf67hO8mdpDLPD6mMWUkC zSnxRYNh/jKQTcI6tLPpH2cGslfeaKWGZUnjOihZ1tFTUm/VP5WJfrogtiSJDfamS3VU TXYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BVwbcAdx; 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 cf13-v6si1760748plb.175.2018.06.26.05.12.19; Tue, 26 Jun 2018 05:12:19 -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=BVwbcAdx; 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 S935361AbeFZMMR (ORCPT + 31 others); Tue, 26 Jun 2018 08:12:17 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:45869 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935259AbeFZMMM (ORCPT ); Tue, 26 Jun 2018 08:12:12 -0400 Received: by mail-io0-f195.google.com with SMTP id l25-v6so15718743ioh.12 for ; Tue, 26 Jun 2018 05:12:12 -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=I57NxyETdS7bcU1Jd7YbgD9UZcuzgAQvo28u6b2l6Ek=; b=BVwbcAdxesZTOq5UrKvkrChLRF5weLtcqKkXCG0YUfp1GFLov9QwNdaLbXqjaI0fGu gbFFj20V6O485p8bHFJCLk4l4p3MpTvRHc2guDHAOarlbdUHyZtlIUQq8dq9wBxhGCS6 8c7S392FJLxTohv/drjaHFXaxSo54ZbfFERgo= 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=I57NxyETdS7bcU1Jd7YbgD9UZcuzgAQvo28u6b2l6Ek=; b=W9CuHFiG7bEOTTcJCSgGTUAKE0x8nyHycB08PR1WcP66K1hAxy9z3Qa7DwxQ3N3zFS Ypx5KlBysTUU06IC4MVpyzaiTkvNglGiXumuAOnbNTeYU+Z6wIsjp4G/Ql6sN9271zeb /r5qyjUK5HMQgHdUP82Fo97K5mWdBgNrOfEOlS7vEFOb6w/lDdO6ctTOl7T/NTakGDiL 5/qGJywbskyW+j7R4Gv04Nlh015zDFxuon34S8ULviTg/84DXN6ik9Jtb5oU2IxqxiYt f6FBpu5EfL9bbHoI1q0WhC9xwWNZMIBcTn4jaaDRK7RMp1WnomfJhxW3LmRcCbPFE1r3 zSeQ== X-Gm-Message-State: APt69E3vd21Wghs+ZEk1uposB+Qf/5AUdWy8P1MZ/uJyhTXFAZBD2Crw OoCZBfPjjvER68D83BM/RlCMwQ== X-Received: by 2002:a6b:144b:: with SMTP id 72-v6mr954408iou.218.1530015131335; Tue, 26 Jun 2018 05:12:11 -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 y62-v6sm902309ioy.88.2018.06.26.05.12.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 05:12:10 -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 v2 2/5] remoteproc: Make start and stop in subdev optional Date: Tue, 26 Jun 2018 07:11:56 -0500 Message-Id: <20180626121159.7267-3-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626121159.7267-1-elder@linaro.org> References: <20180626121159.7267-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. Tested-by: Fabien Dessenne Signed-off-by: Bjorn Andersson Signed-off-by Alex Elder --- 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 12:11:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139981 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5163234lji; Tue, 26 Jun 2018 05:13:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfzlnMD6nwX8yua+IednL6ALGk7xgi2UrSV/XRX2vrO40HE/laaCRC3ZI8kbZaA0RHQiQ0o X-Received: by 2002:a62:190d:: with SMTP id 13-v6mr1304533pfz.103.1530015202600; Tue, 26 Jun 2018 05:13:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530015202; cv=none; d=google.com; s=arc-20160816; b=LhwJX25YG1rJaLzFoinzMDr/kru66ipU7LbYVzG5g+vCHS/aVXQuiNt4bB9ZTYI7kq Maamth+jScoePYP8YYpSfEeSg+VK9vl1sZF5DSwcikMIQ16oKNRulxTKV25oWVaPqGsJ xfGvJKJjQizki7w/RrwgnjwN/DMygwjLhYOp888tiPpr5dCPZe8LpKtoqm+bkJzqj1Qi NLkalClyBmu8fHuCk3E/IZImbxyKTo+qDVRYu7PiBfb5IIOZIAXefFTQNlD0pLo915dh 6E5CZoqZUx25c2vLWamfORMASEFyEVMD4iST+0auwULplbZFpNgTL1jS5rTHmA8zhFCC eZvQ== 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=BpRBNnuSyudwPjaxcE+Fto06lTyc9rmYe1wAQDQ8ptw=; b=gmlEca8DEAMj2BisLRekY8C5Fnfs3NgV8M3wmm+EK54lFVH1EniebkNtieeGWlULni 8IYfg+yU3ADff2Azrhs9ch0yrVEaFmjbzjgX4N5Wf3ux4fhqNLUxkgyc/x1Gicj2EyT6 dn/I+uuR1TlDGUFGNavYfMp9T8c4XfifjHo1qaf8WnsJgFg8P6ayqyIgePZg5bKgEv2f jWCa7fVvS+Xrt6YGFr12tp009/Wn7hUcGMMjEKesDGejw5jpDGLWHnHiyt6m/rZrHI/d 9EfhfxzI46ervF5jB8mlT6AfxMf4xsUUt+KCkmJ3QF8WJu5aJ3Sp82/4QfxdSzYJi10a 6q/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JDyYULqA; 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 p25-v6si1506205pfi.345.2018.06.26.05.13.22; Tue, 26 Jun 2018 05:13: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=JDyYULqA; 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 S935426AbeFZMNV (ORCPT + 31 others); Tue, 26 Jun 2018 08:13:21 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:36653 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935260AbeFZMMN (ORCPT ); Tue, 26 Jun 2018 08:12:13 -0400 Received: by mail-it0-f68.google.com with SMTP id j135-v6so2001100itj.1 for ; Tue, 26 Jun 2018 05:12:12 -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=BpRBNnuSyudwPjaxcE+Fto06lTyc9rmYe1wAQDQ8ptw=; b=JDyYULqAGzh9dv097FnJfnyVfMozvKfKniiHCr1mS+m7s9Rrdesva0LLh/IV/JxBHA iCZ54dUR4Mne5qmAu8Myhm/26R1d6qL4QWrLJQ1osp3q8t00fDEOWwj0x1HWtTpoXVzk FRfV7dVnmDhBSLONVp6+3SYwmIO7EGVGD8EYg= 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=BpRBNnuSyudwPjaxcE+Fto06lTyc9rmYe1wAQDQ8ptw=; b=KAbYxpCvGoyFsUjXZgCtrX2BCGUwKQ/gYFK6JhzyERggecc3eswzUlomtu4ZSiRtB2 VQE7zxq2zcGxUqyb9mR+3k7z4/Z/yiqdlglxGx1THy4E0x35pq2l1N8NjLxqusx5dLSb CxuqeGRyNX7EF1Jy9tOemnbbbacANVyeEYcJ01cErgqB2xOrL/S31+tReq0s9MuX2NPN lkvzGBiNSv52GMnsvWSxu7fzajI696hA80m/AKptDpj0TNfLCP3xK/X5ILmKaS1qOaWE lNERKiWU4DT7GqbvwQujEcXFhfb6vhn4TaZ0QOte4+YF/RFm/7y7BCR8CWtMJj94K+SP L5IA== X-Gm-Message-State: APt69E2fKqrH8jo6qpiRiKr5Dt0mFYIhh12s/iFBAMlt4nvdrbbgOM6e J/Y6HuGQjuoxY3ZL/5GRHZ3hEQ== X-Received: by 2002:a02:a999:: with SMTP id q25-v6mr982712jam.47.1530015132297; Tue, 26 Jun 2018 05:12:12 -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 y62-v6sm902309ioy.88.2018.06.26.05.12.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 05:12:11 -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 v2 3/5] remoteproc: Make client initialize ops in rproc_subdev Date: Tue, 26 Jun 2018 07:11:57 -0500 Message-Id: <20180626121159.7267-4-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626121159.7267-1-elder@linaro.org> References: <20180626121159.7267-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. Tested-by: Fabien Dessenne Signed-off-by: Bjorn Andersson [elder@linaro.org: added comment about assigning function pointers] Signed-off-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.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 12:11:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139979 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5162742lji; Tue, 26 Jun 2018 05:12:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLtMaEEgO2CFl+RFMnlWy33eMi3ALCWXXqVQ1C8FWZovWIM059QDH2jUY9LTk1NZYghG/0j X-Received: by 2002:a17:902:321:: with SMTP id 30-v6mr1416626pld.122.1530015176611; Tue, 26 Jun 2018 05:12:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530015176; cv=none; d=google.com; s=arc-20160816; b=mxaWDOcPDsUqEKDPhDEpM/NrF+cTbPGt3PUAO9xtwmPPR7/F+sZ7pZASgTeItqnLnw gibOiP8Ee3kDpcn0nK/MHeEaD835fubrHNZsLEuSKuG7YkzSHdd8bXy5zAErEpJkImIs 7cfsjyTOZSBkRUTN9k9/6D4s5X4tkV3UvNKsukBaAdNaT6Ar1lYEVjZb0xsToC/sq80L Dmj0qLik7j23G8M50AsC1B1xZRH5yses2OEa/1U/PrlkAt8y/QGeo2UcPHbmrTOL+cSm MXl60WkP7Qt5KPAcUdGGd0fIwOl8zqTgyNItM6odcBx7E66TQsQE8mV1xRK5hcWHVYCT 8tGQ== 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=Dml+my2/w2gAe9jnCW4w4fKNsyHGv1cJooRXIxNvLLk=; b=X7BzI/gynyEo6srTSfSa9oTaM4QX2LBmuaBibhAJK8ql3bROtd7q0HgdjxxUSYssN/ 9xdIBVBuBrGfYSUWQEXhjN+QwCC4FqitOCUlSO8ctVrq5RsYcRtkvNtpoemlHdtFjvwN a43I9Vf6alRpRHkw9tjyhGpIN/ho436528TRg2mjGZG55lAMhsQcIQ0CAElEtUCqagKU QauRYF8/gsu4+KMTRh09FbNZv78HPzVzeRvxJTYo6vmxUmgam4eC2ATWiKiEd7OOaMnh W6si8W2qTnP9MAhpV2n0k8bQ3H+MvNqZwqwHv3CVvWn4MR1afDhzg/pD+DUGebuRDo5b VuZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DiCMCwDf; 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 m37-v6si1385714plg.491.2018.06.26.05.12.56; Tue, 26 Jun 2018 05:12:56 -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=DiCMCwDf; 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 S935421AbeFZMMy (ORCPT + 31 others); Tue, 26 Jun 2018 08:12:54 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:33728 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935265AbeFZMMO (ORCPT ); Tue, 26 Jun 2018 08:12:14 -0400 Received: by mail-it0-f68.google.com with SMTP id k17-v6so15191650ita.0 for ; Tue, 26 Jun 2018 05:12: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=Dml+my2/w2gAe9jnCW4w4fKNsyHGv1cJooRXIxNvLLk=; b=DiCMCwDfm45FgCCaAFvtTkfORC+UUxgLHZLqQv03tB39ijXozyk/RevAsUjUzWXdrx yqLBjiuAKAdGcYUdPQgM5aOebBziH3lahdxuTjE7bqoEJsCg5alCnzyVy5Oj28KPtHh2 O6VWVxjkbqDT5gVWfsMLdRRuQDSRQOXJLci94= 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=Dml+my2/w2gAe9jnCW4w4fKNsyHGv1cJooRXIxNvLLk=; b=gcOk3jvVxG77A+br+ZH/Pkt6a6xVvBVh0bsAj7vNsy4tzmtpZzq0fD0DIjQw4E6vnu Zh2FB8nTGEkckvXJ2L8NrvMnw0rb5Lc6jXei2mmt8bq133yEaHZeqgz72X+FXGd5rlqB ZQu86Tb5H0YK//+YOzUtBv6vCrSLwwaCk/ZnDdujlk0XT6S2NDDQi7CsjrWWeJ6qxn+u 6foEhJU5muiURNuX5/QSD+Qj54SxjHaYfY0jw3xskitieYLHGi/gmn/azQ3qK1q6F+iJ pvyY9+mMlY8fH/fQ8HmxNxavg3qwaiaeNCn5lLoj9M8306pHYz80M3uWd+gmnMZlYKDA AQNA== X-Gm-Message-State: APt69E3HIaM3x3CkVmsI8xa07+JhiTWyUDzFVcbxYJPpuMg8RF/Oa18B CL5TJdnk3gzsQYEKoaWcHC8EsAdRHyk= X-Received: by 2002:a02:9bc1:: with SMTP id f1-v6mr1028344jal.90.1530015133228; Tue, 26 Jun 2018 05:12: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 y62-v6sm902309ioy.88.2018.06.26.05.12.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 05:12: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 v2 4/5] remoteproc: rename subdev probe and remove functions Date: Tue, 26 Jun 2018 07:11:58 -0500 Message-Id: <20180626121159.7267-5-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626121159.7267-1-elder@linaro.org> References: <20180626121159.7267-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. Tested-by: Fabien Dessenne 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.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 12:11:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139980 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5162966lji; Tue, 26 Jun 2018 05:13:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJAVb5MPaflQpvqoDP0sZJzWkjlzur0MKYRbrpOX9tbLzDlsl921s5FYNJ0rNESYmlRqo2x X-Received: by 2002:a63:6157:: with SMTP id v84-v6mr1143139pgb.390.1530015188387; Tue, 26 Jun 2018 05:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530015188; cv=none; d=google.com; s=arc-20160816; b=gyH7yWfLMcJQ7XKhnmhzCIGlWlp/goW20UFnqJNigsBtJZqjGSZih/yJq2spIbolx0 lFo1rIkJroPKPvwGqPT1NRf0PvRZqT52tAyJj/O4Xmi/5SdJcGgPLdTR/823xO8ll53v OSWoYaDTaBDpz72okvREWtvvwOqL3Cb/2xMjXmc67RLmRT5XjIguaPdJARS51/Q1tgg2 qKN/WSdVijC6YHn0LG2Yx7c4i42WNQc/SMmMV3bjYUXV+gkwgDSojl31vL10tc4d8grF /25IQpo9S/JQUpzFzIiYrAohj57qrPYC/Pta3Q2Y8L3Bmi+zN8i5W1bQpYHPARG9cIsf +X4Q== 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=iIcwdmUNdlnf636DFIJB98bKjleIid836D3MS18gj0w=; b=EVTQEOwgh14c1U8Hdg7nRZ3cm3S7UQb7YYclJKFg1UAx3gZkpvoAB8F3fFiSBfPL7e oO3X5/pz4tw/W6p4pZymf06K6bV0fdBiWY6qrg6lhUSnNog04V3bG6CA6WX8R+vUeOL6 bVWbFL+4AOvMVbtV7WYRSAUHERGBJU7PBxDsxZJziP/yE/YpXP63+SB/2FnDyK6Id8Ld 9NG2aQ5KulfL/bfjxR2i8C/aXIdOOHnK4E2Kq/kxHH0WiPJDkSL6TowRNcEOYfzLwGig ZEh8P/UCdW0Ay3CLcxWKZJmbxU+n0f1dabbLvIgVr78kqk5Gx+778jGgsL3rXyt3FCm4 753Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K2T7RYRg; 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 e17-v6si1277136pgv.160.2018.06.26.05.13.08; Tue, 26 Jun 2018 05:13:08 -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=K2T7RYRg; 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 S935399AbeFZMMx (ORCPT + 31 others); Tue, 26 Jun 2018 08:12:53 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:52321 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935280AbeFZMMO (ORCPT ); Tue, 26 Jun 2018 08:12:14 -0400 Received: by mail-it0-f67.google.com with SMTP id m194-v6so1962205itg.2 for ; Tue, 26 Jun 2018 05:12: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=iIcwdmUNdlnf636DFIJB98bKjleIid836D3MS18gj0w=; b=K2T7RYRgllQMWQ1R68mL0HTNSR0STZWMcs7iGFjDDQVCSdDj3XquLtv7fLSlUj3WzW m2hmeCUpKsJ5b9ftM/AUA3PO3bq8087dZqo/xYNxyX+xX1Qvtu9Sk1sh5b57k4VNzMNQ 9H5l8nPg7dubWlErfkmX/Vdnl4Qkd47KBZi84= 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=iIcwdmUNdlnf636DFIJB98bKjleIid836D3MS18gj0w=; b=fTz2AeHeBejdzwAgzXBiRiZt/cQtoSh1LJmdluPdt9L2pKflpGPPzBppFfKtUr4ooO LIDsWfQidc/bqaF8PXBin3sfswizZ6rPiqSnX3WpFe90cH2/tzKFe3m7Ae2ZtjMsQb2Z 1W38JGPuiUw5ZvM7s4CWOndKiMPVZKz4ZzKOm1RdnmWvfAUg6jUDeUELpCl1vtoW1wRR ASIMUM3PBvfhypaiFOm+lYjq2k6vKmEou39NbzncRnJn54Oalzy7NMZdyfRub4b2UcOi vCl3KMwNikpNjM2ZFfPlJ4kM/fFKt9Hjhb1cLD9EXQn0bMtE9PQyKkTTAm/ioULY2Lnw eT0w== X-Gm-Message-State: APt69E1gfKNz8tZH8xoVsz8x36L0YxfoGB3BNd0HpGeSc9xwhna/7x2D Lzgb4NIVMrMpxlIVAaLz9D0jLg== X-Received: by 2002:a02:1857:: with SMTP id k84-v6mr1016959jad.3.1530015134249; Tue, 26 Jun 2018 05:12: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 y62-v6sm902309ioy.88.2018.06.26.05.12.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 05:12: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 v2 5/5] remoteproc: Introduce prepare and unprepare for subdevices Date: Tue, 26 Jun 2018 07:11:59 -0500 Message-Id: <20180626121159.7267-6-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626121159.7267-1-elder@linaro.org> References: <20180626121159.7267-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. Tested-by: Fabien Dessenne Signed-off-by: Bjorn Andersson [elder@linaro.org: minor description and comment edits] Signed-off-by Alex Elder --- 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 */