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);