summaryrefslogtreecommitdiffstats
path: root/driver/aim-cdev/cdev.c
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2016-07-08 10:46:19 +0200
committerChristian Gromm <christian.gromm@microchip.com>2016-07-08 10:46:28 +0200
commitee4a2f86f1f0f9eee3ce4afdcf0228fb237eb04b (patch)
tree831d63a72204324b69e21fa1c2d2e10a467009dd /driver/aim-cdev/cdev.c
parent35a7242c8845f687c3179a418da0296afe93ace9 (diff)
src: most: driver: update sources and adapt content
This commit updates the driver sources to version 1.3.12 and adds the make and license files to be able to download the sources via the git fetcher from within Yocto. Change-Id: I2622d2ca84c446d4dd21459173695a35fa25ae53 Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Diffstat (limited to 'driver/aim-cdev/cdev.c')
-rw-r--r--driver/aim-cdev/cdev.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/driver/aim-cdev/cdev.c b/driver/aim-cdev/cdev.c
index de4f76a..48d97bf 100644
--- a/driver/aim-cdev/cdev.c
+++ b/driver/aim-cdev/cdev.c
@@ -130,7 +130,7 @@ static int aim_open(struct inode *inode, struct file *filp)
if (!c->dev) {
pr_info("WARN: Device is destroyed\n");
mutex_unlock(&c->io_mutex);
- return -EBUSY;
+ return -ENODEV;
}
if (c->access_ref) {
@@ -201,7 +201,7 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
}
if (unlikely(!c->dev)) {
- ret = -EPIPE;
+ ret = -ENODEV;
goto unlock;
}
@@ -256,7 +256,7 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
/* make sure we don't submit to gone devices */
if (unlikely(!c->dev)) {
mutex_unlock(&c->io_mutex);
- return -EIO;
+ return -ENODEV;
}
to_copy = min_t(size_t,
@@ -366,7 +366,7 @@ static int aim_rx_completion(struct mbo *mbo)
spin_lock(&c->unlink);
if (!c->access_ref || !c->dev) {
spin_unlock(&c->unlink);
- return -EFAULT;
+ return -ENODEV;
}
kfifo_in(&c->fifo, &mbo, 1);
spin_unlock(&c->unlink);
@@ -499,23 +499,27 @@ static struct most_aim cdev_aim = {
static int __init mod_init(void)
{
+ int err;
+
pr_info("init()\n");
INIT_LIST_HEAD(&channel_list);
spin_lock_init(&ch_list_lock);
ida_init(&minor_id);
- if (alloc_chrdev_region(&aim_devno, 0, 50, "cdev") < 0)
- return -EIO;
+ err = alloc_chrdev_region(&aim_devno, 0, 50, "cdev");
+ if (err < 0)
+ return err;
major = MAJOR(aim_devno);
aim_class = class_create(THIS_MODULE, "most_cdev_aim");
if (IS_ERR(aim_class)) {
pr_err("no udev support\n");
+ err = PTR_ERR(aim_class);
goto free_cdev;
}
-
- if (most_register_aim(&cdev_aim))
+ err = most_register_aim(&cdev_aim);
+ if (err)
goto dest_class;
return 0;
@@ -523,7 +527,7 @@ dest_class:
class_destroy(aim_class);
free_cdev:
unregister_chrdev_region(aim_devno, 1);
- return -EIO;
+ return err;
}
static void __exit mod_exit(void)