Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2655617iof; Wed, 8 Jun 2022 09:17:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzX3iNWI7e4RLv+1Ife1dNKuT2Bvf1kDw7AW3TRCHC+Qf8m7kpxanjfJhSWv29uIuO+tWVt X-Received: by 2002:a17:902:d48c:b0:167:770b:661 with SMTP id c12-20020a170902d48c00b00167770b0661mr18159941plg.155.1654705061967; Wed, 08 Jun 2022 09:17:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654705061; cv=none; d=google.com; s=arc-20160816; b=xQWxbpX4s3VrsDO3nbSKSaahLcFcnGb+k/OYE5Slbx8w+gS4XU1Gvg9qoXD/nVn39k DFIvEp8yP9r7rhK4ROMPdZvbjQkU6tY2K2Gy9uXSj4GTvS+rbtnnAUvnkPkCX8kP8AMM OFHW6k7AGD7t97U2JmtXFQFS8kDLpLY3GWv/bQYd45Sdu3oskhaAAmFrfHY6v8aINdhQ MztiA8jKEcGlrYBl+u0/VOW15UR1Vk+RypsPGeSzLNCxeBiWNyo6ZQWvNXGE6N9FNuUZ ZyK3EY8Gz4a44wkUyklk1uFIvub1/XcR3+zGkwXmJ7d/wYaWFAZbAO+fQtYY6Q7iSp0u r7Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=CMsRXdWPmCDKvHowScgEPfcStDkBg94b5gd4aiXfFOo=; b=QecPRx//+ZCdLIqaFIT36BJKKyJo1tnoAbCeGG9KOng3svmqMwGioPr+MB8hlKSNB3 833qqGi5dkZH87y2ZaKT06ZLynXxQ0fN7LlRxsdLt6DJ31m7xOBnT1vQo0TMWW+otJXE kCHGxXgS81QvTu7UH2NrKpGPobj47ZSySuUQM9xVHlgZp3MUOUMazDR2BFfW4sO0c8vl hW6e40e1YBWKnuHTnJhvBmpKqEIVlHkabKz2Wau4S3ezXk14JXkBred/ncGsxEaTJELw 6d7nlwB6MUk6LD5rPMq7wMYobs1tOg8cU1xzTUrrSLZyekR0Dg+aALjw7vZimM2IiWEs CZEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=Xqtl8Ykb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id iw13-20020a170903044d00b0016406db85e0si25647141plb.266.2022.06.08.09.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 09:17:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=Xqtl8Ykb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AC3BB121CC8; Wed, 8 Jun 2022 08:50:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244715AbiFHPui (ORCPT + 99 others); Wed, 8 Jun 2022 11:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244624AbiFHPue (ORCPT ); Wed, 8 Jun 2022 11:50:34 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12DA84FC5D for ; Wed, 8 Jun 2022 08:50:19 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id l126-20020a1c2584000000b0039c1a10507fso5465339wml.1 for ; Wed, 08 Jun 2022 08:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=CMsRXdWPmCDKvHowScgEPfcStDkBg94b5gd4aiXfFOo=; b=Xqtl8Ykb4qZhu60PLm3yREsrhfN7nycopV9Cg9DUODp+2a1GNn/lBEVFmoUaJT4ctn Og0NsuClCH8RLjcbeHc3nTohfjXaaOF5zeejqNfesaxvPyIkipv6pYygVud9iJNcmYKh ahaIdZft8ba9IAW5aiqjdFaX5F43Oza1EtamY= 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=CMsRXdWPmCDKvHowScgEPfcStDkBg94b5gd4aiXfFOo=; b=T8XVwTINuDCRgWyZ9T55OTnQmHyFpuJOwumr5pM6QbNpHV9jChbhEfjeHjRpvaz7Zr 8pcsXOgOw+/jGELXzIQejle59ZID8ESPk7kK4cJcufxma9UB45vY0USOsV4xRYCFJMaK pfjmFpRE0SwaWkw63VDTLUeGrNKWekINaZlrgQmLI6WCSBIa85aAzoq/jC3K6PGyGPai lrtmMFth/ogtmopsUAz2/YZzovvI+aJSNQcvGM4oVG+Quv+GH4be0W2nc46hWp5TZGL6 fhl6QSs+2G8EZjZfzbe3bkGlH0Gn0NK2fdppOjR/lYdOTxAaSQ7TuQ/3Sc3pbHV2TAFb Simw== X-Gm-Message-State: AOAM530keaQshkqrliwnQQ95E1Su2whWxuhp0gSplxaxC1/BCHsFrL4d VGxAN4QmlzZntyIvmvMByWySmg== X-Received: by 2002:a05:600c:10cb:b0:39c:4e74:2b41 with SMTP id l11-20020a05600c10cb00b0039c4e742b41mr19026418wmd.130.1654703418228; Wed, 08 Jun 2022 08:50:18 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id h4-20020adffd44000000b002102d4ed579sm21547079wrs.39.2022.06.08.08.50.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 08:50:17 -0700 (PDT) Date: Wed, 8 Jun 2022 17:50:15 +0200 From: Daniel Vetter To: Maxime Ripard Cc: Douglas Anderson , dri-devel@lists.freedesktop.org, Hsin-Yi Wang , Abhinav Kumar , Philip Chen , Sankeerth Billakanti , Robert Foss , freedreno@lists.freedesktop.org, Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, Stephen Boyd , Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 3/4] drm/bridge: Add devm_drm_bridge_add() Message-ID: Mail-Followup-To: Maxime Ripard , Douglas Anderson , dri-devel@lists.freedesktop.org, Hsin-Yi Wang , Abhinav Kumar , Philip Chen , Sankeerth Billakanti , Robert Foss , freedreno@lists.freedesktop.org, Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, Stephen Boyd , David Airlie , Maarten Lankhorst , Thomas Zimmermann , linux-kernel@vger.kernel.org References: <20220510192944.2408515-1-dianders@chromium.org> <20220510122726.v3.3.Iba4b9bf6c7a1ee5ea2835ad7bd5eaf84d7688520@changeid> <20220521091751.opeiqbmc5c2okdq6@houat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220521091751.opeiqbmc5c2okdq6@houat> X-Operating-System: Linux phenom 5.10.0-8-amd64 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Sat, May 21, 2022 at 11:17:51AM +0200, 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. Top-level post since I didn't see any good place to reply in the thread below: - devm is for device stuff, which drm_bridge is (it's not uapi visible in any way or fasion) - drmm is for uapi visible stuff (like drm_encoder) Yes the uapi-visible stuff can outlive the device-related pieces. The way to handle this is: - drm_dev_unplug() when the device disappears underneath you (or just a part, I guess the infra for that doesn't exist yet and maybe we should add it). - drm_dev_enter/exit wrapped around the device related parts. Iow, this patch here I think is the right direction, and gets my Reviewed-by: Daniel Vetter But also, it's definitely not a complete solution as the discussion in the thread here points out. Cheers, Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch