From patchwork Wed Aug 30 15:36:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 137209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp4732206vqm; Wed, 30 Aug 2023 12:23:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFIhrzs8NM6K1lksoqrlm6KSyFZCellox3lAwVB2LAm4AykD62Kpo/HgbYtRUeZj5SZL6hk X-Received: by 2002:a17:907:7804:b0:9a1:e230:ac4c with SMTP id la4-20020a170907780400b009a1e230ac4cmr2593832ejc.17.1693423421244; Wed, 30 Aug 2023 12:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693423421; cv=none; d=google.com; s=arc-20160816; b=JEIuv5h+gRvre1zp9OZQpf0Xh9Qo/SR2Cm03nneUl1Gm2wGeKmL7XkG3xI+cdXfoyt qOyh2XMUCjFUBPXr0h6XdSdi82qh9WplGfBEZS5zTAVpaarUQuXpTiZceaxlri4V0CeC XByParBAnvk2LDXcQ5NxU2OGqFism1mmPCJScxWboyiAIfYtEf1Etk1lv50poIbgNkb1 9wplOYkyFZK1X/Kl/Arg6w1bkPXg6lWOril4OcQsbKq6nLqot0a2Bdl48Eq6EHCFlZnW jDrIf7lPT8w5cSu3f9trAxF8agtnlLY+FhDAcCq9AZ+zFUlsuG8y/ql0JgXPaNUdyagF XiQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=W9nQgkADd+BzZZPMLSZacG+puHGt/q9byCd+qJMvpgg=; fh=gSlqDyTAaX4sD5o7lNdgN6GT1mkO6Z4/Ye0T8jAhwnM=; b=VtPR617tf0OgXLRHLxWwboW/VG9kXrk3Ks06JWipfwuIfht+0+xRJJVpNeDHSuFWAW 7u78Y4UkymrtKXh1Oah1jbU/9hLRC32kaMyil59Pq90gZpJ+ZdI5BBvgDNMOsxYW6/V3 mYgoIqkMlq6GUUC4l7tZSqrERi0yLlMB+aJ9fDGFOs/KF1pl4DdUTmxJLb8Tf6EnnEg5 92nGL9Vg0ctO5ePT7lqsIDNRkm0qPY6MtIcRQJLBjSbKo6ZIv4wQN5QrtV32vhzniXc6 U12DMafzvQhclaXXLE3P7acJG9lXAZmQQLaQkaLJ+lFun4ZRPF2VsRnCxL0rC8zvTzmv Uv0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a17090691c800b0099de8722195si5696504ejx.747.2023.08.30.12.23.14; Wed, 30 Aug 2023 12:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244969AbjH3TPh (ORCPT + 99 others); Wed, 30 Aug 2023 15:15:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245577AbjH3PhN (ORCPT ); Wed, 30 Aug 2023 11:37:13 -0400 Received: from mblankhorst.nl (lankhorst.se [IPv6:2a02:2308:0:7ec:e79c:4e97:b6c4:f0ae]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98C1D1A4 for ; Wed, 30 Aug 2023 08:37:10 -0700 (PDT) From: Maarten Lankhorst To: alsa-devel@alsa-project.org Cc: Maarten Lankhorst , Jaroslav Kysela , Takashi Iwai , Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Daniel Baluta , linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org Subject: [PATCH v4 07/11] ASoC: Intel: avs: Move snd_hdac_i915_init to before probe_work. Date: Wed, 30 Aug 2023 17:36:48 +0200 Message-Id: <20230830153652.217855-8-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230830153652.217855-1-maarten.lankhorst@linux.intel.com> References: <20230830153652.217855-1-maarten.lankhorst@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775683157210992674 X-GMAIL-MSGID: 1775683157210992674 Now that we can use -EPROBE_DEFER, it's no longer required to spin off the snd_hdac_i915_init into a workqueue. It's likely the whole workqueue can be destroyed, but I don't have the means to test this. Removing the workqueue would simplify init even further, but is left as exercise for the reviewer. Signed-off-by: Maarten Lankhorst Acked-by: Mark Brown Reviewed-by: Kai Vehmanen --- Changes since v1: - Rename error label. --- sound/soc/intel/avs/core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c index bbb40339c75f4..8a20639582487 100644 --- a/sound/soc/intel/avs/core.c +++ b/sound/soc/intel/avs/core.c @@ -191,10 +191,6 @@ static void avs_hda_probe_work(struct work_struct *work) pm_runtime_set_active(bus->dev); /* clear runtime_error flag */ - ret = snd_hdac_i915_init(bus, true); - if (ret < 0) - dev_info(bus->dev, "i915 init unsuccessful: %d\n", ret); - snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true); avs_hdac_bus_init_chip(bus, true); avs_hdac_bus_probe_codecs(bus); @@ -465,10 +461,19 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id) pci_set_drvdata(pci, bus); device_disable_async_suspend(dev); + ret = snd_hdac_i915_init(bus, false); + if (ret == -EPROBE_DEFER) + goto err_i915_init; + else if (ret < 0) + dev_info(bus->dev, "i915 init unsuccessful: %d\n", ret); + schedule_work(&adev->probe_work); return 0; +err_i915_init: + pci_clear_master(pci); + pci_set_drvdata(pci, NULL); err_acquire_irq: snd_hdac_bus_free_stream_pages(bus); snd_hdac_ext_stream_free_all(bus);