request_threaded_irq() is used in the driver why not request_irq()? What are the differences between two?

前端 未结 2 808
轻奢々
轻奢々 2021-02-09 22:17

I posted this is the thread which discussed about request_threaded_irq but I did not get any reply. So I am posting it freshly.

I am working on a touchscreen driver for

2条回答
  •  北荒
    北荒 (楼主)
    2021-02-09 22:43

    The request_threaded_irq() function was added to allow developers to split interrupt handling code into two parts. One part that will execute with interrupts blocked, and a second part that can be done by a kernel thread without interrupts blocked. For details of why, you can read this:

    http://lwn.net/Articles/302043/

    In your case, the driver you linked to does this:

    err = request_threaded_irq(client->irq, NULL, cy8ctmg110_irq_thread,
                               IRQF_TRIGGER_RISING, "touch_reset_key", ts);
    

    By passing NULL for the second arg, "handler", the argument to thread_fn, or the function cy8ctmg110_irq_thread() will be called when the interrupt is detected.

    For you, choosing which request irq function will depend on what your driver needs to do in interrupt context.

提交回复
热议问题