Re: Patch of a new driver for kernel 2.4.x that need review

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mark Gross writes:
+static int
+tlclk_open(struct inode *inode, struct file *filp)
+{
+	int result;
+#ifdef MODULE
+	if (!MOD_IN_USE) {
+		MOD_INC_USE_COUNT;
+#endif
+ /* Make sure there is no interrupt pending will + * initialising interrupt handler */
+		inb(TLCLK_REG6);
+
+		result = request_irq(telclk_interrupt, &tlclk_interrupt,
+					SA_SHIRQ, "telclock", tlclk_interrupt);

Instead of playing the MOD_IN_USE games, please either (1) grab the irq in module init (it's a shared IRQ after all) or (2) do the following: static int tlclk_used;
static int tlclk_open(struct inode *inode, struct file *filp) {
      if (tlclk_used++)
return 0;
      // request_irq goes here.
} For an example, see the file drivers/input/mouse/amimouse.c (appears in 2.6.12 at least). Pekka
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux