diff options
Diffstat (limited to 'kernel/rpmsg/ethosu_rpmsg_network.c')
-rw-r--r-- | kernel/rpmsg/ethosu_rpmsg_network.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/kernel/rpmsg/ethosu_rpmsg_network.c b/kernel/rpmsg/ethosu_rpmsg_network.c index f5b8265..38d7db2 100644 --- a/kernel/rpmsg/ethosu_rpmsg_network.c +++ b/kernel/rpmsg/ethosu_rpmsg_network.c @@ -38,18 +38,18 @@ * Variables ****************************************************************************/ -static int ethosu_network_release(struct inode *inode, - struct file *file); +static int ethosu_rpmsg_network_release(struct inode *inode, + struct file *file); -static long ethosu_network_ioctl(struct file *file, - unsigned int cmd, - unsigned long arg); +static long ethosu_rpmsg_network_ioctl(struct file *file, + unsigned int cmd, + unsigned long arg); -static const struct file_operations ethosu_network_fops = { - .release = ðosu_network_release, - .unlocked_ioctl = ðosu_network_ioctl, +static const struct file_operations ethosu_rpmsg_network_fops = { + .release = ðosu_rpmsg_network_release, + .unlocked_ioctl = ðosu_rpmsg_network_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = ðosu_network_ioctl, + .compat_ioctl = ðosu_rpmsg_network_ioctl, #endif }; @@ -57,15 +57,15 @@ static const struct file_operations ethosu_network_fops = { * Functions ****************************************************************************/ -static bool ethosu_network_verify(struct file *file) +static bool ethosu_rpmsg_network_verify(struct file *file) { - return file->f_op == ðosu_network_fops; + return file->f_op == ðosu_rpmsg_network_fops; } -static void ethosu_network_destroy(struct kref *kref) +static void ethosu_rpmsg_network_destroy(struct kref *kref) { - struct ethosu_network *net = - container_of(kref, struct ethosu_network, kref); + struct ethosu_rpmsg_network *net = + container_of(kref, struct ethosu_rpmsg_network, kref); struct device *dev = net->dev; dev_dbg(dev, "Network destroy. net=0x%pK\n", net); @@ -77,25 +77,25 @@ static void ethosu_network_destroy(struct kref *kref) devm_kfree(dev, net); } -static int ethosu_network_release(struct inode *inode, - struct file *file) +static int ethosu_rpmsg_network_release(struct inode *inode, + struct file *file) { - struct ethosu_network *net = file->private_data; + struct ethosu_rpmsg_network *net = file->private_data; struct device *dev = net->dev; dev_dbg(dev, "Network release. file=0x%pK, net=0x%pK\n", file, net); - ethosu_network_put(net); + ethosu_rpmsg_network_put(net); return 0; } -static long ethosu_network_ioctl(struct file *file, - unsigned int cmd, - unsigned long arg) +static long ethosu_rpmsg_network_ioctl(struct file *file, + unsigned int cmd, + unsigned long arg) { - struct ethosu_network *net = file->private_data; + struct ethosu_rpmsg_network *net = file->private_data; struct device *dev = net->dev; void __user *udata = (void __user *)arg; int ret; @@ -110,8 +110,8 @@ static long ethosu_network_ioctl(struct file *file, dev_dbg(dev, "Network ioctl: Network info. net=0x%pK\n", net); - ret = ethosu_network_info_request(dev, net->mailbox, net, - &uapi); + ret = ethosu_rpmsg_network_info_request(dev, net->mailbox, net, + &uapi); if (ret) break; @@ -130,7 +130,8 @@ static long ethosu_network_ioctl(struct file *file, "Network ioctl: Inference. ifm_fd=%u, ofm_fd=%u\n", uapi.ifm_fd[0], uapi.ofm_fd[0]); - ret = ethosu_inference_create(dev, net->mailbox, net, &uapi); + ret = ethosu_rpmsg_inference_create(dev, net->mailbox, net, + &uapi); break; } default: { @@ -146,11 +147,11 @@ static long ethosu_network_ioctl(struct file *file, return ret; } -int ethosu_network_create(struct device *dev, - struct ethosu_mailbox *mailbox, - struct ethosu_uapi_network_create *uapi) +int ethosu_rpmsg_network_create(struct device *dev, + struct ethosu_rpmsg_mailbox *mailbox, + struct ethosu_uapi_network_create *uapi) { - struct ethosu_network *net; + struct ethosu_rpmsg_network *net; const void __user *data; int ret; @@ -197,7 +198,8 @@ int ethosu_network_create(struct device *dev, goto free_net; } - ret = anon_inode_getfd("ethosu-network", ðosu_network_fops, net, + ret = anon_inode_getfd("ethosu-network", ðosu_rpmsg_network_fops, + net, O_RDWR | O_CLOEXEC); if (ret < 0) goto free_dma_mem; @@ -222,34 +224,34 @@ free_net: return ret; } -struct ethosu_network *ethosu_network_get_from_fd(int fd) +struct ethosu_rpmsg_network *ethosu_rpmsg_network_get_from_fd(int fd) { - struct ethosu_network *net; + struct ethosu_rpmsg_network *net; struct file *file; file = fget(fd); if (!file) return ERR_PTR(-EINVAL); - if (!ethosu_network_verify(file)) { + if (!ethosu_rpmsg_network_verify(file)) { fput(file); return ERR_PTR(-EINVAL); } net = file->private_data; - ethosu_network_get(net); + ethosu_rpmsg_network_get(net); fput(file); return net; } -void ethosu_network_get(struct ethosu_network *net) +void ethosu_rpmsg_network_get(struct ethosu_rpmsg_network *net) { kref_get(&net->kref); } -int ethosu_network_put(struct ethosu_network *net) +int ethosu_rpmsg_network_put(struct ethosu_rpmsg_network *net) { - return kref_put(&net->kref, ethosu_network_destroy); + return kref_put(&net->kref, ethosu_rpmsg_network_destroy); } |