Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp441680iog; Mon, 13 Jun 2022 06:05:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIdcOpRG4+7I4dsLq+BR8DUWFhL2wKcJSzMnvrgHDiUz83B0zDtlNdlly0MxqHhikbzxAe X-Received: by 2002:a17:902:d044:b0:166:4d45:2b0c with SMTP id l4-20020a170902d04400b001664d452b0cmr53719976pll.99.1655125395087; Mon, 13 Jun 2022 06:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125395; cv=none; d=google.com; s=arc-20160816; b=XUUl4P2vmq2HZObAF/WP+nzkcIw2Mn2QBSxtxINuYcQV/nR+7kM6D1LBz0bT2AbnYY vAyuur36sxOOlCHzy8gam0DqWGWNdnAtEcht7AqOkcFUjvmfc9l78HfxE3ZM7ACTlaRk lBjQuj8NVmXoa9VGjjmmcr5/5F3jnHBAqXCzffqXESudkvXhkGDi4WvAbyiEJC/ciUDe LryWN4jx/NA6nG5By+ESZDX31IlmTVUzY1hc/67SfU6gTSfwgHwXUC6Lc4nYO5hh1dGB uvedK3u9OL12hOigljG4qMmxBgppI7fIPtMlQ8oxKxVy0nQKysHi68sxTF/a1O10xWJC hAzQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hXUPDwNR2zhCjaqXMIMehurpXpHV7n3z6phH54b2hmU=; b=sqAD8caALKyUchnICnSSICnvWySuSWMC75pzO5I7LOiYtW70JMTqQ9cXiPVta/wLIG QwHCSZrMZI4t9wXwGfrjtl3lzM5D9i5XL7pcuJHZREKI5z1zEMppDLODfCRdrNjCg5oq L1eSP4MFMPkzgQ5dxK0OnQc1sTRvWT53T5XaLLjFkfrUwV+TfE50yslVqF4tBYFgfEFA PJHL/unUAsZ+cTLlVOUxqh1cuAr2eDe4tZyqSpmrnzJOkxM/hluxqojO+wVQx1mv4OnW Nqlqi78hjyp2LWFaTuCtssHlWTLwHg+efqaXviCbFvJSgxHv80cRrfJLc4HGrR+veNhk rsrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sqa7NT7x; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r12-20020a63fc4c000000b003fd55608dccsi10012313pgk.192.2022.06.13.06.02.59; Mon, 13 Jun 2022 06:03:15 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sqa7NT7x; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355305AbiFMLiW (ORCPT + 99 others); Mon, 13 Jun 2022 07:38:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354216AbiFML3C (ORCPT ); Mon, 13 Jun 2022 07:29:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90D4C3E0C1; Mon, 13 Jun 2022 03:42:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D7549B80D3A; Mon, 13 Jun 2022 10:42:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30896C34114; Mon, 13 Jun 2022 10:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116975; bh=K2yXXrXOJc54nCTB8w/mOYOtui/+CfR7LNG+DaZIC0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sqa7NT7xL+ngWLk2NCe7CgwRfNShcjrNsE0Tg6EVexiPFeWDVItLPqGvm/hddrNgv +KEiP9o4V8ISLIcRshDMrH/257o2KtmtEmUt+7W0RGGt38kXocz8gAeL5PnhpBRzad aWceQLaSuPjtcfZ23Nryl2vnd9HN+dmlxpBJ5xRo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomeu Vizoso , Brian Norris , Douglas Anderson Subject: [PATCH 5.4 242/411] drm/bridge: analogix_dp: Grab runtime PM reference for DP-AUX Date: Mon, 13 Jun 2022 12:08:35 +0200 Message-Id: <20220613094936.035742079@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Brian Norris commit 8fb6c44fe8468f92ac7b8bbfcca4404a4e88645f upstream. 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 a runtime PM reference, and check that we "see" the panel. Don't force any panel power-up, etc., because that can be intrusive, and that's not what other drivers do (see drivers/gpu/drm/bridge/ti-sn65dsi86.c and drivers/gpu/drm/bridge/parade-ps8640.c.) Fixes: 0d97ad03f422 ("drm/bridge: analogix_dp: Remove duplicated code") Cc: Cc: Tomeu Vizoso Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Signed-off-by: Douglas Anderson Link: https://patchwork.freedesktop.org/patch/msgid/20220301181107.v4.1.I773a08785666ebb236917b0c8e6c05e3de471e75@changeid Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1630,8 +1630,19 @@ static ssize_t analogix_dpaux_transfer(s struct drm_dp_aux_msg *msg) { struct analogix_dp_device *dp = to_dp(aux); + int ret; - return analogix_dp_transfer(dp, msg); + pm_runtime_get_sync(dp->dev); + + ret = analogix_dp_detect_hpd(dp); + if (ret) + goto out; + + ret = analogix_dp_transfer(dp, msg); +out: + pm_runtime_put(dp->dev); + + return ret; } struct analogix_dp_device *