[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <de4db82c-8136-6fe7-f17a-59d65e8b266c@foss.st.com>
Date: Fri, 5 Mar 2021 11:46:47 +0100
From: Arnaud POULIQUEN <arnaud.pouliquen@...s.st.com>
To: Mathieu Poirier <mathieu.poirier@...aro.org>
CC: Bjorn Andersson <bjorn.andersson@...aro.org>,
Ohad Ben-Cohen <ohad@...ery.com>,
Andy Gross <agross@...nel.org>,
<linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-msm@...r.kernel.org>
Subject: Re: [PATCH v5 13/16] rpmsg: char: introduce
__rpmsg_chrdev_create_eptdev function
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 <arnaud.pouliquen@...s.st.com>
>> ---
>> 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
Thanks,
Arnaud
>
>> + if (IS_ERR(eptdev))
>> + return PTR_ERR(eptdev);
>> +
>> + return 0;
>> }
>> EXPORT_SYMBOL(rpmsg_chrdev_create_eptdev);
>>
>> --
>> 2.17.1
>>
Powered by blists - more mailing lists