]> err.no Git - linux-2.6/blobdiff - sound/aoa/core/snd-aoa-gpio-pmf.c
Merge /pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6] / sound / aoa / core / snd-aoa-gpio-pmf.c
index 0e9b9bb2a6de06a48c7666dbee40ab08f4cd5c90..5ca2220eac7d648a598488aca8858ef45f1e6afd 100644 (file)
 static void pmf_gpio_set_##name(struct gpio_runtime *rt, int on)\
 {                                                              \
        struct pmf_args args = { .count = 1, .u[0].v = !on };   \
-                                                               \
+       int rc;                                                 \
+                                                       \
        if (unlikely(!rt)) return;                              \
-       pmf_call_function(rt->node, #name "-mute", &args);      \
+       rc = pmf_call_function(rt->node, #name "-mute", &args); \
+       if (rc && rc != -ENODEV)                                \
+               printk(KERN_WARNING "pmf_gpio_set_" #name       \
+               " failed, rc: %d\n", rc);                       \
        rt->implementation_private &= ~(1<<bit);                \
        rt->implementation_private |= (!!on << bit);            \
 }                                                              \
@@ -33,9 +37,13 @@ PMF_GPIO(lineout, 2);
 static void pmf_gpio_set_hw_reset(struct gpio_runtime *rt, int on)
 {
        struct pmf_args args = { .count = 1, .u[0].v = !!on };
+       int rc;
 
        if (unlikely(!rt)) return;
-       pmf_call_function(rt->node, "hw-reset", &args);
+       rc = pmf_call_function(rt->node, "hw-reset", &args);
+       if (rc)
+               printk(KERN_WARNING "pmf_gpio_set_hw_reset"
+                      " failed, rc: %d\n", rc);
 }
 
 static void pmf_gpio_all_amps_off(struct gpio_runtime *rt)
@@ -61,9 +69,10 @@ static void pmf_gpio_all_amps_restore(struct gpio_runtime *rt)
        pmf_gpio_set_lineout(rt, (s>>2)&1);
 }
 
-static void pmf_handle_notify(void *data)
+static void pmf_handle_notify(struct work_struct *work)
 {
-       struct gpio_notification *notif = data;
+       struct gpio_notification *notif =
+               container_of(work, struct gpio_notification, work.work);
 
        mutex_lock(&notif->mutex);
        if (notif->notify)
@@ -75,12 +84,9 @@ static void pmf_gpio_init(struct gpio_runtime *rt)
 {
        pmf_gpio_all_amps_off(rt);
        rt->implementation_private = 0;
-       INIT_WORK(&rt->headphone_notify.work, pmf_handle_notify,
-                 &rt->headphone_notify);
-       INIT_WORK(&rt->line_in_notify.work, pmf_handle_notify,
-                 &rt->line_in_notify);
-       INIT_WORK(&rt->line_out_notify.work, pmf_handle_notify,
-                 &rt->line_out_notify);
+       INIT_DELAYED_WORK(&rt->headphone_notify.work, pmf_handle_notify);
+       INIT_DELAYED_WORK(&rt->line_in_notify.work, pmf_handle_notify);
+       INIT_DELAYED_WORK(&rt->line_out_notify.work, pmf_handle_notify);
        mutex_init(&rt->headphone_notify.mutex);
        mutex_init(&rt->line_in_notify.mutex);
        mutex_init(&rt->line_out_notify.mutex);
@@ -121,7 +127,7 @@ static void pmf_handle_notify_irq(void *data)
 {
        struct gpio_notification *notif = data;
 
-       schedule_work(&notif->work);
+       schedule_delayed_work(&notif->work, 0);
 }
 
 static int pmf_set_notify(struct gpio_runtime *rt,