From 2566d36ab4f0b90141bb59a5f7342255751fbf45 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 25 Jul 2006 16:12:51 +0200 Subject: [ALSA] aoa: feature gpio layer: fix IRQ access The IRQ rework caused some hiccups here, in some cases we call get_irq without a device node. This patch makes it catch that case and return NO_IRQ when it happens, along with changing the place where the irq is checked to check for NO_IRQ instead of -1. Acked-by: Benjamin Herrenschmidt Signed-off-by: Johannes Berg Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/aoa/core/snd-aoa-gpio-feature.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sound/aoa/core') diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c index 7ae0c0bdfad..f69d33357a2 100644 --- a/sound/aoa/core/snd-aoa-gpio-feature.c +++ b/sound/aoa/core/snd-aoa-gpio-feature.c @@ -112,7 +112,10 @@ static struct device_node *get_gpio(char *name, static void get_irq(struct device_node * np, int *irqptr) { - *irqptr = irq_of_parse_and_map(np, 0); + if (np) + *irqptr = irq_of_parse_and_map(np, 0); + else + *irqptr = NO_IRQ; } /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */ @@ -322,7 +325,7 @@ static int ftr_set_notify(struct gpio_runtime *rt, return -EINVAL; } - if (irq == -1) + if (irq == NO_IRQ) return -ENODEV; mutex_lock(¬if->mutex); -- cgit v1.2.3 From be6a83dd668fb8578456b61d9e16a18d9bc37a65 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 25 Jul 2006 16:15:07 +0200 Subject: [ALSA] aoa: platform function gpio: ignore errors from functions that don't exist Sometimes we simply want to turn off or on everything, and when recently a warning was added when a certain platform function can't be called, this triggered all the time in those cases. This patch shows the warning only if the error was different from the function not existing. The alternative would be to not even try calling the function when it doesn't exist by first checking which exist and then only calling those that do, but that adds complexity that isn't necessary. Signed-off-by: Johannes Berg Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/aoa/core/snd-aoa-gpio-pmf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/aoa/core') diff --git a/sound/aoa/core/snd-aoa-gpio-pmf.c b/sound/aoa/core/snd-aoa-gpio-pmf.c index 3d57fd1aec4..2836c321839 100644 --- a/sound/aoa/core/snd-aoa-gpio-pmf.c +++ b/sound/aoa/core/snd-aoa-gpio-pmf.c @@ -18,7 +18,7 @@ static void pmf_gpio_set_##name(struct gpio_runtime *rt, int on)\ \ if (unlikely(!rt)) return; \ rc = pmf_call_function(rt->node, #name "-mute", &args); \ - if (rc) \ + if (rc && rc != -ENODEV) \ printk(KERN_WARNING "pmf_gpio_set_" #name \ " failed, rc: %d\n", rc); \ rt->implementation_private &= ~(1<