From: Neil Armstrong <narmstrong@neotion.com>
To: hjk@linutronix.de
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org
Subject: [PATCH] uio: add ioctl callback
Date: Wed, 12 Nov 2008 16:40:01 +0100 [thread overview]
Message-ID: <491AF8D1.4060106@neotion.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1573 bytes --]
Add an ioctl callback for uio devices.
Signed-off-by: Neil Armstrong <narmstrong@neotion.com>
---
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 2d2440c..38044fb 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -385,6 +385,18 @@ static unsigned int uio_poll(struct file *filep,
poll_table *wait)
return 0;
}
+static int uio_ioctl(struct inode *inode, 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->ioctl)
+ return idev->info->ioctl(idev->info, cmd, arg);
+
+ return -ENOSYS;
+}
+
static ssize_t uio_read(struct file *filep, char __user *buf,
size_t count, loff_t *ppos)
{
@@ -590,6 +602,7 @@ static const struct file_operations uio_fops = {
.mmap = uio_mmap,
.poll = uio_poll,
.fasync = uio_fasync,
+ .ioctl = uio_ioctl,
};
static int uio_major_init(void)
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index cdf338d..e44e89b 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -68,6 +68,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
[-- Attachment #2: narmstrong.vcf --]
[-- Type: text/x-vcard, Size: 319 bytes --]
begin:vcard
fn:Neil Armstrong
n:Armstrong;Neil
org:Neotion;Neotion Sophia Antipolis
adr:;;;Sophia Antipolis;;;France
email;internet:narmstrong@neotion.com
title:Embedded Linux Software Engineer
tel;cell:0667474169
note:PGP 0x1166F485
x-mozilla-html:FALSE
url:http://www.neotion.com
version:2.1
end:vcard
next reply other threads:[~2008-11-12 15:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-12 15:40 Neil Armstrong [this message]
2008-11-12 15:49 ` [PATCH] uio: add ioctl callback Hans J. Koch
2008-11-12 15:59 ` Neil Armstrong
2008-11-12 16:10 ` Greg KH
2008-11-12 16:23 ` Hans J. Koch
2008-11-12 16:43 ` Neil Armstrong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=491AF8D1.4060106@neotion.com \
--to=narmstrong@neotion.com \
--cc=gregkh@suse.de \
--cc=hjk@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox