Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp920291pxb; Tue, 8 Feb 2022 05:36:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzeOFQ2rPKfaWcVwbjJMPZ/ZQwpfy69xXk+x16JqBqWQmgfGTr2f67hrCgCGEsHJwLDqdyC X-Received: by 2002:a17:902:e806:: with SMTP id u6mr4986976plg.10.1644327378402; Tue, 08 Feb 2022 05:36:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644327378; cv=none; d=google.com; s=arc-20160816; b=EITDkmVSlRgwxQaSEHHLEiPmHNhrPoNVIHa2dbPFsi7z2dj299XNkQwzgzf9Erm0ef k3R36b6q8XQxPfQqnMPrFND8B7EJ5p2xZcFGSu2eggpHsQLIS2x9Ii9ksK7FAmY6gahD 5wvOGjmvBuLmT/Tu5ek3HWVibTQluWNLs9j9hs7LVkdc56eL8XrZ9nlHXDW0DvAAp4ev ZBXyxGfLohnoctsyPGNxNDKJYmLSexXWkhiAa8A1tOcs64E3vfv6ZZUnkYKJfjrSH6kG 3nBEWbBLKZOmZtpgFuNUIzMuEDF+JllPcrOLikvtUGyNbTIoh4MI2hEvPcbr6ElrVKrm Zoeg== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=sFWhdVg1XTN1qNAnOqBdLdYprDqTPs15m2Ur5Pdu3uY=; b=N7mFJH7252hYZlF2MiDSHYzcRWEhHXjrK4L5gFHOq8PpXnsAWqndx9J2QSSjNZgVsJ ZyWnwOu7C4KDcOhyXFW5Hz1/LQn0hw9pH53MTeWi9Yn3XYXzEqWIdnhhAh8eKo2wXMt5 NeruslEmF9glW1YzphEmVRxB//IBWJw1ipAIRtaVmBz9MNdgpn+UM/wxr9qTOhINSycG 2PBLSHGWO0Y+Z2e+OQXLmfZk2QEVLvBw/72aqAMIXOz8xrOJhaZFJsr8z2u+GBn+iOfh 6yA2Yqx6q/6xk6j5+lLO02/ddWNx+x+xJDzKLbrvjuTfP+BG+jBILERr+d9ScUBHKuEj nGYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QjPNGi2j; 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 e7si14635595plh.419.2022.02.08.05.36.02; Tue, 08 Feb 2022 05:36:18 -0800 (PST) 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=QjPNGi2j; 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 S1348495AbiBHHkq (ORCPT + 99 others); Tue, 8 Feb 2022 02:40:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348497AbiBHHkl (ORCPT ); Tue, 8 Feb 2022 02:40:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 559A0C0401EF; Mon, 7 Feb 2022 23:40:40 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id EF70761616; Tue, 8 Feb 2022 07:40:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38174C004E1; Tue, 8 Feb 2022 07:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644306039; bh=hCaoJ9viHY+9jSGZzSXxNK60/DZEM/xN7vZj/9sKfXA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QjPNGi2j2Y6pYYNZq4wFMBTpYumZsgXxoGwPppPNbtjBXUorM+gdM6Djm98W4TjHr uLW9XzYBtWFjHrwFaLIybU8f7Fx+fnzbIjUsSRSvgZN9yuyWKyidGhLdZcaG/FXlIb u9lvxCXvzTTR6lJIoE07Hjd3xDeKhOIi6qa+ROO0= Date: Tue, 8 Feb 2022 08:40:35 +0100 From: Greg Kroah-Hartman To: Bjorn Andersson Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Rob Clark , Dmitry Baryshkov , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sean Paul , Abhinav Kumar , Heikki Krogerus , Stephen Boyd , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-usb@vger.kernel.org Subject: Re: [PATCH 2/2] drm/msm/dp: Implement oob_hotplug_event() Message-ID: References: <20220208044328.588860-1-bjorn.andersson@linaro.org> <20220208044328.588860-2-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220208044328.588860-2-bjorn.andersson@linaro.org> X-Spam-Status: No, score=-7.1 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 On Mon, Feb 07, 2022 at 08:43:28PM -0800, Bjorn Andersson wrote: > The Qualcomm DisplayPort driver contains traces of the necessary > plumbing to hook up USB HPD, in the form of the dp_hpd module and the > dp_usbpd_cb struct. Use this as basis for implementing the > oob_hotplug_event() callback, by amending the dp_hpd module with the > missing logic. > > Overall the solution is similar to what's done downstream, but upstream > all the code to disect the HPD notification lives on the calling side of > drm_connector_oob_hotplug_event(). > > drm_connector_oob_hotplug_event() performs the lookup of the > drm_connector based on fwnode, hence the need to assign the fwnode in > dp_drm_connector_init(). > > Signed-off-by: Bjorn Andersson > --- > drivers/gpu/drm/msm/dp/dp_display.c | 8 ++++++++ > drivers/gpu/drm/msm/dp/dp_display.h | 2 ++ > drivers/gpu/drm/msm/dp/dp_drm.c | 10 ++++++++++ > drivers/gpu/drm/msm/dp/dp_hpd.c | 19 +++++++++++++++++++ > drivers/gpu/drm/msm/dp/dp_hpd.h | 4 ++++ > 5 files changed, 43 insertions(+) > > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c > index 7cc4d21f2091..124a2f794382 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.c > +++ b/drivers/gpu/drm/msm/dp/dp_display.c > @@ -414,6 +414,13 @@ static int dp_display_usbpd_configure_cb(struct device *dev) > return dp_display_process_hpd_high(dp); > } > > +void dp_display_oob_hotplug_event(struct msm_dp *dp_display, bool hpd_state) > +{ > + struct dp_display_private *dp = container_of(dp_display, struct dp_display_private, dp_display); > + > + dp->usbpd->oob_event(dp->usbpd, hpd_state); > +} > + > static int dp_display_usbpd_disconnect_cb(struct device *dev) > { > struct dp_display_private *dp = dev_get_dp_display_private(dev); > @@ -1251,6 +1258,7 @@ static int dp_display_probe(struct platform_device *pdev) > dp->pdev = pdev; > dp->name = "drm_dp"; > dp->dp_display.connector_type = desc->connector_type; > + dp->dp_display.dev = &pdev->dev; You did not properly reference count this pointer you just saved. What is to keep that pointer from going away without you knowing about it? And you already have a pointer to pdev, why save another one here? > > rc = dp_init_sub_modules(dp); > if (rc) { > diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h > index e3adcd578a90..1f856b3bca79 100644 > --- a/drivers/gpu/drm/msm/dp/dp_display.h > +++ b/drivers/gpu/drm/msm/dp/dp_display.h > @@ -11,6 +11,7 @@ > #include "disp/msm_disp_snapshot.h" > > struct msm_dp { > + struct device *dev; > struct drm_device *drm_dev; > struct device *codec_dev; So you now have pointers to 3 different devices here? What does 'dev' point to that the other ones do not? This needs to be documented really well here. thanks, greg k-h