... except that I'm trying to guarantee that only the values '1' or '0'get sent to gpio_direction_output. There's nothing in the spec thatsays other values are legal, although I'll admit that any nonzero valueis unlikely to cause problems. Should I be pedantic here?

> And there are too much pr_debug & dev_dbg calls. Several of them are inside critical sections or in functions called from critical sections (inside spin_lock_irqsave - spin_lock_irqrestore block I mean). Don't think it is good.>

Ok. Now that the code is relatively mature, they're unnecessary anyway.