monotone polling in a driver

From: Matan Ziv-Av (matan@svgalib.org)
Date: Sun Jun 25 2000 - 08:51:29 EST


Hi,

I write a driver for a hardware device (tv card remote control) that
needs to be polled for input at 50Hz.

Which way is preferable (adding less load to the system): (or is there a
better way?)

static int ticks=0;
static void miro_timer(void *ptr)
{
        /* Put ourselves back in the task queue */
        queue_task(miro_timer, &tq_timer);
        ticks++;
        if(ticks<HZ/50) return;
        ticks=0;
        /* poll hardware */
}

Or:

static struct timer_list miro_tl;
static void miro_timer(unsigned long ignored)
{
        /* Put ourselves back in the timerlist */
        miro_tl.expires=jiffies+HZ/50;
        add_timer(&miro_tl);
        /* poll hardware */
}

-- 
Matan Ziv-Av.                         matan@svgalib.org

- 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/



This archive was generated by hypermail 2b29 : Mon Jun 26 2000 - 21:00:07 EST