Quoting Imre Deak (2018-08-17 10:14:51) > On Thu, Aug 16, 2018 at 07:01:36PM +0100, Chris Wilson wrote: > > Loading the sounds modules is asynchronous with the sysfs device > > hierarchy being instantiated sometime after modprobe returns. As such > > while we are probing for the sound device, poll a few times to > > accommodate the async discovery. > > > > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > > Cc: Imre Deak <imre.deak@xxxxxxxxx> > > Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxxxxxxx> > > > --- > > lib/igt_pm.c | 65 +++++++++++++++++++++++++++++++++------------------- > > 1 file changed, 41 insertions(+), 24 deletions(-) > > > > diff --git a/lib/igt_pm.c b/lib/igt_pm.c > > index 6e96db22b..f82707231 100644 > > --- a/lib/igt_pm.c > > +++ b/lib/igt_pm.c > > @@ -138,31 +138,17 @@ static void strchomp(char *str) > > str[len - 1] = 0; > > } > > > > -/** > > - * igt_pm_enable_audio_runtime_pm: > > - * > > - * We know that if we don't enable audio runtime PM, snd_hda_intel will never > > - * release its power well refcount, and we'll never reach the LPSP state. > > - * There's no guarantee that it will release the power well if we enable > > - * runtime PM, but at least we can try. > > - * > > - * We don't have any assertions on open since the user may not even have > > - * snd_hda_intel loaded, which is not a problem. > > - */ > > -void igt_pm_enable_audio_runtime_pm(void) > > +static int __igt_pm_enable_audio_runtime_pm(void) > > { > > char *path = NULL; > > struct dirent *de; > > DIR *dir; > > + int err; > > int fd; > > > > - /* Check if already enabled. */ > > - if (__igt_pm_audio_runtime_power_save[0]) > > - return; > > - > > dir = opendir("/sys/class/sound"); > > if (!dir) > > - return; > > + return 0; > > > > /* Find PCI device claimed by snd_hda_intel and tied to i915. */ > > while ((de = readdir(dir))) { > > @@ -196,18 +182,17 @@ void igt_pm_enable_audio_runtime_pm(void) > > de->d_name)); > > > > igt_debug("Audio device path is %s\n", path); > > - > > break; > > } > > Could close dir while at it. Good point. > Reviewed-by: Imre Deak <imre.deak@xxxxxxxxx> > > This time the catch was that snd_hda_intel's second half of probe is run > from a scheduled work. (even though the first half returns synchronously > due to modprobe being synchronous as you found last time) The results from the CI didn't look too promising, but I'm a bit dubious as to what exactly was tested and so pushed anyway ;) What next if it still doesn't discover an audio device? Hmm, is the /sys/class/sound construction async? I was assuming it was constructed by the parent snd module long before sna_hda_intel does it thing. -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx