From patchwork Thu Apr 7 10:57:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 8770961 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B1812C0553 for ; Thu, 7 Apr 2016 10:57:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CDA1E20204 for ; Thu, 7 Apr 2016 10:57:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E6D59201EC for ; Thu, 7 Apr 2016 10:57:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 38F296E972; Thu, 7 Apr 2016 10:57:32 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0A3446E972 for ; Thu, 7 Apr 2016 10:57:31 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 50698AD79; Thu, 7 Apr 2016 10:57:28 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Thu, 7 Apr 2016 12:57:23 +0200 Message-Id: <1460026644-30479-3-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1460026644-30479-1-git-send-email-tiwai@suse.de> References: <1460026644-30479-1-git-send-email-tiwai@suse.de> Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 2/3] ALSA: hda - Immediately fail if the i915 audio component is disabled X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since i915 notifies its disabled state via the stub component binding, we can bail out immediately once when the disabled flag is detected. Based on the original patch by Imre Deak Signed-off-by: Takashi Iwai --- sound/hda/hdac_i915.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index 6800e0c5a38f..812777f9af1f 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c @@ -223,8 +223,18 @@ static int hdac_component_master_bind(struct device *dev) if (ret < 0) return ret; - if (WARN_ON(!(acomp->dev && acomp->ops && acomp->ops->get_power && - acomp->ops->put_power && acomp->ops->get_cdclk_freq))) { + if (WARN_ON(!(acomp->dev && acomp->ops))) { + ret = -EINVAL; + goto out_unbind; + } + + if (acomp->ops->disabled) { + ret = -ENODEV; + goto out_unbind; + } + + if (WARN_ON(!(acomp->ops->get_power && acomp->ops->put_power && + acomp->ops->get_cdclk_freq))) { ret = -EINVAL; goto out_unbind; } @@ -342,7 +352,7 @@ int snd_hdac_i915_init(struct hdac_bus *bus) */ request_module("i915"); - if (!acomp->ops) { + if (!acomp->ops || acomp->ops->disabled) { ret = -ENODEV; goto out_master_del; }