Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1684869ybz; Thu, 16 Apr 2020 13:39:24 -0700 (PDT) X-Google-Smtp-Source: APiQypLR9EhB7Lnwp0VxkhDKV9MiXrz5Esk7bEBMdJrjvXgUN45tFBtBFJhi49xOfhdALjTEkV7P X-Received: by 2002:a17:906:2558:: with SMTP id j24mr11739502ejb.72.1587069564158; Thu, 16 Apr 2020 13:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587069564; cv=none; d=google.com; s=arc-20160816; b=mAOaqNBLXraqNjzkyQQa2Ioj54kZ/cj8lS6uETLjvIMDISbW6+ZNFQX2YUHbKKOeyP Mul8jsRi5txwEpdGRNpKswMXZ2VuDoGu5zBi2z5rTyyzjNeoB7UYMBXPX/1vX6QaaPbn RomjZmHDcI2FXk6CJDUHR1jdlMXnTV1Yezmox2PB/STDbvFxxkGCyUZMvVuV3z6Q6toJ eydoSpX8PmlOYAwAj9LJ386eb1iUNi0ulus3Ok7ucsP3d1HS3qVDsWQmtFf/qtwmfzhC 6jZnNrpODfRcjHy5m4OHU6s9AIb+c23+5TWcQ6mEEDirAPDApRBim0CMZzzfearz8mab +hBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=HSxCJna+r5+8UesgNfnHzloc46YrqYjXP5KDUxOljAY=; b=WtEusB0PhMfKWMaeWSF85ymtcIdclH0pt8sM+b3ilTeBNj++I3d5KledWw/66uRjFq A76EnUkxJ6enh48Bgk2NKLHEauwqylJ/is8RHICcv6H/lpsR0yq8xRKx4VGCxE+a6Mkh Qv+hVvOAEwd1nyFoZbyV7jSjdELfMp5qudM2biPIOTyg/RQN6vP171SaV2EANSEnJCvE HvdHe/K3+ZNzpTRZQGIuCq6USho01VVDn+zYehQB8oud+8PKalMlEfvqlvsHesGBJw3t qJw2emJOlV0grFErpAWtNwegUgVpkGXB6Z77CWDEuY6ArNzGJa2HDYtLbI3yn5y+WayA 5y4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b="RToF/KLF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si14914299edg.339.2020.04.16.13.39.00; Thu, 16 Apr 2020 13:39:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b="RToF/KLF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2636655AbgDPQOk (ORCPT + 99 others); Thu, 16 Apr 2020 12:14:40 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:46907 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2636317AbgDPQOV (ORCPT ); Thu, 16 Apr 2020 12:14:21 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03GGCFET010375; Thu, 16 Apr 2020 18:14:17 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=HSxCJna+r5+8UesgNfnHzloc46YrqYjXP5KDUxOljAY=; b=RToF/KLFRTZwOODwY0YFkp6PU/uVLUwzjIT/u1mhdzeeOjmZe16DAIuogtvAxUR6MM+L D4zJ2fLpyHChxRI6Pie4fI4YExEGmnVWMjKwYWAIZaRab2sgZUktMVHxiLnsuZbhc0X+ wCIh8D9W9KvCs1coz6G8J6HWFC2w17PoOraFTnv9sANOFWjGZRe0Fgh7Zb+PxAkEX19c G+905Q4DlkQ6QP0OV1HODDTbIKfbgfwnLHpQRR60c9YdnHj4lzHd7pSTylHn6+fMBwJ9 9oo/Op+t+QVwxAOi//OMP81JgbrhfNA/ASaDN6/bzPohuoPPEqlLQMv7COPPAHOU3P5d Pg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30dn94kmvm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 Apr 2020 18:14:17 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9890C100034; Thu, 16 Apr 2020 18:14:16 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 8C9202B2D2A; Thu, 16 Apr 2020 18:14:16 +0200 (CEST) Received: from localhost (10.75.127.47) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 16 Apr 2020 18:14:16 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Ohad Ben-Cohen , Mathieu Poirier CC: , , , Subject: [RFC 07/18] remoteproc: Add component bind/unbind for virtio platform Date: Thu, 16 Apr 2020 18:13:20 +0200 Message-ID: <20200416161331.7606-8-arnaud.pouliquen@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200416161331.7606-1-arnaud.pouliquen@st.com> References: <20200416161331.7606-1-arnaud.pouliquen@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-16_06:2020-04-14,2020-04-16 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add component to declare bind and unbind functions. Theses functions are used to ensure that the remoteproc virtio device is probed and registered as a subdev of the rproc device before rproc request the the prepare and start of the subdevice. Signed-off-by: Arnaud Pouliquen --- drivers/remoteproc/remoteproc_virtio.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c index 2a0f33ccd929..e1d7371d2d64 100644 --- a/drivers/remoteproc/remoteproc_virtio.c +++ b/drivers/remoteproc/remoteproc_virtio.c @@ -10,6 +10,7 @@ * Brian Swetland */ +#include #include #include #include @@ -426,7 +427,8 @@ static const struct rproc_subdev rproc_virtio_subdev = { .stop = rproc_vitio_stop }; -static int rproc_virtio_bind(struct device *dev) +static int rproc_virtio_bind(struct device *dev, struct device *master, + void *data) { struct rproc_vdev *rvdev = dev_get_drvdata(dev); struct rproc *rproc = rvdev->rproc; @@ -483,7 +485,8 @@ static int rproc_virtio_bind(struct device *dev) return ret; } -static void rproc_virtio_unbind(struct device *dev) +static void rproc_virtio_unbind(struct device *dev, struct device *master, + void *data) { struct rproc_vdev *rvdev = dev_get_drvdata(dev); struct rproc *rproc = rvdev->rproc; @@ -504,6 +507,11 @@ static void rproc_virtio_unbind(struct device *dev) dev_dbg(dev, "virtio dev %d unbound\n", rvdev->index); } +static const struct component_ops rproc_virtio_ops = { + .bind = rproc_virtio_bind, + .unbind = rproc_virtio_unbind, +}; + static int rproc_virtio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -548,14 +556,21 @@ static int rproc_virtio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, rvdev); + ret = component_add(&pdev->dev, &rproc_virtio_ops); + if (ret) + return ret; + rproc_register_rvdev(rproc, rvdev); - return rproc_virtio_bind(dev); + return 0; } static int rproc_virtio_remove(struct platform_device *pdev) { - rproc_virtio_unbind(&pdev->dev); + struct rproc_vdev *rvdev = dev_get_drvdata(&pdev->dev); + + component_del(&pdev->dev, &rproc_virtio_ops); + rproc_unregister_rvdev(rvdev); return 0; } -- 2.17.1