Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2222891pxb; Fri, 5 Mar 2021 10:03:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwU30eNwLiJw5iuDURrPHfIloAL4hDJRiptO4gTDo1zZgpm1kK7gLD+/tHWwR26yjG41qJT X-Received: by 2002:a17:906:2dc1:: with SMTP id h1mr3460387eji.460.1614967426530; Fri, 05 Mar 2021 10:03:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614967426; cv=none; d=google.com; s=arc-20160816; b=0SsgInQ+B/eD7knMo4c7evtjTMwvZ/rv0dMX+ZPNOX5LPrw+yFQ5mju5fMrCfpr1uM ZFmltBORhMet0CvIGaist9qFnE4UUWbbdrd9ZBrBqrUPtNSu0fHkCZc0Kk95+eWBYpAi +f7pd2tkVzMyUCZw/lFlFb1OZEUWsgYOliaTJbNRCFXj1ZuGLjGFDRromu6AUqzmZ69U SulzdwE0pgA8vyYhYDq8caUXgvi4rMZIeG8ZrnCkbnsheAQg0ij8mWjEpX2ie4MyiSg8 IV4H0qEUevHxuOCio5gj+SLitWtvDop+EnPQDt9cBBgja1m7p0keglJWVizbporhLkKx CjPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VKk7Lw9rNrZF7cjZoXQtqz9ifc+AiOgTohH4rRfp/Cw=; b=KYv4HugL83KyGgSdHOdTb/brsyg3WWezTJSuRxm2If4RtsUsahAQmaGV75/+w4N+gc rTQXbA2acq5T8l9cnv4USxtP9QAd+SyH6Fzm+J09L228IQHVfQ9SZj1HVvZG+s+HGauc OK9zyGfpkx+kKuF/Fgkc0DrCeuYVUlq9AgkN3WR/mEpYOf3poYc3iw0+gnloLn/bpuoR Cz27YdXasW3BHb3vN8fO8lFlgTuV75pY0Guc2o3kXaWXecV41DdhObL1wxl+MscHTH8o HyG7O2DKuiyvXfkocW6s+qNBd6imeiTbkDBs+0zdsIwalyxZowGeoJrWB+l3TZpdKZ+o mmYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pMN8yASc; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n22si1745705ejk.360.2021.03.05.10.03.21; Fri, 05 Mar 2021 10:03:46 -0800 (PST) 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=@linaro.org header.s=google header.b=pMN8yASc; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbhCESCU (ORCPT + 99 others); Fri, 5 Mar 2021 13:02:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbhCESB4 (ORCPT ); Fri, 5 Mar 2021 13:01:56 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8372AC061756 for ; Fri, 5 Mar 2021 10:01:52 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id o38so1897333pgm.9 for ; Fri, 05 Mar 2021 10:01:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VKk7Lw9rNrZF7cjZoXQtqz9ifc+AiOgTohH4rRfp/Cw=; b=pMN8yASc0+EWiw43ig2F4gk0UaX/YjEIQKPVPJ8nHq6aulAeRE6YXZ5BNl1qwjjEtQ f9yuaaxQb3QH889tdKg3Kaf9TPi4eLTfM9VgFSHODAmr12YcQMe/UPjerpMQhJcRaBYO 2mwfIkx9iER1apwv6cLnZ1jiaX9Zt7Ryg1HUOheiOZXmsx92wfcH2885BOZXAC0FUHgz 1rCUK+uv3CqIrX5CWlmhQdLYwDVY7EBfoCv6wQwjJ0UUnvUL+IA/6vzYWmCISDmF7Gwh 7cYrb/2QDk8S6+aged04oklsRrMtsC1Kl9H7si0r6GJD7cQwqrynU1UlZAKbtH9srNCH 9xow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VKk7Lw9rNrZF7cjZoXQtqz9ifc+AiOgTohH4rRfp/Cw=; b=nuU4bQDOX5plk4Tkl56fl5i4+n/Wl1I6iYFv/cHCvi0WjSP++d4y3FFpFeylswyfpz TuZDuxEwx4c4W/480PkNusbbcPN57g8MAYD+bic1HpwV8PyRyxmKm9ngCipkDNroR7Um 4GQcx7JkogXVNwl4NCFxxpTi/r29Xwn3MQjJeJpTx+g5jpsYcO/VV9+/TQwipB5SeySU eXC3Jc+IVVcsk+R5UXfROe79Sq4UJHOi/bj04otB6UKx2i3rrHwP2P1aw+LZlOZy1DiP gK9QzotLoZyeefieBi5TQ54FAQeID7zZw9S01ROI8/TzQ2VWsLOoTZko9jYYYQr/X8EW jwkg== X-Gm-Message-State: AOAM533Efgc6vpx/GU4p8p1XAxQgMeLY9P+TsYjwjK8dwmS2PUGDdSeq GnVmL9jSNmds4fJCc+hJSCgeMWhOl6Noog== X-Received: by 2002:a63:f63:: with SMTP id 35mr9923357pgp.119.1614967311850; Fri, 05 Mar 2021 10:01:51 -0800 (PST) Received: from xps15 (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id y8sm3348761pfe.36.2021.03.05.10.01.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 10:01:49 -0800 (PST) Date: Fri, 5 Mar 2021 11:01:47 -0700 From: Mathieu Poirier To: Arnaud POULIQUEN Cc: Bjorn Andersson , Ohad Ben-Cohen , Andy Gross , linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH v5 13/16] rpmsg: char: introduce __rpmsg_chrdev_create_eptdev function Message-ID: <20210305180147.GC3885132@xps15> References: <20210219111501.14261-1-arnaud.pouliquen@foss.st.com> <20210219111501.14261-14-arnaud.pouliquen@foss.st.com> <20210304185520.GC3854911@xps15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 05, 2021 at 11:46:47AM +0100, Arnaud POULIQUEN wrote: > > > On 3/4/21 7:55 PM, Mathieu Poirier wrote: > > On Fri, Feb 19, 2021 at 12:14:58PM +0100, Arnaud Pouliquen wrote: > >> Introduce the __rpmsg_chrdev_create_eptdev internal function that returns > >> the rpmsg_eptdev context structure. > >> This patch prepares the introduction of a RPMsg device for the > >> char device. the RPMsg device will need a reference to the context. > >> > >> Signed-off-by: Arnaud Pouliquen > >> --- > >> drivers/rpmsg/rpmsg_char.c | 23 ++++++++++++++++++----- > >> 1 file changed, 18 insertions(+), 5 deletions(-) > >> > >> diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c > >> index 09ae1304837c..66dcb8845d6c 100644 > >> --- a/drivers/rpmsg/rpmsg_char.c > >> +++ b/drivers/rpmsg/rpmsg_char.c > >> @@ -328,8 +328,9 @@ int rpmsg_chrdev_eptdev_destroy(struct device *dev, void *data) > >> } > >> EXPORT_SYMBOL(rpmsg_chrdev_eptdev_destroy); > >> > >> -int rpmsg_chrdev_create_eptdev(struct rpmsg_device *rpdev, struct device *parent, > >> - struct rpmsg_channel_info chinfo) > >> +static struct rpmsg_eptdev *__rpmsg_chrdev_create_eptdev(struct rpmsg_device *rpdev, > >> + struct device *parent, > >> + struct rpmsg_channel_info chinfo) > >> { > >> struct rpmsg_eptdev *eptdev; > >> struct device *dev; > >> @@ -337,7 +338,7 @@ int rpmsg_chrdev_create_eptdev(struct rpmsg_device *rpdev, struct device *parent > >> > >> eptdev = kzalloc(sizeof(*eptdev), GFP_KERNEL); > >> if (!eptdev) > >> - return -ENOMEM; > >> + return ERR_PTR(-ENOMEM); > >> > >> dev = &eptdev->dev; > >> eptdev->rpdev = rpdev; > >> @@ -381,7 +382,7 @@ int rpmsg_chrdev_create_eptdev(struct rpmsg_device *rpdev, struct device *parent > >> put_device(dev); > >> } > >> > >> - return ret; > >> + return eptdev; > >> > >> free_ept_ida: > >> ida_simple_remove(&rpmsg_ept_ida, dev->id); > >> @@ -391,7 +392,19 @@ int rpmsg_chrdev_create_eptdev(struct rpmsg_device *rpdev, struct device *parent > >> put_device(dev); > >> kfree(eptdev); > >> > >> - return ret; > >> + return ERR_PTR(ret); > >> +} > >> + > >> +int rpmsg_chrdev_create_eptdev(struct rpmsg_device *rpdev, struct device *parent, > >> + struct rpmsg_channel_info chinfo) > >> +{ > >> + struct rpmsg_eptdev *eptdev; > >> + > >> + eptdev = __rpmsg_chrdev_create_eptdev(rpdev, &rpdev->dev, chinfo); > > > > Shouldn't the second argument to __rpmsg_chrdev_create_eptdev() be @parent? > > This keep the legacy hierarchy: > https://elixir.bootlin.com/linux/latest/source/drivers/rpmsg/rpmsg_char.c#L362 In patch 12 it is clear the first and second arguments are ctrldev->rpdev and ctrldev->dev. In this set the second arguments becomes rpdev->dev, which is different than ctrldev->dev. Goind back to rpmsg_ctrl_probe() we have: dev = &ctrldev->dev; device_initialize(dev); dev->parent = &rpdev->dev; As such in __rpmsg_chrdev_create_eptdev(), eptdev->dev->parent becomes ctrldev->dev->parent rather than ctrldev->dev. > > Thanks, > Arnaud > > > > > >> + if (IS_ERR(eptdev)) > >> + return PTR_ERR(eptdev); > >> + > >> + return 0; > >> } > >> EXPORT_SYMBOL(rpmsg_chrdev_create_eptdev); > >> > >> -- > >> 2.17.1 > >>