Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1098031pxj; Sat, 15 May 2021 03:55:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaXEBHWclg6LedNE/R8su0WvsWO4OM3h+1DVbK1+ZUQvM/lr61f1KUqQudiE4h90To9qKo X-Received: by 2002:a02:a19c:: with SMTP id n28mr347957jah.117.1621076146985; Sat, 15 May 2021 03:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621076146; cv=none; d=google.com; s=arc-20160816; b=1AoHxnp/CNHT6s+piJrMg+iD0+XuSCV8ezne3mjWhYRc8ttHltcot1PH+0VMQsN2bn 5PAOROWwMc4QPY18oGKIIif9QpbsmI5ALyes5b0VZIEOifbRDbBhT1vmd1zVyLjyZaIx iHxGOCcaTln+/6yMPXXdelDyefdqKhke0Fnz2/F67Y+hBJyepJZC/bXDp49EE0mZ3u0a /OYTO5WSmdFjr5t9RxgJ5M5lWH1NwqU9xQzNc2WL6qzXeglrKYtw0wyCoMRggV/9U9u2 eVSR4kZLfRcFgeDFqGqMqyvUI3VivxtElpn5620yzs0HT+aeEANl/c1RRZ96qBafoU6Q 6xCg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2mg2n4gV17bGOVE68OZPsALQKP2f9toztfRI91bC8mM=; b=UoHfZp/z9Amgflg2VWQzDLeqSpQlj6Ad8YHv7atDx6ndI5IIDJWwFsJSQtU1ePLFQ0 OV4IzzGLVNk/GP4E3HW8Ih7gcdV/hr6uu1Iad3xtCs2Un9epgsb4Phy+Ivisy/UVOraO orHMd4PqweqrQXTXv36hRGDNOPHKZ1YA13RzAPrLNm0v+r1iFRl/jkGtSUIFaiv6inDM UkK1iw4bStP1sztLx9GYhAmE5JPu5dm29zjXjASLuTBK423kRKa+dc4wGWiP5tp6pICR ReDBNNjrBY1v0mTWlq32Sw1YC5D3sPFMq6THUS4XyMDn4CVx/TKzrntwddCbz14TU4RH LPaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SJSmS+US; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n3si3958999jap.45.2021.05.15.03.55.34; Sat, 15 May 2021 03:55:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SJSmS+US; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230024AbhENWOc (ORCPT + 99 others); Fri, 14 May 2021 18:14:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24354 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231616AbhENWOa (ORCPT ); Fri, 14 May 2021 18:14:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621030398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2mg2n4gV17bGOVE68OZPsALQKP2f9toztfRI91bC8mM=; b=SJSmS+USCzJOYlC9+mAE5L8T1qzPlZEan88d/Y5+D+ZWh3KpLMcjCKksR33/T+yOCBvZQa KQfW0dLFIRRuOeTIvVf7pF8oOD+c/ubowsg8GRmf6+21DSxszND2u4T6N7oIgRiy+zLb/6 gJ9Tm5e/O+2w3JuK6Q69SGfNrdGca84= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-16-Ml9oYVQjOmqIWf6tu5Dykg-1; Fri, 14 May 2021 18:13:14 -0400 X-MC-Unique: Ml9oYVQjOmqIWf6tu5Dykg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 53E53FC9C; Fri, 14 May 2021 22:13:13 +0000 (UTC) Received: from Whitewolf.redhat.com (ovpn-118-140.rdu2.redhat.com [10.10.118.140]) by smtp.corp.redhat.com (Postfix) with ESMTP id 652D019D7D; Fri, 14 May 2021 22:13:12 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, Thierry Reding Cc: Jonathan Hunter , linux-tegra@vger.kernel.org, David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2] drm/tegra: Get ref for DP AUX channel, not its ddc adapter Date: Fri, 14 May 2021 18:13:05 -0400 Message-Id: <20210514221305.1783892-1-lyude@redhat.com> In-Reply-To: <20210423182146.185633-2-lyude@redhat.com> References: <20210423182146.185633-2-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While we're taking a reference of the DDC adapter for a DP AUX channel in tegra_sor_probe() because we're going to be using that adapter with the SOR, now that we've moved where AUX registration happens the actual device structure for the DDC adapter isn't initialized yet. Which means that we can't really take a reference from it to try to keep it around anymore. This should be fine though, because we can just take a reference of its parent instead. v2: * Avoid calling i2c_put_adapter() in tegra_output_remove() for eDP/DP cases Signed-off-by: Lyude Paul Fixes: 39c17ae60ea9 ("drm/tegra: Don't register DP AUX channels before connectors") Cc: Lyude Paul Cc: Thierry Reding Cc: Jonathan Hunter Cc: dri-devel@lists.freedesktop.org Cc: linux-tegra@vger.kernel.org --- drivers/gpu/drm/tegra/output.c | 5 ++++- drivers/gpu/drm/tegra/sor.c | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index 47d26b5d9945..2dacce1ab6ee 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -180,10 +180,13 @@ int tegra_output_probe(struct tegra_output *output) void tegra_output_remove(struct tegra_output *output) { + int connector_type = output->connector.connector_type; + if (output->hpd_gpio) free_irq(output->hpd_irq, output); - if (output->ddc) + if (connector_type != DRM_MODE_CONNECTOR_eDP && + connector_type != DRM_MODE_CONNECTOR_DisplayPort && output->ddc) i2c_put_adapter(output->ddc); } diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index 7b88261f57bb..4e0e3a63e586 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -3739,11 +3739,11 @@ static int tegra_sor_probe(struct platform_device *pdev) if (!sor->aux) return -EPROBE_DEFER; - if (get_device(&sor->aux->ddc.dev)) { - if (try_module_get(sor->aux->ddc.owner)) + if (get_device(sor->aux->dev)) { + if (try_module_get(sor->aux->dev->driver->owner)) sor->output.ddc = &sor->aux->ddc; else - put_device(&sor->aux->ddc.dev); + put_device(sor->aux->dev); } } -- 2.31.1