ALSA: hda - Introduce azx_has_pm_runtime() macro
authorTakashi Iwai <tiwai@suse.de>
Thu, 19 Feb 2015 15:51:17 +0000 (16:51 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 19 Feb 2015 20:41:18 +0000 (21:41 +0100)
For making the debugging of runtime PM easier, introduce
azx_has_pm_runtime() and use it in all places checking the runtime pm
driver capability.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_controller.c
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_priv.h

index 31ff8b55f3867b1f594d2a32187eda2f8a345599..3589fc2165b09a9e78b0a06e64b258f345781969 100644 (file)
@@ -1681,7 +1681,7 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
        int i;
 
 #ifdef CONFIG_PM
-       if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
+       if (azx_has_pm_runtime(chip))
                if (!pm_runtime_active(chip->card->dev))
                        return IRQ_NONE;
 #endif
@@ -1784,7 +1784,7 @@ static void azx_power_notify(struct hda_bus *bus, bool power_up)
 {
        struct azx *chip = bus->private_data;
 
-       if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
+       if (!azx_has_pm_runtime(chip))
                return;
 
        if (power_up)
index 36d2f20db7a4201b999155e759e3e22b6fe3f753..589883291f4e525bc96a5a561d33ac1cc0ae387b 100644 (file)
@@ -852,7 +852,7 @@ static int azx_runtime_suspend(struct device *dev)
        if (chip->disabled || hda->init_failed)
                return 0;
 
-       if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
+       if (!azx_has_pm_runtime(chip))
                return 0;
 
        /* enable controller wake up event */
@@ -885,7 +885,7 @@ static int azx_runtime_resume(struct device *dev)
        if (chip->disabled || hda->init_failed)
                return 0;
 
-       if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
+       if (!azx_has_pm_runtime(chip))
                return 0;
 
        if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
@@ -928,8 +928,7 @@ static int azx_runtime_idle(struct device *dev)
        if (chip->disabled || hda->init_failed)
                return 0;
 
-       if (!power_save_controller ||
-           !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
+       if (!power_save_controller || !azx_has_pm_runtime(chip))
                return -EBUSY;
 
        return 0;
@@ -1071,8 +1070,7 @@ static int azx_free(struct azx *chip)
        struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
        int i;
 
-       if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
-                       && chip->running)
+       if (azx_has_pm_runtime(chip) && chip->running)
                pm_runtime_get_noresume(&pci->dev);
 
        azx_del_card_list(chip);
@@ -1938,7 +1936,7 @@ static int azx_probe_continue(struct azx *chip)
        power_down_all_codecs(chip);
        azx_notifier_register(chip);
        azx_add_card_list(chip);
-       if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) || hda->use_vga_switcheroo)
+       if (azx_has_pm_runtime(chip) || hda->use_vga_switcheroo)
                pm_runtime_put_noidle(&pci->dev);
 
 out_free:
index daf458299753fae6f2ca59571d34508763522d1d..a7b4a25c571caf15ab640cf4aca5af66de0b6a0e 100644 (file)
@@ -403,4 +403,7 @@ struct azx {
 #define azx_sd_readb(chip, dev, reg) \
        ((chip)->ops->reg_readb((dev)->sd_addr + AZX_REG_##reg))
 
+#define azx_has_pm_runtime(chip) \
+       (!AZX_DCAPS_PM_RUNTIME || ((chip)->driver_caps & AZX_DCAPS_PM_RUNTIME))
+
 #endif /* __SOUND_HDA_PRIV_H */
This page took 0.02752 seconds and 5 git commands to generate.