@@ -815,6 +815,24 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
return ret;
}
+long uio_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
+{
+ struct uio_listener *listener = filep->private_data;
+ struct uio_device *idev = listener->dev;
+ long retval = 0;
+
+ mutex_lock(&idev->info_lock);
+ if (!idev->info || !idev->info->ioctl) {
+ retval = -EINVAL;
+ goto out;
+ }
+
+ retval = idev->info->ioctl(idev->info, cmd, arg);
+out:
+ mutex_unlock(&idev->info_lock);
+ return retval;
+}
+
static const struct file_operations uio_fops = {
.owner = THIS_MODULE,
.open = uio_open,
@@ -825,6 +843,10 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
.poll = uio_poll,
.fasync = uio_fasync,
.llseek = noop_llseek,
+ .unlocked_ioctl = uio_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = uio_ioctl,
+#endif
};
static int uio_major_init(void)
@@ -109,6 +109,7 @@ struct uio_info {
int (*open)(struct uio_info *info, struct inode *inode);
int (*release)(struct uio_info *info, struct inode *inode);
int (*irqcontrol)(struct uio_info *info, s32 irq_on);
+ long (*ioctl)(struct uio_info *info, unsigned int cmd, unsigned long arg);
};
extern int __must_check