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