Embedded Linux development
 help / color / mirror / Atom feed
* [PATCH] uio: add ioctl callback
@ 2008-11-12 14:11 Neil Armstrong
  2008-11-12 14:33 ` Marco Stornelli
  0 siblings, 1 reply; 2+ messages in thread
From: Neil Armstrong @ 2008-11-12 14:11 UTC (permalink / raw)
  To: Embedded Linux mailing list


[-- Attachment #1.1: Type: text/plain, Size: 1638 bytes --]

Add an ioctl callback to the UIO device class.
This can be useful when status and data are needed after an interrupt
occurs.

Changes :
 - Add an uio_ioctl method
 - Add en ioctl entry in uio_info

Neil Armstrong <narmstrong@neotion.com>

Index: drivers/uio/uio.c
===================================================================
--- drivers/uio/uio.c    (revision 80)
+++ drivers/uio/uio.c    (working copy)
@@ -378,6 +378,17 @@
     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)
 {
@@ -575,6 +586,7 @@
     .mmap        = uio_mmap,
     .poll        = uio_poll,
     .fasync        = uio_fasync,
+   .ioctl      = uio_ioctl,
 };
 
 static int uio_major_init(void)
Index: include/linux/uio_driver.h
===================================================================
--- include/linux/uio_driver.h    (revision 80)
+++ include/linux/uio_driver.h    (working copy)
@@ -68,6 +68,7 @@
     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 #1.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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-12 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-12 14:11 [PATCH] uio: add ioctl callback Neil Armstrong
2008-11-12 14:33 ` Marco Stornelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox