From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60637C433EF for ; Mon, 23 May 2022 17:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239105AbiEWRBE (ORCPT ); Mon, 23 May 2022 13:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239049AbiEWRBD (ORCPT ); Mon, 23 May 2022 13:01:03 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ABC3112 for ; Mon, 23 May 2022 10:00:58 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id i27so30114335ejd.9 for ; Mon, 23 May 2022 10:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+yqE1pGHx1x3KKc79e6Yq8sNIx1yXpNzstv/8bzqb5s=; b=ZjtsMPgQV6WFMaPsFE5wXrme9HyysqJfDxmCwYeAGbvKIHUWff1Cpyv4vRAIzb2+6g CaBM3u9mN7ChwiUoZn0x2jmbmh8Ids9Twb+q9Mx4bev++DIoBHEX+JPi/peV3/cHXpnt ki/dDbMZHLrt1JuRTfIjOmj46abGOccIRmJ+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+yqE1pGHx1x3KKc79e6Yq8sNIx1yXpNzstv/8bzqb5s=; b=gzXWuogFSsxQ/6k/DrgJCgHR9EaHzFomA+/8p1VrXp2i7u+dyLNZGnFXQ7Hmw3hQj3 llUBtrV96i9vh3+wnX3Ne7aMYciEqSJuQfl58AQbGaEWqK8+fCggRRu0H5XRqF6ojSAn UqZ+Da/VYU7FXWZNUJzxWnUJGwubSiYCmNMnykNweinskqXT1dS2uekO6lKYxatqUa3i hD8pIvZDQYd9MVfk5K1Zo1OXkk+mxHBXTIXJlTOfuumM33ZnrSwqaFHXeO0ku40Rhp4R yjveTPovCEf30NSjRE3LNqcZfmSVbrb7c3PthFaJldywzCWXNX+5iFu0q3J7x4hwjDVX iUmQ== X-Gm-Message-State: AOAM531fqWMttIzVrPzeVKs8BWD07gyskBI/i+T659zVyjKoGkam6pES vfSaZ4ydmO6UnffEynNz14jKG5wlwbuN6aRZVhs= X-Google-Smtp-Source: ABdhPJyUoz7JoGSVC20XyjSebNuLQEggIxIH6zMKhWUiiVx/o/N42Xa7YcpbFEvXbqSiReacoV+bew== X-Received: by 2002:a17:906:9b92:b0:6fd:e4ce:e416 with SMTP id dd18-20020a1709069b9200b006fde4cee416mr20768186ejc.394.1653325256896; Mon, 23 May 2022 10:00:56 -0700 (PDT) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com. [209.85.221.46]) by smtp.gmail.com with ESMTPSA id p3-20020a056402074300b0042617ba63a5sm8446834edy.47.2022.05.23.10.00.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 May 2022 10:00:54 -0700 (PDT) Received: by mail-wr1-f46.google.com with SMTP id h5so21140065wrb.11 for ; Mon, 23 May 2022 10:00:53 -0700 (PDT) X-Received: by 2002:a05:6000:1c03:b0:20e:5cac:1eb5 with SMTP id ba3-20020a0560001c0300b0020e5cac1eb5mr19994642wrb.422.1653325252721; Mon, 23 May 2022 10:00:52 -0700 (PDT) MIME-Version: 1.0 References: <20220510192944.2408515-1-dianders@chromium.org> <20220510122726.v3.3.Iba4b9bf6c7a1ee5ea2835ad7bd5eaf84d7688520@changeid> <20220521091751.opeiqbmc5c2okdq6@houat> In-Reply-To: <20220521091751.opeiqbmc5c2okdq6@houat> From: Doug Anderson Date: Mon, 23 May 2022 10:00:39 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 3/4] drm/bridge: Add devm_drm_bridge_add() To: Maxime Ripard Cc: dri-devel , Hsin-Yi Wang , Abhinav Kumar , Philip Chen , Sankeerth Billakanti , Robert Foss , freedreno , Dmitry Baryshkov , linux-arm-msm , Stephen Boyd , Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Hi, On Sat, May 21, 2022 at 2:17 AM Maxime Ripard wrote: > > Hi, > > On Tue, May 10, 2022 at 12:29:43PM -0700, Douglas Anderson wrote: > > This adds a devm managed version of drm_bridge_add(). Like other > > "devm" function listed in drm_bridge.h, this function takes an > > explicit "dev" to use for the lifetime management. A few notes: > > * In general we have a "struct device" for bridges that makes a good > > candidate for where the lifetime matches exactly what we want. > > * The "bridge->dev->dev" device appears to be the encoder > > device. That's not the right device to use for lifetime management. > > > > Suggested-by: Dmitry Baryshkov > > Signed-off-by: Douglas Anderson > > If we are to introduce more managed helpers, I think it'd be wiser to > introduce them as DRM-managed, and not device managed. > > Otherwise, you'll end up in a weird state when a device has been removed > but the DRM device is still around. I'm kinda confused. In this case there is no DRM device for the bridge and, as per my CL description, "bridge-dev->dev" appears to be the encoder device. I wasn't personally involved in discussions about it, but I was under the impression that this was expected / normal. Thus we can't make this DRM-managed. -Doug From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05458C43217 for ; Mon, 23 May 2022 17:07:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FD4B10E4DA; Mon, 23 May 2022 17:07:57 +0000 (UTC) Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by gabe.freedesktop.org (Postfix) with ESMTPS id 21E2510EBC1 for ; Mon, 23 May 2022 17:07:56 +0000 (UTC) Received: by mail-ed1-x531.google.com with SMTP id er5so19916221edb.12 for ; Mon, 23 May 2022 10:07:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+yqE1pGHx1x3KKc79e6Yq8sNIx1yXpNzstv/8bzqb5s=; b=ZjtsMPgQV6WFMaPsFE5wXrme9HyysqJfDxmCwYeAGbvKIHUWff1Cpyv4vRAIzb2+6g CaBM3u9mN7ChwiUoZn0x2jmbmh8Ids9Twb+q9Mx4bev++DIoBHEX+JPi/peV3/cHXpnt ki/dDbMZHLrt1JuRTfIjOmj46abGOccIRmJ+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+yqE1pGHx1x3KKc79e6Yq8sNIx1yXpNzstv/8bzqb5s=; b=Jy0zjLy8agRgDo8L6zSZcireBjAEgq5udttgqbHHBKTHHT6GnxoB8Cv8SbsdFyB8+q nAg64qn1CaOSGtVW/N371B8NGNwcQpQeFiSgQlURSteIqSIb44M133ncNSg90pU5vdpn xj88mxFoBa40mXrdByGDcCAeHkP3wZkJiBMK9MpK1d1TeDyTda6KbHmBBgy3ZKY7264x glGf0UpCvFfROjiKLJitEAnDP0S5rB8q2AocC0Yybv0HYnWGxdDjO5eHZVzCiVBsBUy1 u1YridFbMS2vndz1TECRjcN/sP3XfWV3VTM99QqtfxnA90UR5AxldpSIoCyzifXeAC3d tk1g== X-Gm-Message-State: AOAM531an2BKTzXXCzM6Bgq7IJnuEcWn72kpP3UUTNo3OU7PeSfT32hZ PhK9Vm5ZYHIQUnR5dp7MrqUuMH8X3fsHnlaKfMQ= X-Google-Smtp-Source: ABdhPJyNGfO9oECYjn2uV00V4bDBvnWWlIf0+HtgTpRsE9AGZs9EjqIB0Yfs3K/zWb/QA0WNfUe5Dg== X-Received: by 2002:aa7:d659:0:b0:42a:b0d5:a64e with SMTP id v25-20020aa7d659000000b0042ab0d5a64emr24991900edr.157.1653325674389; Mon, 23 May 2022 10:07:54 -0700 (PDT) Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com. [209.85.218.45]) by smtp.gmail.com with ESMTPSA id 15-20020a170906004f00b006f3ef214dd9sm5925864ejg.63.2022.05.23.10.07.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 May 2022 10:07:54 -0700 (PDT) Received: by mail-ej1-f45.google.com with SMTP id ck4so25898769ejb.8 for ; Mon, 23 May 2022 10:07:53 -0700 (PDT) X-Received: by 2002:a05:6000:1c03:b0:20e:5cac:1eb5 with SMTP id ba3-20020a0560001c0300b0020e5cac1eb5mr19994642wrb.422.1653325252721; Mon, 23 May 2022 10:00:52 -0700 (PDT) MIME-Version: 1.0 References: <20220510192944.2408515-1-dianders@chromium.org> <20220510122726.v3.3.Iba4b9bf6c7a1ee5ea2835ad7bd5eaf84d7688520@changeid> <20220521091751.opeiqbmc5c2okdq6@houat> In-Reply-To: <20220521091751.opeiqbmc5c2okdq6@houat> From: Doug Anderson Date: Mon, 23 May 2022 10:00:39 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 3/4] drm/bridge: Add devm_drm_bridge_add() To: Maxime Ripard Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sankeerth Billakanti , Philip Chen , Thomas Zimmermann , David Airlie , linux-arm-msm , Abhinav Kumar , Robert Foss , Stephen Boyd , dri-devel , Hsin-Yi Wang , Dmitry Baryshkov , freedreno , LKML Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi, On Sat, May 21, 2022 at 2:17 AM Maxime Ripard wrote: > > Hi, > > On Tue, May 10, 2022 at 12:29:43PM -0700, Douglas Anderson wrote: > > This adds a devm managed version of drm_bridge_add(). Like other > > "devm" function listed in drm_bridge.h, this function takes an > > explicit "dev" to use for the lifetime management. A few notes: > > * In general we have a "struct device" for bridges that makes a good > > candidate for where the lifetime matches exactly what we want. > > * The "bridge->dev->dev" device appears to be the encoder > > device. That's not the right device to use for lifetime management. > > > > Suggested-by: Dmitry Baryshkov > > Signed-off-by: Douglas Anderson > > If we are to introduce more managed helpers, I think it'd be wiser to > introduce them as DRM-managed, and not device managed. > > Otherwise, you'll end up in a weird state when a device has been removed > but the DRM device is still around. I'm kinda confused. In this case there is no DRM device for the bridge and, as per my CL description, "bridge-dev->dev" appears to be the encoder device. I wasn't personally involved in discussions about it, but I was under the impression that this was expected / normal. Thus we can't make this DRM-managed. -Doug