Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1239174
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Vlad Zolotarov <vladz@cloudius-systems.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 1/3] uio: add ioctl support |
| Date | Sun, 04 Oct 2015 19:40:02 +0200 |
| Message-ID | <qfVqq-772-29@gated-at.bofh.it> (permalink) |
| References | <qfVqp-772-7@gated-at.bofh.it> |
| X-Original-To | linux-kernel@vger.kernel.org, mst@redhat.com, hjk@hansjkoch.de, regkh@linuxfoundation.org, corbet@lwn.net |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iC1J8s1faPKij5pmMz/1pGbn6mCLyabSYIumICLRLFk=; b=Tq6+/pGd1GSseUOjvdOy5X+C2UKVsmZ2AHKGxISwcwjHbblOxH5HyfjrTR90Bn/15i BEugJrjDJP0HaeUztiDiuBb9gr614Ye5yWRJfWWJzrWgR12kz3xZZXKZigvyUe9km/4p 2GPTzwcyIUvz/Idz2fD9/y7ohIlq4366uvf2o9DK6MNCRdjIdqm72SJ5rnFOVjfvOwvJ dgFUaEf3Y9OFyxqi/3GSWYV93TckaC2EsaiJBz2SK5UC6x5ryygnrpsVJ987GvLUVyJ4 1L1P9KRH/A2OFlYcCDVpno/3NN13fGCZ3DggucOZvkRQcYz62bxQLsk/Xn1w2ObWnnAn ArAQ== |
| X-Gm-Message-State | ALoCoQn89q1UacpbL9yc0TNJR/QfEhhNhhBC4DYnHDiA2uucDc3IPO2Cy4VRrQAoV8h93QdZo1UM |
| X-Received | by 10.180.240.170 with SMTP id wb10mr7954211wic.91.1443980133745; Sun, 04 Oct 2015 10:35:33 -0700 (PDT) |
| X-Mailer | git-send-email 2.1.0 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 68 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | bruce.richardson@intel.com, avi@cloudius-systems.com, gleb@cloudius-systems.com, stephen@networkplumber.org, alexander.duyck@gmail.com, Vlad Zolotarov <vladz@cloudius-systems.com> |
| X-Original-Date | Sun, 4 Oct 2015 20:35:24 +0300 |
| X-Original-Message-ID | <1443980126-10583-2-git-send-email-vladz@cloudius-systems.com> |
| X-Original-References | <1443980126-10583-1-git-send-email-vladz@cloudius-systems.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1239174 |
Show key headers only | View raw
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
---
drivers/uio/uio.c | 15 +++++++++++++++
include/linux/uio_driver.h | 3 +++
2 files changed, 18 insertions(+)
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 8196581..714b0e5 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -704,6 +704,20 @@ static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
}
}
+static 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;
+
+ if (!idev->info)
+ return -EIO;
+
+ if (!idev->info->ioctl)
+ return -ENOTTY;
+
+ return idev->info->ioctl(idev->info, cmd, arg);
+}
+
static const struct file_operations uio_fops = {
.owner = THIS_MODULE,
.open = uio_open,
@@ -712,6 +726,7 @@ static const struct file_operations uio_fops = {
.write = uio_write,
.mmap = uio_mmap,
.poll = uio_poll,
+ .unlocked_ioctl = uio_ioctl,
.fasync = uio_fasync,
.llseek = noop_llseek,
};
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 32c0e83..10d7833 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -89,6 +89,7 @@ struct uio_device {
* @mmap: mmap operation for this uio device
* @open: open operation for this uio device
* @release: release operation for this uio device
+ * @ioctl: ioctl handler
* @irqcontrol: disable/enable irqs when 0/1 is written to /dev/uioX
*/
struct uio_info {
@@ -105,6 +106,8 @@ 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);
+ int (*ioctl)(struct uio_info *info, unsigned int cmd,
+ unsigned long arg);
};
extern int __must_check
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 0/3] uio: add MSI/MSI-X support to uio_pci_generic driver Vlad Zolotarov <vladz@cloudius-systems.com> - 2015-10-04 19:40 +0200 [PATCH v2 1/3] uio: add ioctl support Vlad Zolotarov <vladz@cloudius-systems.com> - 2015-10-04 19:40 +0200
csiph-web