diff options
Diffstat (limited to 'sound/pci/hda/hda_controller.c')
-rw-r--r-- | sound/pci/hda/hda_controller.c | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 870102f00efd..d6a7bda28925 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -784,53 +784,12 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr, { struct azx *chip = bus_to_azx(bus); struct hda_bus *hbus = &chip->bus; - unsigned long timeout; - unsigned long loopcounter; - wait_queue_entry_t wait; - bool warned = false; + int err; - init_wait_entry(&wait, 0); again: - timeout = jiffies + msecs_to_jiffies(1000); - - for (loopcounter = 0;; loopcounter++) { - spin_lock_irq(&bus->reg_lock); - if (!bus->polling_mode) - prepare_to_wait(&bus->rirb_wq, &wait, - TASK_UNINTERRUPTIBLE); - if (bus->polling_mode) - snd_hdac_bus_update_rirb(bus); - if (!bus->rirb.cmds[addr]) { - if (res) - *res = bus->rirb.res[addr]; /* the last value */ - if (!bus->polling_mode) - finish_wait(&bus->rirb_wq, &wait); - spin_unlock_irq(&bus->reg_lock); - return 0; - } - spin_unlock_irq(&bus->reg_lock); - if (time_after(jiffies, timeout)) - break; -#define LOOP_COUNT_MAX 3000 - if (!bus->polling_mode) { - schedule_timeout(msecs_to_jiffies(2)); - } else if (hbus->needs_damn_long_delay || - loopcounter > LOOP_COUNT_MAX) { - if (loopcounter > LOOP_COUNT_MAX && !warned) { - dev_dbg_ratelimited(chip->card->dev, - "too slow response, last cmd=%#08x\n", - bus->last_cmd[addr]); - warned = true; - } - msleep(2); /* temporary workaround */ - } else { - udelay(10); - cond_resched(); - } - } - - if (!bus->polling_mode) - finish_wait(&bus->rirb_wq, &wait); + err = snd_hdac_bus_get_response(bus, addr, res); + if (!err) + return 0; if (hbus->no_response_fallback) return -EIO; |