On Mon, Mar 24, 2014 at 1:35 PM, Felipe Balbi <ba...@ti.com> wrote:

> looking at the driver, there's still quite a bit of duplication between
> his kthread implementation and what threaded IRQs would give for free...

Well, let's count: hard irq handler:

static irqreturn_t
max3421_irq_handler(int irq, void *dev_id)
{
        struct usb_hcd *hcd = dev_id;
        struct spi_device *spi = to_spi_device(hcd->self.controller);
        struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);

        if (max3421_hcd->spi_thread &&
            max3421_hcd->spi_thread->state != TASK_RUNNING)
                wake_up_process(max3421_hcd->spi_thread);
        if (!max3421_hcd->do_enable_irq) {
                max3421_hcd->do_enable_irq = 1;
                disable_irq_nosync(spi->irq);
        }
        return IRQ_HANDLED;
}

irq-specific part of spi_thread:

           set_current_state(TASK_INTERRUPTIBLE);
           if (max3421_hcd->do_enable_irq) {
                    max3421_hcd->do_enable_irq = 0;
                    enable_irq(spi->irq);
           }
           schedule();
           __set_current_state(TASK_RUNNING);

so we're talking about ~22 lines of code.  As I told you before, I did
start out using a threaded irq handler but it had the distinct
disadvantage of not working.

If you have better solution in mind that actually works, please show
us the code.  As the old saying goes: put up or shut up.

  --david
-- 
eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to