Merge tag 'mips_5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
[linux-2.6-microblaze.git] / drivers / rpmsg / rpmsg_core.c
index 91de940..e5daee4 100644 (file)
 
 #include "rpmsg_internal.h"
 
+/**
+ * rpmsg_create_channel() - create a new rpmsg channel
+ * using its name and address info.
+ * @rpdev: rpmsg device
+ * @chinfo: channel_info to bind
+ *
+ * Returns a pointer to the new rpmsg device on success, or NULL on error.
+ */
+struct rpmsg_device *rpmsg_create_channel(struct rpmsg_device *rpdev,
+                                         struct rpmsg_channel_info *chinfo)
+{
+       if (WARN_ON(!rpdev))
+               return NULL;
+       if (!rpdev->ops || !rpdev->ops->create_channel) {
+               dev_err(&rpdev->dev, "no create_channel ops found\n");
+               return NULL;
+       }
+
+       return rpdev->ops->create_channel(rpdev, chinfo);
+}
+EXPORT_SYMBOL(rpmsg_create_channel);
+
+/**
+ * rpmsg_release_channel() - release a rpmsg channel
+ * using its name and address info.
+ * @rpdev: rpmsg device
+ * @chinfo: channel_info to bind
+ *
+ * Returns 0 on success or an appropriate error value.
+ */
+int rpmsg_release_channel(struct rpmsg_device *rpdev,
+                         struct rpmsg_channel_info *chinfo)
+{
+       if (WARN_ON(!rpdev))
+               return -EINVAL;
+       if (!rpdev->ops || !rpdev->ops->release_channel) {
+               dev_err(&rpdev->dev, "no release_channel ops found\n");
+               return -ENXIO;
+       }
+
+       return rpdev->ops->release_channel(rpdev, chinfo);
+}
+EXPORT_SYMBOL(rpmsg_release_channel);
+
 /**
  * rpmsg_create_ept() - create a new rpmsg_endpoint
  * @rpdev: rpmsg channel device