[linux-audio-dev] tiny patch for RTC async I/O in 2.3.41

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: [linux-audio-dev] tiny patch for RTC async I/O in 2.3.41
From: Paul Barton-Davis (pbd_AT_Op.Net)
Date: ma tammi  31 2000 - 00:13:36 EST


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=


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:23:27 EST