Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp937258rwb; Thu, 10 Nov 2022 09:07:06 -0800 (PST) X-Google-Smtp-Source: AMsMyM4cPZoijoPQF8FO9eu7Dl6p7NEr0Ch4D2XKY81eH1pfrPW9w7W3RdgvnkbWZRglBlYSELAK X-Received: by 2002:a63:1750:0:b0:457:f843:ffcd with SMTP id 16-20020a631750000000b00457f843ffcdmr2847121pgx.101.1668100026494; Thu, 10 Nov 2022 09:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668100026; cv=none; d=google.com; s=arc-20160816; b=GwM483Jns3TBygPcjPfi45E8MGJZSnOxQLaGsKo+osETdB3saZb/rdhY/QdYHynULV i0WQpm8kcM4R8YYcyXxeeTVdIufvRsZJtgpre9BwOgNzoicwvb+XEfaW+ezYgrm57oPB W48TnFnChKDaMMOsJMYdOaPnghpIc1PCvSeYdXk1u2DhBx6fKQULnZFwKvBFJEoGtcvB 4sokMPaT0T6mfl3Nqn/EppCgwpMI4EcvaHfKkRfu7Yy65ARPVpIW7rUMIRkCPzb9wzNt jhI+j/jYQMGGTv+kbcLw85crIJdL4ojixg/KRjWLhCqC7BYfZ0wPXij2duxft1StSzex bfeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=9o/q02SgMUtKwCSGCp62SYqtX4KWBFvmJVY+jW/71qY=; b=LIe6w3LXfmTIKX/vQf6D++nXl5i06gumDIAqoe/lfKnoIEkoSNG4CjuVDeIvDxpsuL ZK3eXrkGnQEa2313KXbjUrt4dQQJKuI7ylIDp/Dsy3B+qstP9BCqa78x0pCTy+kCirE9 3KnUD2cKXDKO/V2V4nYC7Qh84eeIEo8Q2IthDvFX444rU6+kPfpHNRY85EyBq135PMXr mpl8Mn+8WsXhkqpa43MTuRFoH3kIM96UfD6d+uUHz7Jdn+S8nruhz9LiSsDsje1YJRmp oVCZMVFLIFoxy8FWgWYIC1OwlGjg8G3HKw/5Bziim3D6JXQQfuTStu+83phorVpoxvqh nmuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gjVyVor+; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id np2-20020a17090b4c4200b00217cdc4b09csi5278210pjb.3.2022.11.10.09.06.47; Thu, 10 Nov 2022 09:07:06 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=gjVyVor+; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbiKJPvb (ORCPT + 92 others); Thu, 10 Nov 2022 10:51:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231124AbiKJPv3 (ORCPT ); Thu, 10 Nov 2022 10:51:29 -0500 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 460DC93 for ; Thu, 10 Nov 2022 07:51:27 -0800 (PST) Received: by mail-oi1-x22f.google.com with SMTP id s206so2224276oie.3 for ; Thu, 10 Nov 2022 07:51:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9o/q02SgMUtKwCSGCp62SYqtX4KWBFvmJVY+jW/71qY=; b=gjVyVor+cEsWkvWUOGB7xjRTdZoU9NwM5TxlMvWV8xgI6+f1GF/x6yOniLLrKw+5Bh Tq3O+muwLKOkEbZvF9q/SQjhdTDwlw91rcYSsdF37sWMmlYzImmzmQgq+yTiewjlZmZZ IRP7dJ2mQuC+E6iuMcg2fBQWnLG685xFbt5uYlD2DCcH1WkKj2KmMUqrGBsnQ6JMRPWd pgtE3nKCM4sdrTXXbSnLgr7PMwiCo0qdVb4pcjJVr897D/xwnfOLkRyU6kJVXtXGitRz B47vqeHdCvTywOiK7FOaIpo2M493rWPWtQrAwQ4Kx+9gVm/9vxsww0TzKTX7HCEjB+fq xecg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9o/q02SgMUtKwCSGCp62SYqtX4KWBFvmJVY+jW/71qY=; b=X8+89WSW1wuuUcemSE7fBgtvRYb03fjUq15utKB/CpZuUp6BWU6JaP3hIF7lGytM19 XSPbiTGzTTGt5n2qge4l0v0JU3yxoH7Z9Jls8dlHLKCpJTPuwVaL2+vgoni0nT+8JPzy MFEJHsLSdCmqoc0B5uR3Ih3c3V3EPxAjCTb3hQ3fiA1aTJd5UbWuCra4+hOxKhWpMcDH vq73MtAFmfX7P0mbAIX/b80e9kcYV+Wf9nYnvIXaphzpZmHe3pa3h2GpDV2U0mxx63O6 5eEioLaAP5nY3w7KGxRDkRPs3Igjogmz+lL5RzrQ8q+iInsI4cQQOd+SNe2Kzz7O0Avi Xc7A== X-Gm-Message-State: ACrzQf3EnV8An3nuk4lAhRVeeRsITjdP6IWoe0WykgYwBYPBHr5W8Rxn VcfnmzRpHDrxkNsWG+P4GoHgNo0+DsddxAxCtcg= X-Received: by 2002:a05:6808:7dc:b0:34f:97ea:14d with SMTP id f28-20020a05680807dc00b0034f97ea014dmr1575932oij.96.1668095486593; Thu, 10 Nov 2022 07:51:26 -0800 (PST) MIME-Version: 1.0 References: <20221110130925.26928-1-tiwai@suse.de> In-Reply-To: <20221110130925.26928-1-tiwai@suse.de> From: Alex Deucher Date: Thu, 10 Nov 2022 10:51:15 -0500 Message-ID: Subject: Re: [PATCH] drm: radeon: Fix audio get_eld callback To: Takashi Iwai Cc: Alex Deucher , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On Thu, Nov 10, 2022 at 8:09 AM Takashi Iwai wrote: > > Check the availability of the audio capability and mode config before > going to the loop for avoiding the access to an unusable state. Also, > change the loop iterations over encoder instead of connector in order > to align with radeon_audio_enable(). > > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2236 > Signed-off-by: Takashi Iwai > --- > > Note: this is the additional fix on top of the previously submitted > audio component support for radeon. Applied. Thanks. I'll squash this in with the other patches. Alex > > drivers/gpu/drm/radeon/radeon_audio.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c > index 71b67d4efe08..d6ccaf24ee0c 100644 > --- a/drivers/gpu/drm/radeon/radeon_audio.c > +++ b/drivers/gpu/drm/radeon/radeon_audio.c > @@ -747,6 +747,7 @@ static int radeon_audio_component_get_eld(struct device *kdev, int port, > unsigned char *buf, int max_bytes) > { > struct drm_device *dev = dev_get_drvdata(kdev); > + struct radeon_device *rdev = dev->dev_private; > struct drm_encoder *encoder; > struct radeon_encoder *radeon_encoder; > struct radeon_encoder_atom_dig *dig; > @@ -754,19 +755,19 @@ static int radeon_audio_component_get_eld(struct device *kdev, int port, > int ret = 0; > > *enabled = false; > - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { > - const struct drm_connector_helper_funcs *connector_funcs = > - connector->helper_private; > - encoder = connector_funcs->best_encoder(connector); > + if (!rdev->audio.enabled || !rdev->mode_info.mode_config_initialized) > + return 0; > > - if (!encoder) > - continue; > + list_for_each_entry(encoder, &rdev->ddev->mode_config.encoder_list, head) { > if (!radeon_encoder_is_digital(encoder)) > continue; > radeon_encoder = to_radeon_encoder(encoder); > dig = radeon_encoder->enc_priv; > if (!dig->pin || dig->pin->id != port) > continue; > + connector = radeon_get_connector_for_encoder(encoder); > + if (!connector) > + continue; > *enabled = true; > ret = drm_eld_size(connector->eld); > memcpy(buf, connector->eld, min(max_bytes, ret)); > -- > 2.35.3 >