Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7939846pxb; Fri, 19 Feb 2021 03:25:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOujwz4iISlXJO8PUE9XSi8j9+6zhiftTA0ePmHI+KutrR+lE2aGBUtou9qPIUe0Ser6vt X-Received: by 2002:a05:6402:1854:: with SMTP id v20mr8570127edy.56.1613733931194; Fri, 19 Feb 2021 03:25:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613733931; cv=none; d=google.com; s=arc-20160816; b=FsHz4SwzApwhYxZ5TA/V4J9XtVjmbh9OqiVv9qEsAemllXvrUhA4lS/NDfcqLL9FR5 mY++hx1ccqvoK/jQ99sYL7mjw9SvU5Q41xesC25i+8w6sIGe31hbhAW8q6wXwl9WYt8q 785tMumKqnNwt7FfDvNjGFPP2/iEvTkQBEWCMPGdpcBEQQ4hWkP3NNJ5rKZ+owjaoi6X G/9BVlyEBAsMGhRbHL6pnd93v3fwt9tQl9sALA2nJGWdlmtg73INU7a4aycd/tcTvlvK Blay1T81MgDOE2PfWSNpbUwL8FBQoXStrzEPLyNGF6R60Ar2pXDJn9FSQbuy3vjqAY+y J/MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=h8BuLQc6wA4LPMA6U4rmS0YJqMj4AsWKDTNSsFE26UI=; b=HteyQhv16UPb2u8YdwCX9A0ZDg/p6wGGFgjXBC7dDcVLLEswVS7QZl3pwwTvGZLLwn CzVn73khfSajBjaT8Z77iAunYw8DW7E9/CSe93uUTG5lbgjvy3AiCaNEpHCZq2c04suO mN1LnUx22EMRPkErU4L8ftegFPbrCyuZAd//FHJ73WopOqPQr67my6m3UVngKrB5pMT3 0GNq/jPM5dA9GbdQrjbQoPrhpHIpE7c+ifozVMizOBMtz539RASHBp9i0/F3C9cxLAcM ve5lry/CLYS/WQjWeZpfwWJangYBSXjp8eCR0NClIDOhAyiSfh29W5q+eH4jpAfRLZ/5 1/jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=ud6971nu; 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=foss.st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cd1si5515905ejb.214.2021.02.19.03.25.06; Fri, 19 Feb 2021 03:25:31 -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=@foss.st.com header.s=selector1 header.b=ud6971nu; 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=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230477AbhBSLYN (ORCPT + 99 others); Fri, 19 Feb 2021 06:24:13 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:11608 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230417AbhBSLT4 (ORCPT ); Fri, 19 Feb 2021 06:19:56 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11JBGj2b016646; Fri, 19 Feb 2021 12:19:10 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=selector1; bh=h8BuLQc6wA4LPMA6U4rmS0YJqMj4AsWKDTNSsFE26UI=; b=ud6971nua46E71EYJn31gu365Wv97tmg+PhXBfb6ZGrWmQLs2h4sYWXfqpgpPYoZYDqJ h+BUzkOGZDAMcFfk0u6ACHBwLYi5NOnk8VqsvJhub/Izvb26MOTOi3k5TBDhKzY8zfux o9gLUdaO6Q1hbD06NY+X3GbyaNt6elGyZKNlE6aJGgqHHliqIqm+2duBLmEW0rJZ8bh6 LKljJz2Qs8AVyVPpELL0R8NE6EBJlFXHw+bu+0avCuTcjxTK4+gRG22zks5OVyzs0rZ3 +vJO0DJ2jsiN2H21/cpRu5suwf7fPswCTH4DVWXgctic5Zv2uGm2uO3F01/KiJRmPkMu gg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 36sse3xhbx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Feb 2021 12:19:10 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8E15A100034; Fri, 19 Feb 2021 12:19:09 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 80B9B221760; Fri, 19 Feb 2021 12:19:09 +0100 (CET) Received: from localhost (10.75.127.46) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 19 Feb 2021 12:19:09 +0100 From: Arnaud Pouliquen To: Bjorn Andersson , Ohad Ben-Cohen , Mathieu Poirier , Andy Gross CC: , , , , Subject: [PATCH v5 13/16] rpmsg: char: introduce __rpmsg_chrdev_create_eptdev function Date: Fri, 19 Feb 2021 12:14:58 +0100 Message-ID: <20210219111501.14261-14-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210219111501.14261-1-arnaud.pouliquen@foss.st.com> References: <20210219111501.14261-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG1NODE3.st.com (10.75.127.3) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-02-19_04:2021-02-18,2021-02-19 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); + if (IS_ERR(eptdev)) + return PTR_ERR(eptdev); + + return 0; } EXPORT_SYMBOL(rpmsg_chrdev_create_eptdev); -- 2.17.1