struct rpmsg_endpoint *ns_ept;
};
-#define to_rpmsg_channel(d) container_of(d, struct rpmsg_channel, dev)
+#define to_rpmsg_device(d) container_of(d, struct rpmsg_device, dev)
#define to_rpmsg_driver(d) container_of(d, struct rpmsg_driver, drv)
/*
field##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
- struct rpmsg_channel *rpdev = to_rpmsg_channel(dev); \
+ struct rpmsg_device *rpdev = to_rpmsg_device(dev); \
\
return sprintf(buf, format_string, rpdev->path); \
}
static ssize_t modalias_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct rpmsg_channel *rpdev = to_rpmsg_channel(dev);
+ struct rpmsg_device *rpdev = to_rpmsg_device(dev);
return sprintf(buf, RPMSG_DEVICE_MODALIAS_FMT "\n", rpdev->id.name);
}
};
/* rpmsg devices and drivers are matched using the service name */
-static inline int rpmsg_id_match(const struct rpmsg_channel *rpdev,
+static inline int rpmsg_id_match(const struct rpmsg_device *rpdev,
const struct rpmsg_device_id *id)
{
return strncmp(id->name, rpdev->id.name, RPMSG_NAME_SIZE) == 0;
/* match rpmsg channel and rpmsg driver */
static int rpmsg_dev_match(struct device *dev, struct device_driver *drv)
{
- struct rpmsg_channel *rpdev = to_rpmsg_channel(dev);
+ struct rpmsg_device *rpdev = to_rpmsg_device(dev);
struct rpmsg_driver *rpdrv = to_rpmsg_driver(drv);
const struct rpmsg_device_id *ids = rpdrv->id_table;
unsigned int i;
static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env)
{
- struct rpmsg_channel *rpdev = to_rpmsg_channel(dev);
+ struct rpmsg_device *rpdev = to_rpmsg_device(dev);
return add_uevent_var(env, "MODALIAS=" RPMSG_DEVICE_MODALIAS_FMT,
rpdev->id.name);
/* for more info, see below documentation of rpmsg_create_ept() */
static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp,
- struct rpmsg_channel *rpdev,
+ struct rpmsg_device *rpdev,
rpmsg_rx_cb_t cb,
void *priv, u32 addr)
{
*
* Returns a pointer to the endpoint on success, or NULL on error.
*/
-struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *rpdev,
+struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev,
rpmsg_rx_cb_t cb, void *priv,
struct rpmsg_channel_info chinfo)
{
*/
static int rpmsg_dev_probe(struct device *dev)
{
- struct rpmsg_channel *rpdev = to_rpmsg_channel(dev);
+ struct rpmsg_device *rpdev = to_rpmsg_device(dev);
struct rpmsg_driver *rpdrv = to_rpmsg_driver(rpdev->dev.driver);
struct virtproc_info *vrp = rpdev->vrp;
struct rpmsg_channel_info chinfo = {};
static int rpmsg_dev_remove(struct device *dev)
{
- struct rpmsg_channel *rpdev = to_rpmsg_channel(dev);
+ struct rpmsg_device *rpdev = to_rpmsg_device(dev);
struct rpmsg_driver *rpdrv = to_rpmsg_driver(rpdev->dev.driver);
struct virtproc_info *vrp = rpdev->vrp;
int err = 0;
static void rpmsg_release_device(struct device *dev)
{
- struct rpmsg_channel *rpdev = to_rpmsg_channel(dev);
+ struct rpmsg_device *rpdev = to_rpmsg_device(dev);
kfree(rpdev);
}
* this is used to make sure we're not creating rpmsg devices for channels
* that already exist.
*/
-static int rpmsg_channel_match(struct device *dev, void *data)
+static int rpmsg_device_match(struct device *dev, void *data)
{
struct rpmsg_channel_info *chinfo = data;
- struct rpmsg_channel *rpdev = to_rpmsg_channel(dev);
+ struct rpmsg_device *rpdev = to_rpmsg_device(dev);
if (chinfo->src != RPMSG_ADDR_ANY && chinfo->src != rpdev->src)
return 0;
* this function will be used to create both static and dynamic
* channels.
*/
-static struct rpmsg_channel *rpmsg_create_channel(struct virtproc_info *vrp,
- struct rpmsg_channel_info *chinfo)
+static struct rpmsg_device *rpmsg_create_channel(struct virtproc_info *vrp,
+ struct rpmsg_channel_info *chinfo)
{
- struct rpmsg_channel *rpdev;
+ struct rpmsg_device *rpdev;
struct device *tmp, *dev = &vrp->vdev->dev;
int ret;
/* make sure a similar channel doesn't already exist */
- tmp = device_find_child(dev, chinfo, rpmsg_channel_match);
+ tmp = device_find_child(dev, chinfo, rpmsg_device_match);
if (tmp) {
/* decrement the matched device's refcount back */
put_device(tmp);
struct virtio_device *vdev = vrp->vdev;
struct device *dev;
- dev = device_find_child(&vdev->dev, chinfo, rpmsg_channel_match);
+ dev = device_find_child(&vdev->dev, chinfo, rpmsg_device_match);
if (!dev)
return -EINVAL;
*
* Returns 0 on success and an appropriate error value on failure.
*/
-int rpmsg_send_offchannel_raw(struct rpmsg_channel *rpdev, u32 src, u32 dst,
+int rpmsg_send_offchannel_raw(struct rpmsg_device *rpdev, u32 src, u32 dst,
void *data, int len, bool wait)
{
struct virtproc_info *vrp = rpdev->vrp;
}
/* invoked when a name service announcement arrives */
-static void rpmsg_ns_cb(struct rpmsg_channel *rpdev, void *data, int len,
+static void rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len,
void *priv, u32 src)
{
struct rpmsg_ns_msg *msg = data;
- struct rpmsg_channel *newch;
+ struct rpmsg_device *newch;
struct rpmsg_channel_info chinfo;
struct virtproc_info *vrp = priv;
struct device *dev = &vrp->vdev->dev;
};
/**
- * rpmsg_channel - devices that belong to the rpmsg bus are called channels
+ * rpmsg_device - device that belong to the rpmsg bus
* @vrp: the remote processor this channel belongs to
* @dev: the device struct
* @id: device id (used to match between rpmsg drivers and devices)
* @ept: the rpmsg endpoint of this channel
* @announce: if set, rpmsg will announce the creation/removal of this channel
*/
-struct rpmsg_channel {
+struct rpmsg_device {
struct virtproc_info *vrp;
struct device dev;
struct rpmsg_device_id id;
bool announce;
};
-typedef void (*rpmsg_rx_cb_t)(struct rpmsg_channel *, void *, int, void *, u32);
+typedef void (*rpmsg_rx_cb_t)(struct rpmsg_device *, void *, int, void *, u32);
/**
* struct rpmsg_endpoint - binds a local rpmsg address to its user
* create additional endpoints by themselves (see rpmsg_create_ept()).
*/
struct rpmsg_endpoint {
- struct rpmsg_channel *rpdev;
+ struct rpmsg_device *rpdev;
struct kref refcount;
rpmsg_rx_cb_t cb;
struct mutex cb_lock;
struct rpmsg_driver {
struct device_driver drv;
const struct rpmsg_device_id *id_table;
- int (*probe)(struct rpmsg_channel *dev);
- void (*remove)(struct rpmsg_channel *dev);
- void (*callback)(struct rpmsg_channel *, void *, int, void *, u32);
+ int (*probe)(struct rpmsg_device *dev);
+ void (*remove)(struct rpmsg_device *dev);
+ void (*callback)(struct rpmsg_device *, void *, int, void *, u32);
};
+int register_rpmsg_device(struct rpmsg_device *dev);
+void unregister_rpmsg_device(struct rpmsg_device *dev);
int __register_rpmsg_driver(struct rpmsg_driver *drv, struct module *owner);
void unregister_rpmsg_driver(struct rpmsg_driver *drv);
void rpmsg_destroy_ept(struct rpmsg_endpoint *);
-struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *,
+struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *,
rpmsg_rx_cb_t cb, void *priv,
struct rpmsg_channel_info chinfo);
int
-rpmsg_send_offchannel_raw(struct rpmsg_channel *, u32, u32, void *, int, bool);
+rpmsg_send_offchannel_raw(struct rpmsg_device *, u32, u32, void *, int, bool);
/* use a macro to avoid include chaining to get THIS_MODULE */
#define register_rpmsg_driver(drv) \
*/
static inline int rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len)
{
- struct rpmsg_channel *rpdev = ept->rpdev;
+ struct rpmsg_device *rpdev = ept->rpdev;
u32 src = ept->addr, dst = rpdev->dst;
return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
static inline
int rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst)
{
- struct rpmsg_channel *rpdev = ept->rpdev;
+ struct rpmsg_device *rpdev = ept->rpdev;
u32 src = ept->addr;
return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
int rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst,
void *data, int len)
{
- struct rpmsg_channel *rpdev = ept->rpdev;
+ struct rpmsg_device *rpdev = ept->rpdev;
return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, true);
}
static inline
int rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len)
{
- struct rpmsg_channel *rpdev = ept->rpdev;
+ struct rpmsg_device *rpdev = ept->rpdev;
u32 src = ept->addr, dst = rpdev->dst;
return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
static inline
int rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst)
{
- struct rpmsg_channel *rpdev = ept->rpdev;
+ struct rpmsg_device *rpdev = ept->rpdev;
u32 src = ept->addr;
return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst,
void *data, int len)
{
- struct rpmsg_channel *rpdev = ept->rpdev;
+ struct rpmsg_device *rpdev = ept->rpdev;
return rpmsg_send_offchannel_raw(rpdev, src, dst, data, len, false);
}