|
|
@@ -66,7 +66,7 @@ dev_addr_t rppc_local_to_remote_da(struct rppc_instance *rpc, phys_addr_t pa)
|
|
|
struct rproc *rproc;
|
|
|
u64 da = 0;
|
|
|
dev_addr_t rda;
|
|
|
- struct device *dev = rpc->rppcdev->dev;
|
|
|
+ struct device *dev = rpc->dev;
|
|
|
|
|
|
if (mutex_lock_interruptible(&rpc->rppcdev->lock))
|
|
|
return 0;
|
|
|
@@ -97,7 +97,7 @@ static void rppc_print_msg(struct rppc_instance *rpc, char *prefix,
|
|
|
struct rppc_query_function *info = NULL;
|
|
|
struct rppc_packet *packet = NULL;
|
|
|
struct rppc_param_data *param = NULL;
|
|
|
- struct device *dev = rpc->rppcdev->dev;
|
|
|
+ struct device *dev = rpc->dev;
|
|
|
u32 i = 0, paramsz = sizeof(*param);
|
|
|
|
|
|
dev_dbg(dev, "%s HDR: msg_type = %d msg_len = %d\n",
|
|
|
@@ -153,7 +153,7 @@ struct rppc_function *rppc_find_fxn(struct rppc_instance *rpc, u16 msg_id)
|
|
|
{
|
|
|
struct rppc_function *function = NULL;
|
|
|
struct rppc_function_list *pos, *n;
|
|
|
- struct device *dev = rpc->rppcdev->dev;
|
|
|
+ struct device *dev = rpc->dev;
|
|
|
|
|
|
mutex_lock(&rpc->lock);
|
|
|
list_for_each_entry_safe(pos, n, &rpc->fxn_list, list) {
|
|
|
@@ -175,7 +175,7 @@ static int rppc_add_fxn(struct rppc_instance *rpc,
|
|
|
struct rppc_function *function, u16 msg_id)
|
|
|
{
|
|
|
struct rppc_function_list *fxn = NULL;
|
|
|
- struct device *dev = rpc->rppcdev->dev;
|
|
|
+ struct device *dev = rpc->dev;
|
|
|
|
|
|
fxn = kzalloc(sizeof(*fxn), GFP_KERNEL);
|
|
|
if (!fxn)
|
|
|
@@ -194,7 +194,7 @@ static int rppc_add_fxn(struct rppc_instance *rpc,
|
|
|
static
|
|
|
void rppc_handle_create_resp(struct rppc_instance *rpc, char *data, int len)
|
|
|
{
|
|
|
- struct device *dev = rpc->rppcdev->dev;
|
|
|
+ struct device *dev = rpc->dev;
|
|
|
struct rppc_msg_header *hdr = (struct rppc_msg_header *)data;
|
|
|
struct rppc_instance_handle *hdl;
|
|
|
u32 exp_len = sizeof(*hdl) + sizeof(*hdr);
|
|
|
@@ -226,7 +226,7 @@ void rppc_handle_create_resp(struct rppc_instance *rpc, char *data, int len)
|
|
|
static
|
|
|
void rppc_handle_delete_resp(struct rppc_instance *rpc, char *data, int len)
|
|
|
{
|
|
|
- struct device *dev = rpc->rppcdev->dev;
|
|
|
+ struct device *dev = rpc->dev;
|
|
|
struct rppc_msg_header *hdr = (struct rppc_msg_header *)data;
|
|
|
struct rppc_instance_handle *hdl;
|
|
|
u32 exp_len = sizeof(*hdl) + sizeof(*hdr);
|
|
|
@@ -289,7 +289,7 @@ static int rppc_cb(struct rpmsg_device *rpdev,
|
|
|
{
|
|
|
struct rppc_msg_header *hdr = data;
|
|
|
struct rppc_instance *rpc = priv;
|
|
|
- struct device *dev = rpc->rppcdev->dev;
|
|
|
+ struct device *dev = rpc->dev;
|
|
|
char *buf = (char *)data;
|
|
|
|
|
|
dev_dbg(dev, "<== incoming msg src %d len %d msg_type %d msg_len %d\n",
|
|
|
@@ -336,7 +336,7 @@ static int rppc_connect(struct rppc_instance *rpc,
|
|
|
struct rppc_msg_header *hdr = (struct rppc_msg_header *)&kbuf[0];
|
|
|
|
|
|
if (rpc->state == RPPC_STATE_CONNECTED) {
|
|
|
- dev_dbg(rppcdev->dev, "endpoint already connected\n");
|
|
|
+ dev_dbg(rpc->dev, "endpoint already connected\n");
|
|
|
return -EISCONN;
|
|
|
}
|
|
|
|
|
|
@@ -350,7 +350,7 @@ static int rppc_connect(struct rppc_instance *rpc,
|
|
|
ret = rpmsg_send_offchannel(rppcdev->rpdev->ept, rpc->ept->addr,
|
|
|
rppcdev->rpdev->dst, (char *)kbuf, len);
|
|
|
if (ret > 0) {
|
|
|
- dev_err(rppcdev->dev, "rpmsg_send failed: %d\n", ret);
|
|
|
+ dev_err(rpc->dev, "rpmsg_send failed: %d\n", ret);
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
@@ -363,7 +363,7 @@ static int rppc_connect(struct rppc_instance *rpc,
|
|
|
return -ENXIO;
|
|
|
|
|
|
if (ret > 0) {
|
|
|
- dev_err(rppcdev->dev, "premature wakeup: %d\n", ret);
|
|
|
+ dev_err(rpc->dev, "premature wakeup: %d\n", ret);
|
|
|
return -EIO;
|
|
|
}
|
|
|
|
|
|
@@ -389,12 +389,12 @@ static void rppc_disconnect(struct rppc_instance *rpc)
|
|
|
handle->status = 0;
|
|
|
len = sizeof(struct rppc_msg_header) + hdr->msg_len;
|
|
|
|
|
|
- dev_dbg(rppcdev->dev, "disconnecting from RPC service at %d\n",
|
|
|
+ dev_dbg(rpc->dev, "disconnecting from RPC service at %d\n",
|
|
|
rpc->dst);
|
|
|
ret = rpmsg_send_offchannel(rppcdev->rpdev->ept, rpc->ept->addr,
|
|
|
rppcdev->rpdev->dst, kbuf, len);
|
|
|
if (ret)
|
|
|
- dev_err(rppcdev->dev, "rpmsg_send failed: %d\n", ret);
|
|
|
+ dev_err(rpc->dev, "rpmsg_send failed: %d\n", ret);
|
|
|
|
|
|
/*
|
|
|
* TODO: should we wait for a message to come back?
|
|
|
@@ -569,7 +569,7 @@ static int rppc_open(struct inode *inode, struct file *filp)
|
|
|
chinfo.dst = RPMSG_ADDR_ANY;
|
|
|
rpc->ept = rpmsg_create_ept(rppcdev->rpdev, rppc_cb, rpc, chinfo);
|
|
|
if (!rpc->ept) {
|
|
|
- dev_err(rppcdev->dev, "create ept failed\n");
|
|
|
+ dev_err(rpc->dev, "create ept failed\n");
|
|
|
put_device(rpc->dev);
|
|
|
kfree(rpc);
|
|
|
return -ENOMEM;
|
|
|
@@ -580,7 +580,7 @@ static int rppc_open(struct inode *inode, struct file *filp)
|
|
|
list_add(&rpc->list, &rppcdev->instances);
|
|
|
mutex_unlock(&rppcdev->lock);
|
|
|
|
|
|
- dev_dbg(rppcdev->dev, "local addr assigned: 0x%x\n", rpc->ept->addr);
|
|
|
+ dev_dbg(rpc->dev, "local addr assigned: 0x%x\n", rpc->ept->addr);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -598,7 +598,7 @@ static int rppc_release(struct inode *inode, struct file *filp)
|
|
|
struct rppc_instance *rpc = filp->private_data;
|
|
|
struct rppc_device *rppcdev = rpc->rppcdev;
|
|
|
|
|
|
- dev_dbg(rppcdev->dev, "releasing Instance %p, in state %d\n", rpc,
|
|
|
+ dev_dbg(rpc->dev, "releasing Instance %p, in state %d\n", rpc,
|
|
|
rpc->state);
|
|
|
|
|
|
if (rpc->state != RPPC_STATE_STALE) {
|
|
|
@@ -620,9 +620,9 @@ static int rppc_release(struct inode *inode, struct file *filp)
|
|
|
list_del(&rpc->list);
|
|
|
mutex_unlock(&rppcdev->lock);
|
|
|
|
|
|
- dev_dbg(rppcdev->dev, "instance %p has been deleted!\n", rpc);
|
|
|
+ dev_dbg(rpc->dev, "instance %p has been deleted!\n", rpc);
|
|
|
if (list_empty(&rppcdev->instances))
|
|
|
- dev_dbg(rppcdev->dev, "all instances have been removed!\n");
|
|
|
+ dev_dbg(rpc->dev, "all instances have been removed!\n");
|
|
|
|
|
|
put_device(rpc->dev);
|
|
|
kfree(rpc);
|
|
|
@@ -632,11 +632,10 @@ static int rppc_release(struct inode *inode, struct file *filp)
|
|
|
static long rppc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|
|
{
|
|
|
struct rppc_instance *rpc = filp->private_data;
|
|
|
- struct rppc_device *rppcdev = rpc->rppcdev;
|
|
|
struct rppc_create_instance connect;
|
|
|
int ret = 0;
|
|
|
|
|
|
- dev_dbg(rppcdev->dev, "%s: cmd %d, arg 0x%lx\n", __func__, cmd, arg);
|
|
|
+ dev_dbg(rpc->dev, "%s: cmd %d, arg 0x%lx\n", __func__, cmd, arg);
|
|
|
|
|
|
if (_IOC_TYPE(cmd) != RPPC_IOC_MAGIC)
|
|
|
return -ENOTTY;
|
|
|
@@ -649,7 +648,7 @@ static long rppc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|
|
ret = copy_from_user(&connect, (char __user *)arg,
|
|
|
sizeof(connect));
|
|
|
if (ret) {
|
|
|
- dev_err(rppcdev->dev, "%s: %d: copy_from_user fail: %d\n",
|
|
|
+ dev_err(rpc->dev, "%s: %d: copy_from_user fail: %d\n",
|
|
|
__func__, _IOC_NR(cmd), ret);
|
|
|
ret = -EFAULT;
|
|
|
} else {
|
|
|
@@ -664,7 +663,7 @@ static long rppc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|
|
ret = rppc_unregister_buffers(rpc, arg);
|
|
|
break;
|
|
|
default:
|
|
|
- dev_err(rppcdev->dev, "unhandled ioctl cmd: %d\n", cmd);
|
|
|
+ dev_err(rpc->dev, "unhandled ioctl cmd: %d\n", cmd);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
@@ -762,7 +761,7 @@ static ssize_t rppc_read(struct file *filp, char __user *buf, size_t len,
|
|
|
if (function && function->num_translations > 0) {
|
|
|
ret = rppc_xlate_buffers(rpc, function, RPPC_RPA_TO_UVA);
|
|
|
if (ret < 0) {
|
|
|
- dev_err(rpc->rppcdev->dev, "failed to translate back pointers from remote core!\n");
|
|
|
+ dev_err(rpc->dev, "failed to translate back pointers from remote core!\n");
|
|
|
goto failure;
|
|
|
}
|
|
|
}
|
|
|
@@ -770,7 +769,7 @@ static ssize_t rppc_read(struct file *filp, char __user *buf, size_t len,
|
|
|
returned.status = packet->result;
|
|
|
|
|
|
if (copy_to_user(buf, &returned, use)) {
|
|
|
- dev_err(rpc->rppcdev->dev, "%s: copy_to_user fail\n", __func__);
|
|
|
+ dev_err(rpc->dev, "%s: copy_to_user fail\n", __func__);
|
|
|
ret = -EFAULT;
|
|
|
} else {
|
|
|
ret = use;
|
|
|
@@ -788,7 +787,7 @@ static ssize_t rppc_write(struct file *filp, const char __user *ubuf,
|
|
|
{
|
|
|
struct rppc_instance *rpc = filp->private_data;
|
|
|
struct rppc_device *rppcdev = rpc->rppcdev;
|
|
|
- struct device *dev = rppcdev->dev;
|
|
|
+ struct device *dev = rpc->dev;
|
|
|
struct rppc_msg_header *hdr = NULL;
|
|
|
struct rppc_function *function = NULL;
|
|
|
struct rppc_packet *packet = NULL;
|