Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2839669pxb; Tue, 13 Apr 2021 11:23:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8gbDz5g+xJozWz0/l/jJ60FakpGL3hWY93MGmlyatnwdTDM6N3/n+3daqVmQumei31pDB X-Received: by 2002:a17:906:1114:: with SMTP id h20mr11449224eja.453.1618338210218; Tue, 13 Apr 2021 11:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618338210; cv=none; d=google.com; s=arc-20160816; b=wgIPvFMAKlHnGg6fpUbTn30B4FDXumTML3S5LU+hXHo8zSX73d7ohlXgiPkmqURHAs 6ePnepJknqABFw91PANVO+kUStVfTRSpHzHae7ZayPrN3L5rWEWg3OfmXBpxri5hTuh6 9nGRXsRQ1ZOkQZxxu6m7LcOX7Qx0ohWq1yei/0/T2nS15JYsaK2INIAAEws7z+YtU0+g /xYQtW3sRaJmqCadd94L2RjauXVIqyiHTGX4yKn090wphkopcm5ClF+yG76cGDgKjJ+B IY29HDfy7YODeO5x4WFjxBBa74/92slLZLqLXASTvLsrVgUhCe+sAJ3FAYd1UYHV+Sm6 qb7Q== 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=LbWU4onpq2aSk9qGhMd1jmGLODJWR/qdj5uSusGKCJg=; b=sFf1Np/+BT7dCx+O95nbCR2GlsYbCNxyvmeuMIWWnh0wbOOXHFvMEg/ZPdppqkCz7L V18AHA6XEumVypavNsuXT4afiSvW0+ehP0aKo1Ciu6C2pKRxo9//pv2/nA04Wuwu9dUK LDz5ZTiW4LLPisaPx3ffNXrriBZ51xVJmaOZBxQBuhpRsb+0cWGhW8F05SK79xROfPxt 8ZheVT8uTxLjwpir0k9/Gt15IhRtwfBleM22ZU+DisFm3EZ9GN0tuqbQmgxK1164zhpL tXVa2EwwLh67F/YgyVYY689EBYW7pCYafgL9z8PIoEA+IZkyEW9sAkF93wF9dsNoW4FO u08g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=I3Fr75OD; 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 s20si10592453edu.53.2021.04.13.11.23.06; Tue, 13 Apr 2021 11:23:30 -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=@foss.st.com header.s=selector1 header.b=I3Fr75OD; 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 S1346127AbhDMNqE (ORCPT + 99 others); Tue, 13 Apr 2021 09:46:04 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:47860 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1344847AbhDMNpo (ORCPT ); Tue, 13 Apr 2021 09:45:44 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13DDhR9L031734; Tue, 13 Apr 2021 15:45:22 +0200 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=LbWU4onpq2aSk9qGhMd1jmGLODJWR/qdj5uSusGKCJg=; b=I3Fr75ODtk6qstVfdPPwaf7fm0mvaJOb9ePk00mH/VnlA+bYpOj4+cQPQwLl/kEpgUAu 6EPEeBwTmU0GHiczgeRCXtEY+nuEFwkmvHj6F0eD8pMhqW2Om16xVs7nyhzo8kLdyW4e 7DV7UsKwJFYWjh0ug4CVkT3dMTxxkBEoBmHe/n0yV8d/Pnl8H6NTu++Nk83ApVgRSY1B OeHYEuB38J7LTdd54g5hXTUeDE4MzLua66GS9yNTqaXLYAFS+slGPbR8o+LCSwl2aYDI FakFmFzUs05dzC7Xzsm6CMyl4s4LsXjW6WjPIw6ea0xrQ1ngKwrsAkP6VcljjZNTYyd6 bQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 37vu4e52sq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Apr 2021 15:45:22 +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 764C0100034; Tue, 13 Apr 2021 15:45:22 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 694A3226C5A; Tue, 13 Apr 2021 15:45:22 +0200 (CEST) Received: from localhost (10.75.127.49) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 13 Apr 2021 15:45:22 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Ohad Ben-Cohen , Mathieu Poirier CC: , , , Subject: [PATCH v2 4/7] rpmsg: char: Introduce __rpmsg_chrdev_create_eptdev function Date: Tue, 13 Apr 2021 15:44:55 +0200 Message-ID: <20210413134458.17912-5-arnaud.pouliquen@foss.st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210413134458.17912-1-arnaud.pouliquen@foss.st.com> References: <20210413134458.17912-1-arnaud.pouliquen@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG1NODE2.st.com (10.75.127.2) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-04-13_07:2021-04-13,2021-04-13 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 channel device for the char device. The rpmsg device will need a reference to the context. Signed-off-by: Arnaud Pouliquen --- update from V1 - fix __rpmsg_chrdev_create_eptdev function header indentation. --- 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 21ef9d9eccd7..a64249d83172 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -323,8 +323,9 @@ static void rpmsg_eptdev_release_device(struct device *dev) kfree(eptdev); } -int rpmsg_chrdev_create_eptdev(struct rpmsg_device *rpdev, struct device *parent, - struct rpmsg_channel_info chinfo, struct class *rpmsg_class) +static struct rpmsg_eptdev * +__rpmsg_chrdev_create_eptdev(struct rpmsg_device *rpdev, struct device *parent, + struct rpmsg_channel_info chinfo, struct class *rpmsg_class) { struct rpmsg_eptdev *eptdev; struct device *dev; @@ -332,7 +333,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; @@ -376,7 +377,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); @@ -386,7 +387,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 class *rpmsg_class) +{ + struct rpmsg_eptdev *eptdev; + + eptdev = __rpmsg_chrdev_create_eptdev(rpdev, parent, chinfo, rpmsg_class); + if (IS_ERR(eptdev)) + return PTR_ERR(eptdev); + + return 0; } EXPORT_SYMBOL(rpmsg_chrdev_create_eptdev); -- 2.17.1