Commit 05614fbf authored by Vincent Bossier's avatar Vincent Bossier Committed by Greg Kroah-Hartman

Staging: VME: Make vme/ctl device available for IOCTL operations only.

Resurrect the vme/ctl device by allowing to open it even if it has no resources
and make related read/write/llseek operations dummy.
Signed-off-by: default avatarVincent Bossier <vincent.bossier@gmail.com>
Acked-by: default avatarMartyn Welch <martyn.welch@ge.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 56fc5081
...@@ -168,8 +168,8 @@ static int vme_user_open(struct inode *inode, struct file *file) ...@@ -168,8 +168,8 @@ static int vme_user_open(struct inode *inode, struct file *file)
unsigned int minor = MINOR(inode->i_rdev); unsigned int minor = MINOR(inode->i_rdev);
down(&image[minor].sem); down(&image[minor].sem);
/* Only allow device to be opened if a resource is allocated */ /* Allow device to be opened if a resource is needed and allocated. */
if (image[minor].resource == NULL) { if (minor < CONTROL_MINOR && image[minor].resource == NULL) {
printk(KERN_ERR "No resources allocated for device\n"); printk(KERN_ERR "No resources allocated for device\n");
err = -EINVAL; err = -EINVAL;
goto err_res; goto err_res;
...@@ -321,6 +321,9 @@ static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count, ...@@ -321,6 +321,9 @@ static ssize_t vme_user_read(struct file *file, char __user *buf, size_t count,
size_t image_size; size_t image_size;
size_t okcount; size_t okcount;
if (minor == CONTROL_MINOR)
return 0;
down(&image[minor].sem); down(&image[minor].sem);
/* XXX Do we *really* want this helper - we can use vme_*_get ? */ /* XXX Do we *really* want this helper - we can use vme_*_get ? */
...@@ -365,6 +368,9 @@ static ssize_t vme_user_write(struct file *file, const char __user *buf, ...@@ -365,6 +368,9 @@ static ssize_t vme_user_write(struct file *file, const char __user *buf,
size_t image_size; size_t image_size;
size_t okcount; size_t okcount;
if (minor == CONTROL_MINOR)
return 0;
down(&image[minor].sem); down(&image[minor].sem);
image_size = vme_get_size(image[minor].resource); image_size = vme_get_size(image[minor].resource);
...@@ -406,6 +412,9 @@ static loff_t vme_user_llseek(struct file *file, loff_t off, int whence) ...@@ -406,6 +412,9 @@ static loff_t vme_user_llseek(struct file *file, loff_t off, int whence)
unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev);
size_t image_size; size_t image_size;
if (minor == CONTROL_MINOR)
return -EINVAL;
down(&image[minor].sem); down(&image[minor].sem);
image_size = vme_get_size(image[minor].resource); image_size = vme_get_size(image[minor].resource);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment