xref: /openbmc/linux/drivers/rpmsg/rpmsg_char.h (revision 69265bc1)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2022, STMicroelectronics
4  */
5 
6 #ifndef __RPMSG_CHRDEV_H__
7 #define __RPMSG_CHRDEV_H__
8 
9 #if IS_ENABLED(CONFIG_RPMSG_CHAR)
10 /**
11  * rpmsg_chrdev_eptdev_create() - register char device based on an endpoint
12  * @rpdev:  prepared rpdev to be used for creating endpoints
13  * @parent: parent device
14  * @chinfo: associated endpoint channel information.
15  *
16  * This function create a new rpmsg char endpoint device to instantiate a new
17  * endpoint based on chinfo information.
18  */
19 int rpmsg_chrdev_eptdev_create(struct rpmsg_device *rpdev, struct device *parent,
20 			       struct rpmsg_channel_info chinfo);
21 
22 /**
23  * rpmsg_chrdev_eptdev_destroy() - destroy created char device endpoint.
24  * @data: private data associated to the endpoint device
25  *
26  * This function destroys a rpmsg char endpoint device created by the RPMSG_DESTROY_EPT_IOCTL
27  * control.
28  */
29 int rpmsg_chrdev_eptdev_destroy(struct device *dev, void *data);
30 
31 #else  /*IS_ENABLED(CONFIG_RPMSG_CHAR) */
32 
rpmsg_chrdev_eptdev_create(struct rpmsg_device * rpdev,struct device * parent,struct rpmsg_channel_info chinfo)33 static inline int rpmsg_chrdev_eptdev_create(struct rpmsg_device *rpdev, struct device *parent,
34 					     struct rpmsg_channel_info chinfo)
35 {
36 	return -ENXIO;
37 }
38 
rpmsg_chrdev_eptdev_destroy(struct device * dev,void * data)39 static inline int rpmsg_chrdev_eptdev_destroy(struct device *dev, void *data)
40 {
41 	return -ENXIO;
42 }
43 
44 #endif /*IS_ENABLED(CONFIG_RPMSG_CHAR) */
45 
46 #endif /*__RPMSG_CHRDEV_H__ */
47