lkml.org 
[lkml]   [2000]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjecttiny patch for RTC async I/O in 2.3.41
I submitted this to Paul Gortmaker last year, and heard nothing. I
sent it to Alan, and heard nothing. So here is a new patch, fresh
against 2.3.41, to add async I/O (SIGIO) support to the RTC driver. It
would be nice for this to be in 2.4 - its a very useful complement to
the improvements for low latency in this kernel.

Sorry if the patch file order is wrong.

--p

--- linux/drivers/char/rtc.c.orig Tue Jan 25 17:13:47 2000
+++ linux/drivers/char/rtc.c Mon Jan 31 00:10:14 2000
@@ -34,10 +34,10 @@
* 1.09 Nikita Schmidt: epoch support and some Alpha cleanup.
* 1.09a Pete Zaitcev: Sun SPARC
* 1.09b Jeff Garzik: Modularize, init cleanup
- *
+ * 1.10 Paul Barton-Davis: add support for async I/O
*/

-#define RTC_VERSION "1.09b"
+#define RTC_VERSION "1.10"

#define RTC_IRQ 8 /* Can't see this changing soon. */
#define RTC_IO_EXTENT 0x10 /* Only really two ports, but... */
@@ -50,6 +50,7 @@
* this driver.)
*/

+#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
@@ -80,6 +81,8 @@
* ioctls.
*/

+static struct fasync_struct *rtc_async_queue;
+
static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);

static spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
@@ -153,6 +156,13 @@

wake_up_interruptible(&rtc_wait);

+ if (rtc_async_queue)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
+ kill_fasync (rtc_async_queue, SIGIO);
+#else
+ kill_fasync (rtc_async_queue, SIGIO, POLL_IN);
+#endif
+
if (atomic_read(&rtc_status) & RTC_TIMER_ON)
mod_timer(&rtc_irq_timer, jiffies + HZ/rtc_freq + 2*HZ/100);
}
@@ -480,6 +490,12 @@
return 0;
}

+static int rtc_fasync (int fd, struct file *filp, int on)
+
+{
+ return fasync_helper (fd, filp, on, &rtc_async_queue);
+}
+
static int rtc_release(struct inode *inode, struct file *file)
{
/*
@@ -504,6 +520,10 @@
del_timer(&rtc_irq_timer);
}

+ if (file->f_flags & FASYNC) {
+ rtc_fasync (-1, file, 0);
+ }
+
MOD_DEC_USE_COUNT;

spin_lock_irqsave (&rtc_lock, flags);
@@ -542,7 +562,9 @@
NULL, /* No mmap */
rtc_open,
NULL, /* flush */
- rtc_release
+ rtc_release,
+ NULL, /* fsync */
+ rtc_fasync
};

static struct miscdevice rtc_dev=
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.036 / U:1.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site