Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp5827595rwn; Mon, 12 Sep 2022 15:14:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7H5SxO5zOKZYhPhroS7LFYKgvgATjQDS/DlZUkdA7w+mc7L9DrbArjWMSreMEi1Zt9/yRz X-Received: by 2002:a17:90a:7088:b0:200:4e9f:a206 with SMTP id g8-20020a17090a708800b002004e9fa206mr513530pjk.173.1663020882167; Mon, 12 Sep 2022 15:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663020882; cv=none; d=google.com; s=arc-20160816; b=h/NSW+A7nmzgKKHGd63SjVNPZvPjea+o6OcNj/eyVHCaTBmaB7CGA2Eh9dm2j4qmhz z2EpwTwjj5l2A05HNUIkTalG6rMRb07FxAd8ddcpMmN3DdsPxr+X2z2cHjvfRHfycF0u upCFsKxT8Aw2C0UdQhOaG63wK/U2nDBbFsfkL4Et3ZmBmgNcDqs73D0gRhAzQDgzeHki PCqV6JaSZaMYf6c9TWK897VYWhrzdz+wT+Th7C9ja6Ch4MOi196BNO4BSdJS5MxIqKQe RwIB8u3VqxPFHoUCP+GTpQV+Alh4ToBl+smyfE0MMCMP6o4SBkG6hVzwmbaI4oVv0DBI 0TgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=cLLzL9vbrWOmXEMD5t4FcHNyuufYLeZfdASc1WjWjII=; b=C+e0oDqnhWYIavPvEoryEz1TPODYfyDeV/W4wKVDwGzu5I2bUcTbGmvv4GGXfSGVqC zTn6jHlZGCyqSTdiC77YL7qGInThGJMk5d784IHj+sK9Z4OV+Rs3ngSRbbZiHNylcN3I +ZqeTu40rgU4N+YckLHma3uBuqgIMb5pGOcr2xI/Ulr43P/PtMhitz9Cn+0RpWG8NaAh 5RIe9sFYjrDgJzmp8WpaT/RBNDdaIvv8kT5/GFIqHujh3gpZIY8ey+0eqP2K5RRydyIH Z1IQrkJK2/b6vL1VzBS1dogfA4SE0hnEOgIfQAI+vEFCR1usm6L2dz+1b6oNEF/B31x5 QvFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kali.org header.s=google header.b=Aajun28E; 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=kali.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a625e06000000b005409634a162si8426654pfb.317.2022.09.12.15.14.30; Mon, 12 Sep 2022 15:14:42 -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=@kali.org header.s=google header.b=Aajun28E; 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=kali.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbiILV4K (ORCPT + 99 others); Mon, 12 Sep 2022 17:56:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbiILV4H (ORCPT ); Mon, 12 Sep 2022 17:56:07 -0400 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FD4F4D147 for ; Mon, 12 Sep 2022 14:56:06 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-11e9a7135easo27080312fac.6 for ; Mon, 12 Sep 2022 14:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kali.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=cLLzL9vbrWOmXEMD5t4FcHNyuufYLeZfdASc1WjWjII=; b=Aajun28E2jbV3q6QZZCZGGP6KuCziXvmeYsaOeiaf7yhSJdtBHSpKt4Z0FmZaF2gD4 6yOkUwVyvjt9Htp5jPmm9YbdsQPbPAW8OE8Q8VCL1S/Roh++pQvj4wStZQ+PuN8TaAoU 2X1W+zltFgSFvaxDqn4JtYNPI+ICtl8k15k8IU8+OGzPS7gHgnE8i6UrxFXHwdNO6vxA 16XK4CbbPFQO2aWWB10YysxHdVIphwVHa1M2Bk2ZaR8qwPmhTqcv/+vDII6CdJtqPey3 cF98dDIstCia36oYbP1Ruo9AouGtrlvs1VL+W4h3KWWEN2IpNdOOUcnVcwugQSwT6x1/ QidA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=cLLzL9vbrWOmXEMD5t4FcHNyuufYLeZfdASc1WjWjII=; b=yPa3D0w0NeQI3ZskIZEAeKgmoELCPfbZQWpEmCI9qLqWH6RFHhe00lklmHpPzW7uYX TFH6hxeS7dd+b5rQbuqlzMvfNwtW5y8gM59rKT/h2ThArdMXcnz7TTF7OTHY+xpgLksJ M5jqSk9XObxNSqbYuBCJSK0V+gjhdSfxeOAfm2kem4+aHx9WRSYqdIkIGCcicrWOuicc 18cTFe7Q5lZGElMOZ+dmpGNZmeXIsCqDm9IPYSrPk/ZR4qgudT0eMvVKye+FwFKYz1SQ GPQ6TNdLETS7rWHopVTVASLY21H137BtqnBobmYmroPguUadbrClh7YkpLzxnz7i+2sk ZodQ== X-Gm-Message-State: ACgBeo2OARYyFs8xV+bvaS337lJrtZnaIR3soUhcbZRu8wZclyYpCAJr 9nYHeOQcaHR5JOTowrsw8Mu/hg== X-Received: by 2002:a05:6808:148e:b0:343:77fc:b7d2 with SMTP id e14-20020a056808148e00b0034377fcb7d2mr185362oiw.128.1663019765587; Mon, 12 Sep 2022 14:56:05 -0700 (PDT) Received: from [192.168.11.16] (cpe-173-173-107-246.satx.res.rr.com. [173.173.107.246]) by smtp.gmail.com with ESMTPSA id k6-20020a4ad106000000b00448a3ecdc9dsm4643175oor.22.2022.09.12.14.56.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Sep 2022 14:56:05 -0700 (PDT) Message-ID: <69526798-93df-a4f9-c385-c9bf490cc709@kali.org> Date: Mon, 12 Sep 2022 16:55:58 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH 4/7] drm/msm/dp: fix aux-bus EP lifetime Content-Language: en-US To: Dmitry Baryshkov , Johan Hovold , Douglas Anderson , Rob Clark Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Sean Paul , Stephen Boyd , Bjorn Andersson , Manivannan Sadhasivam , dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20220912154046.12900-1-johan+linaro@kernel.org> <20220912154046.12900-5-johan+linaro@kernel.org> From: Steev Klimaszewski In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, 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 On 9/12/22 1:10 PM, Dmitry Baryshkov wrote: > On 12/09/2022 18:40, Johan Hovold wrote: >> Device-managed resources allocated post component bind must be tied to >> the lifetime of the aggregate DRM device or they will not necessarily be >> released when binding of the aggregate device is deferred. >> >> This can lead resource leaks or failure to bind the aggregate device >> when binding is later retried and a second attempt to allocate the >> resources is made. >> >> For the DP aux-bus, an attempt to populate the bus a second time will >> simply fail ("DP AUX EP device already populated"). >> >> Fix this by amending the DP aux interface and tying the lifetime of the >> EP device to the DRM device rather than DP controller platform device. > > Doug, could you please take a look? > > For me this is another reminder/pressure point that we should populate > the AUX BUS from the probe(), before binding the components together. > >> >> Fixes: c3bf8e21b38a ("drm/msm/dp: Add eDP support via aux_bus") >> Cc: stable@vger.kernel.org      # 5.19 >> Signed-off-by: Johan Hovold >> --- >>   drivers/gpu/drm/bridge/parade-ps8640.c   | 2 +- >>   drivers/gpu/drm/display/drm_dp_aux_bus.c | 5 +++-- >>   drivers/gpu/drm/msm/dp/dp_display.c      | 3 ++- >>   include/drm/display/drm_dp_aux_bus.h     | 6 +++--- >>   4 files changed, 9 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c >> b/drivers/gpu/drm/bridge/parade-ps8640.c >> index d7483c13c569..6127979370cb 100644 >> --- a/drivers/gpu/drm/bridge/parade-ps8640.c >> +++ b/drivers/gpu/drm/bridge/parade-ps8640.c >> @@ -719,7 +719,7 @@ static int ps8640_probe(struct i2c_client *client) >>       if (ret) >>           return ret; >>   -    ret = devm_of_dp_aux_populate_bus(&ps_bridge->aux, >> ps8640_bridge_link_panel); >> +    ret = devm_of_dp_aux_populate_bus(dev, &ps_bridge->aux, >> ps8640_bridge_link_panel); >>         /* >>        * If devm_of_dp_aux_populate_bus() returns -ENODEV then it's >> up to >> diff --git a/drivers/gpu/drm/display/drm_dp_aux_bus.c >> b/drivers/gpu/drm/display/drm_dp_aux_bus.c >> index f5741b45ca07..2706f2cf82f7 100644 >> --- a/drivers/gpu/drm/display/drm_dp_aux_bus.c >> +++ b/drivers/gpu/drm/display/drm_dp_aux_bus.c >> @@ -322,6 +322,7 @@ static void of_dp_aux_depopulate_bus_void(void >> *data) >>     /** >>    * devm_of_dp_aux_populate_bus() - devm wrapper for >> of_dp_aux_populate_bus() >> + * @dev: Device to tie the lifetime of the EP devices to >>    * @aux: The AUX channel whose device we want to populate >>    * @done_probing: Callback functions to call after EP device >> finishes probing. >>    *                Will not be called if there are no EP devices and >> this >> @@ -333,7 +334,7 @@ static void of_dp_aux_depopulate_bus_void(void >> *data) >>    *         no children. The done_probing() function won't be called >> in that >>    *         case. >>    */ >> -int devm_of_dp_aux_populate_bus(struct drm_dp_aux *aux, >> +int devm_of_dp_aux_populate_bus(struct device *dev, struct >> drm_dp_aux *aux, >>                   int (*done_probing)(struct drm_dp_aux *aux)) >>   { >>       int ret; >> @@ -342,7 +343,7 @@ int devm_of_dp_aux_populate_bus(struct drm_dp_aux >> *aux, >>       if (ret) >>           return ret; >>   -    return devm_add_action_or_reset(aux->dev, >> +    return devm_add_action_or_reset(dev, >>                       of_dp_aux_depopulate_bus_void, aux); >>   } >>   EXPORT_SYMBOL_GPL(devm_of_dp_aux_populate_bus); >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c >> b/drivers/gpu/drm/msm/dp/dp_display.c >> index ba557328710a..e1aa6355bbf6 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_display.c >> +++ b/drivers/gpu/drm/msm/dp/dp_display.c >> @@ -1559,7 +1559,8 @@ static int dp_display_get_next_bridge(struct >> msm_dp *dp) >>            * panel driver is probed asynchronously but is the best we >>            * can do without a bigger driver reorganization. >>            */ >> -        rc = devm_of_dp_aux_populate_ep_devices(dp_priv->aux); >> +        rc = devm_of_dp_aux_populate_ep_devices(dp->drm_dev->dev, >> +                            dp_priv->aux); >>           of_node_put(aux_bus); >>           if (rc) >>               goto error; >> diff --git a/include/drm/display/drm_dp_aux_bus.h >> b/include/drm/display/drm_dp_aux_bus.h >> index 8a0a486383c5..a4063aa7fc40 100644 >> --- a/include/drm/display/drm_dp_aux_bus.h >> +++ b/include/drm/display/drm_dp_aux_bus.h >> @@ -47,7 +47,7 @@ static inline struct dp_aux_ep_driver >> *to_dp_aux_ep_drv(struct device_driver *dr >>   int of_dp_aux_populate_bus(struct drm_dp_aux *aux, >>                  int (*done_probing)(struct drm_dp_aux *aux)); >>   void of_dp_aux_depopulate_bus(struct drm_dp_aux *aux); >> -int devm_of_dp_aux_populate_bus(struct drm_dp_aux *aux, >> +int devm_of_dp_aux_populate_bus(struct device *dev, struct >> drm_dp_aux *aux, >>                   int (*done_probing)(struct drm_dp_aux *aux)); >>     /* Deprecated versions of the above functions. To be removed when >> no callers. */ >> @@ -61,11 +61,11 @@ static inline int >> of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux) >>       return (ret != -ENODEV) ? ret : 0; >>   } >>   -static inline int devm_of_dp_aux_populate_ep_devices(struct >> drm_dp_aux *aux) >> +static inline int devm_of_dp_aux_populate_ep_devices(struct device >> *dev, struct drm_dp_aux *aux) >>   { >>       int ret; >>   -    ret = devm_of_dp_aux_populate_bus(aux, NULL); >> +    ret = devm_of_dp_aux_populate_bus(dev, aux, NULL); >>         /* New API returns -ENODEV for no child case; adapt to old >> assumption */ >>       return (ret != -ENODEV) ? ret : 0; > This breaks builds which have ti-sn65dsi86 included: drivers/gpu/drm/bridge/ti-sn65dsi86.c:628:50: error: passing argument 1 of 'devm_of_dp_aux_populate_ep_devices' from incompatible argument type. As well, drivers/gpu/drm/bridge/ti-sn65dsi86.c:628:15: error: too few arguments to function 'devm_of_dp_aux_populate_ep_devices' --steev