Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1606357pxb; Fri, 1 Oct 2021 14:43:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQYutoA2KEtqSw+nmBz2oywCZS7qdk+EV2sqHg0UGhoQ4AlBxha0VuCORPjxHdCCRQMYTv X-Received: by 2002:a05:6402:1bdc:: with SMTP id ch28mr477944edb.41.1633124594460; Fri, 01 Oct 2021 14:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633124594; cv=none; d=google.com; s=arc-20160816; b=weDVW70zkdJji9W/nkp9fJhzKdUQ8Exy1pHxgHwFsbuuHpCwhgmbSHMPBVX+kLKOid kEl9bqLLM4qB2KHqKCQs5VVpmQfzHHk69DXxXyL9vcitLLRwQelmHMWLRWNk9CZq+o9Q qg4+rwDhelapBGTLdmz4txaPyccN8h28cQvGJSvwRKW0JXMEyKK1PiPZITCE20iAsd9O QbCHdphr0P9YmQOI2OVzV8ewnqqdicePQ3ZKXR9S5W4N/Aw5CY/xyz840ddmP2+zBOpR gi7aQGCev5IKJpqb+QoPZxDkcA8uis4kwVtzYXX5Aff7SWn+VAbkDpo5kLFwPiI5wk8p Fvug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zkZRE1eEAZyryz39bCaestf9STy5sTzg/yvpAeBoKL4=; b=AndDVWuLwPMTsutAE+v32elV8YDfSjPnFgV5xNTJ4rLLDI52POorHhKp7uxvXLeQQo y/ROZgK+E/vOI8TKVUeG6JqhFk6TWf5Cqtl/2/7M2SrX+NZlJDxbpKMkuPEq6mPGkpMQ FgtX/8ylJRWLM+EIYDTtt0xWK7j2TwOwYJiIyVDU9fC8n8D4ovn7EGPrCg1u29z1gXhL RzCMQo8y4fT50F/wmlASabwthv04Ya/R6RQjkBNdemo/xZz03NCDGCInsGowtSm3qYX1 ac+gZPLn+PHIbBJckV64Dno+L6Z9uzkHlSMh+Jq4TgVyLN6/sgOst4c7BOEjUHUsI1Vm yk9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=CCfbyOwf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si12431271edc.78.2021.10.01.14.42.49; Fri, 01 Oct 2021 14:43:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=CCfbyOwf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355319AbhJAUjN (ORCPT + 99 others); Fri, 1 Oct 2021 16:39:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbhJAUjM (ORCPT ); Fri, 1 Oct 2021 16:39:12 -0400 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7C5DC061775 for ; Fri, 1 Oct 2021 13:37:27 -0700 (PDT) Received: by mail-qk1-x736.google.com with SMTP id m7so10403722qke.8 for ; Fri, 01 Oct 2021 13:37:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zkZRE1eEAZyryz39bCaestf9STy5sTzg/yvpAeBoKL4=; b=CCfbyOwfd0P5t+5ZRImMnUUskPj72rArktg6RNaaUNyqXUeSgwpM0rbAcBAkglWGIq Ay6J1tK3tzZyS4rNAL4Ie+5m+CxzGQLqODv44oIGUpXsXPPErFtsUvyi1Ih5aIRK06jS keLPV3t/hH5HZ09dSBgthqijzUkoR9Z9U2xEZYGbrxp8yxMiltt7cYgV8CRb3z1N13is X/V1h6W7+jmpVATxfjdn5QbUBJ4FZV+O5R7shhJJj3Yc4pi04JGiICRUcPpMDr24Yv6U JQmu27ksNY9r75HUGveFA/TQIniku8vM8xLV89+TRl3DdYOt7mYt5pmsStjLkbN2Fgcd fbYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zkZRE1eEAZyryz39bCaestf9STy5sTzg/yvpAeBoKL4=; b=XWqlWTL9sd+Qow0gAVaKnEe3I+zhgvh0gnhuUOcKU9L1b/+wO0VxrPwarXTEuHFRD+ MUJ8hHy5IYR4lIa/wHnwCxRwtheVAZJqRNSQPZoN+UsmWRo+S+ddJizJQ3BgJzc7Qel8 lalEII2R48AjmAlc3IfEPHJRknY2z65LXSyPiFCWEfj6i2hVI+s7nGCIxst7tRF6hPGG slILQzlsO4gJu4V08GftewA0p3+S8usbs8kQVqGOwu0DyRcp2WWo94tkb339CZgaZXbl LESciNkczMldozMNai6JIpZ0B4R+14uHo4xCwIn6fK4HKVjqGTxpdh4pH1Xoqs+pIaAJ VcuA== X-Gm-Message-State: AOAM532175eWRWnoyrlehkNf52jLcgrmOZW2AZ41i44Ijkam+vL+iJAU m0VugidvonBb27S21MNPEYSTmg== X-Received: by 2002:ae9:e895:: with SMTP id a143mr55119qkg.113.1633120646890; Fri, 01 Oct 2021 13:37:26 -0700 (PDT) Received: from localhost ([167.100.64.199]) by smtp.gmail.com with ESMTPSA id i8sm3957487qtp.55.2021.10.01.13.37.26 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Oct 2021 13:37:26 -0700 (PDT) Date: Fri, 1 Oct 2021 16:37:22 -0400 From: Sean Paul To: Brian Norris Cc: Andrzej Hajda , Neil Armstrong , dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Laurent Pinchart , linux-kernel@vger.kernel.org, Jonas Karlman , Jernej Skrabec , stable@vger.kernel.org, Tomeu Vizoso Subject: Re: [PATCH] drm/brdige: analogix_dp: Grab runtime PM reference for DP-AUX Message-ID: <20211001203722.GZ2515@art_vandelay> References: <20210929144010.1.I773a08785666ebb236917b0c8e6c05e3de471e75@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210929144010.1.I773a08785666ebb236917b0c8e6c05e3de471e75@changeid> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 02:41:03PM -0700, Brian Norris wrote: > If the display is not enable()d, then we aren't holding a runtime PM > reference here. Thus, it's easy to accidentally cause a hang, if user > space is poking around at /dev/drm_dp_aux0 at the "wrong" time. > > Let's get the panel and PM state right before trying to talk AUX. > > Fixes: 0d97ad03f422 ("drm/bridge: analogix_dp: Remove duplicated code") > Cc: > Cc: Tomeu Vizoso > Signed-off-by: Brian Norris > --- > > .../gpu/drm/bridge/analogix/analogix_dp_core.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > index b7d2e4449cfa..a1b553904b85 100644 > --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c > @@ -1632,8 +1632,23 @@ static ssize_t analogix_dpaux_transfer(struct drm_dp_aux *aux, > struct drm_dp_aux_msg *msg) > { > struct analogix_dp_device *dp = to_dp(aux); > + int ret, ret2; > > - return analogix_dp_transfer(dp, msg); > + ret = analogix_dp_prepare_panel(dp, true, false); > + if (ret) { > + DRM_DEV_ERROR(dp->dev, "Failed to prepare panel (%d)\n", ret); s/DRM_DEV_ERROR/drm_err/ > + return ret; > + } > + > + pm_runtime_get_sync(dp->dev); > + ret = analogix_dp_transfer(dp, msg); > + pm_runtime_put(dp->dev); > + > + ret2 = analogix_dp_prepare_panel(dp, false, false); > + if (ret2) > + DRM_DEV_ERROR(dp->dev, "Failed to unprepare panel (%d)\n", ret2); What's the reasoning for not propagating unprepare failures? I feel like that should be fair game. > + > + return ret; > } > > struct analogix_dp_device * > -- > 2.33.0.685.g46640cef36-goog > -- Sean Paul, Software Engineer, Google / Chromium OS