From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10B32C7618B for ; Fri, 26 Jul 2019 15:48:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D5D162166E for ; Fri, 26 Jul 2019 15:48:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387828AbfGZPsg (ORCPT ); Fri, 26 Jul 2019 11:48:36 -0400 Received: from mx2.suse.de ([195.135.220.15]:41420 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725970AbfGZPsg (ORCPT ); Fri, 26 Jul 2019 11:48:36 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BABF1AE2F; Fri, 26 Jul 2019 15:48:34 +0000 (UTC) Date: Fri, 26 Jul 2019 17:48:34 +0200 Message-ID: From: Takashi Iwai To: Samuel Thibault Cc: Jaroslav Kysela , , <931507@bugs.debian.org>, Subject: Re: hda: Fix 1-minute detection delay when i915 module is not available In-Reply-To: <20190726150530.cibwiaohhexl5jdc@function> References: <20190726150530.cibwiaohhexl5jdc@function> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Jul 2019 17:05:30 +0200, Samuel Thibault wrote: > > Distribution installation images such as Debian include different sets > of modules which can be downloaded dynamically. Such images may notably > include the hda sound modules but not the i915 DRM module, even if the > latter was enabled at build time, as reported on > https://bugs.debian.org/931507 > > In such a case hdac_i915 would be linked in and try to load the i915 > module, fail since it is not there, but still wait for a whole minute > before giving up binding with it. > > This fixes such as case by only waiting for the binding if the module > was properly loaded (or module support is disabled, in which case i915 > is already compiled-in anyway). > > Signed-off-by: Samuel Thibault > --- > sound/hda/hdac_i915.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > --- a/sound/hda/hdac_i915.c > +++ b/sound/hda/hdac_i915.c > @@ -143,10 +143,14 @@ int snd_hdac_i915_init(struct hdac_bus * > if (!acomp) > return -ENODEV; > if (!acomp->ops) { > - request_module("i915"); > - /* 60s timeout */ > - wait_for_completion_timeout(&bind_complete, > - msecs_to_jiffies(60 * 1000)); > +#ifdef CONFIG_MODULES > + if (request_module("i915") == 0) > +#endif Better to use IS_ENABLED(), so that we can avoid ugly ifdef. if (!IS_ENABLED(CONFIG_MODULES) || !request_module("i915")) { .... thanks, Takashi