Skip to content
Snippets Groups Projects
Commit 27b176ee authored by Alessandro Rubini's avatar Alessandro Rubini
Browse files

triggers/zio-trig-irq: two minor fixes


These changes allow the driver to work with a PCI interrupt, a role
that was never used earlier. The commit fixes a warning on removal
when if libgpio is not present in the host kernel; it also tries to
request the shared interrrupt with various edge-trigger bits, until
one succeeds. This allows to use both edges for owned GPIO interrupts
and fall back to no specific requirement when used for a PCI
interrupt.

Signed-off-by: default avatarAlessandro Rubini <rubini@gnudd.com>
Acked-by: default avatarFederico Vaga <federico.vaga@gmail.com>
parent 27d0a81a
Branches
Tags
No related merge requests found
......@@ -88,17 +88,28 @@ static struct zio_ti *zti_create(struct zio_trigger_type *trig,
struct zio_control *ctrl, fmode_t flags)
{
struct zio_ti *ti;
int edges[] = {
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
IRQF_TRIGGER_FALLING,
IRQF_TRIGGER_RISING,
0
};
int i, ret;
int ret;
pr_debug("%s:%d\n", __func__, __LINE__);
ti = kzalloc(sizeof(*ti), GFP_KERNEL);
if (!ti)
return ERR_PTR(-ENOMEM);
ret = request_irq(zti_irq, zti_handler, IRQF_SHARED
| IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
/* Try all edge settings (gpio stuff prefers edges, but pci wants 0) */
for (i = 0; i < ARRAY_SIZE(edges); i++) {
ret = request_irq(zti_irq, zti_handler, IRQF_SHARED | edges[i],
KBUILD_MODNAME, ti);
if (ret == -EBUSY)
continue;
break; /* success or other error */
}
if (ret < 0) {
kfree(ti);
return ERR_PTR(ret);
......@@ -177,7 +188,7 @@ static int __init zti_init(void)
static void __exit zti_exit(void)
{
zio_unregister_trig(&zti_trigger);
if (zti_gpio)
if (zti_gpio != -1)
gpio_free(zti_gpio);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment