Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp893244pxt; Thu, 5 Aug 2021 14:32:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBsKV5vn3RyZWxBk+aLf/H5cu14JTzdnShXhXSwVns6QIjC82nOgd3Tp5S9xL3HZZBM57y X-Received: by 2002:a17:906:c7c2:: with SMTP id dc2mr6874005ejb.472.1628199133541; Thu, 05 Aug 2021 14:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628199133; cv=none; d=google.com; s=arc-20160816; b=VuBiid0iSQaUN0A0aX971KzK1NdxLEWuXdRn2GoT5FS1KVeCUfmxnvWG5G/JyGcDkW +VOLFHswzgDq2A43OcTwRTO6wVZwvcIrvfGVeyFsSBn4qNV8qRB7act0LW6ZbSSFXFcN BWZ33sn1VF3FrkuH+024pH5qQQIbt0IOwX/uOD0mAQnUj3V/WSVpX3YUgOEE47DnECnb Okk47t1H1yyyGidKLG7y5XMxxJ40HP0PQvyhU0Chh+jiQtvilGS3regf+QuZxoeNZl1t b74MeT6lEQDA72zxmdba1nqLUnBJIqf5y1W6socP1isXGWijJ3W44HB79xRpwGvR9lLw EAnQ== 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:cc:to:subject:from:date; bh=SUvAaF2GeUtCYjR3UT0zsdmpxMqsHLulJVU0PaY8h9U=; b=L6JGD9gu+G5btVViz8juR90klBBDW0MQz5pzxQ0MwLKIHqlWacVdA41HnaPDQeDtGE y6q9WrrHPpepTxe03hcc0RpvM6d9vwwIxHIUB43xtjZmjau4XKPk6N949P8vh/0q8t9c w9ofPjTJyEva/r+STtilgQO9YczbDN1qX8st8nW9zRKmeCopttXGjQLhgn9D2qbBOjJN bpnKkPlyMIB3VFbTI6XjN/n5cPPxg58W0XNxG6VMC9N0xzQXB3pVzM6+rWfCqTpNwG6d Tf9nZNoZ/Y2qItlBS+TcnfAt0LBfVGKToYqOIF29JI8ZcgEML9AW3nO3SCqZ360pRdxO Fx6Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t2si7156227ejf.408.2021.08.05.14.31.39; Thu, 05 Aug 2021 14:32:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239823AbhHEUFu convert rfc822-to-8bit (ORCPT + 99 others); Thu, 5 Aug 2021 16:05:50 -0400 Received: from aposti.net ([89.234.176.197]:57792 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231184AbhHEUFu (ORCPT ); Thu, 5 Aug 2021 16:05:50 -0400 Date: Thu, 05 Aug 2021 22:05:27 +0200 From: Paul Cercueil Subject: Re: [PATCH 2/2] gpu/drm: ingenic: Add workaround for disabled drivers To: Greg Kroah-Hartman Cc: Rob Herring , "Rafael J . Wysocki" , David Airlie , Daniel Vetter , Sam Ravnborg , list@opendingux.net, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, dri-devel@lists.freedesktop.org Message-Id: <3HUDXQ.7RBGD4FUHR2F@crapouillou.net> In-Reply-To: References: <20210805192110.90302-1-paul@crapouillou.net> <20210805192110.90302-3-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, Le jeu., ao?t 5 2021 at 21:35:34 +0200, Greg Kroah-Hartman a ?crit : > On Thu, Aug 05, 2021 at 09:21:09PM +0200, Paul Cercueil wrote: >> When the drivers of remote devices (e.g. HDMI chip) are disabled in >> the >> config, we want the ingenic-drm driver to be able to probe >> nonetheless >> with the other devices (e.g. internal LCD panel) that are enabled. >> >> Signed-off-by: Paul Cercueil >> --- >> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> index d261f7a03b18..5e1fdbb0ba6b 100644 >> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> @@ -1058,6 +1058,18 @@ static int ingenic_drm_bind(struct device >> *dev, bool has_components) >> for (i = 0; ; i++) { >> ret = drm_of_find_panel_or_bridge(dev->of_node, 0, i, &panel, >> &bridge); >> if (ret) { >> + /* >> + * Workaround for the case where the drivers for the >> + * remote devices are not enabled. When that happens, >> + * drm_of_find_panel_or_bridge() returns -EPROBE_DEFER >> + * endlessly, which prevents the ingenic-drm driver from >> + * working at all. >> + */ >> + if (ret == -EPROBE_DEFER) { >> + ret = driver_deferred_probe_check_state(dev); >> + if (ret == -ENODEV || ret == -ETIMEDOUT) >> + continue; >> + } > > So you are mucking around with devices on other busses within this > driver? What could go wrong? :( I'm doing the same thing as everybody else. This is the DRM driver, and there is a driver for the external HDMI chip which gives us a DRM bridge that we can obtain from the device tree. > Please use the existing driver core functionality for this type of > thing, it is not unique, no need for this function to be called. I'm not sure you understand what I'm doing here. This driver calls drm_of_find_panel_or_bridge(), without guarantee that the driver for the remote device (connected via DT graph) has been enabled in the kernel config. In that case it will always return -EPROBE_DEFER and the ingenic-drm driver will never probe. This patch makes sure that the driver can probe if the HDMI driver has been disabled in the kernel config, nothing more. Cheers, -Paul