Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp395300lqg; Fri, 1 Mar 2024 08:19:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX8R0PisE9MnduHhoYGjinYqr2MfO4T+9acZNQEJfTYapdPrG/O/nL3NgJBZjgAKaJHC9ps/JojRw2vq7nQmholA1rRmvarsAUnQU866A== X-Google-Smtp-Source: AGHT+IEyLDCdgPKOHVBOdVtWPdBVxY9e1Xk1T1iRYlG2sP0XeaJc54zwAeNUKYcL6yTMMPmXQ6vb X-Received: by 2002:ac8:57d5:0:b0:42e:c4d1:9421 with SMTP id w21-20020ac857d5000000b0042ec4d19421mr2275501qta.59.1709309988172; Fri, 01 Mar 2024 08:19:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709309988; cv=pass; d=google.com; s=arc-20160816; b=hqOiLpvoj6h3+KUiIr8OA/Pc/Hm3hFUCyOs/tVi7R5TjSSZpDmwGUa80CNTrFPkiZU Y4dudCOqgQGGO/dtbCz4y6SMPg7MjjS2OOMonoBG4S7+oxB+LidCWwO2Zi+B9wbIf2AR qiXhfoGHwbIzw/ncP3SWMK7UePBA3cjaGEGblVzL4wHZnQKusAlznJC29gX75HUhmEVl 99TmaSlTRsLtOq2CrNJEAmQXsHGH+aLL7YwQahiV8p9hcF4S2vA/Eo2Lf170o27xwXmJ zoV2L7NlAUBphHyiCEH4Fy1fNuNxY+RftiuOcxKMum9LvLZp3HXqXTqfC5xr3uaaekR/ ks2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HTmgcvTU13sGV1oucx/LfY4oL5Hnphl3n3ArITm2GR0=; fh=3zAcUW1Kv4ksywDSBsrmV6jbRHqkonHAcfqsoEcgnI8=; b=nE3qjm68UwQgK2Dkn2bqnoUT1qxruFhrX3Gcn9780TYGJEQq86A23lcgtOhbYHTT8S b/RgEctBlKaZZzQvN54aHNTdu/++FdoXAV/QyDI6UKrAiiLh1cn10ZK2NRSy6aLAzpS2 U6NpvOVU4iK3Q6CIW3+dKe/HzihkQOT9/u2M/2ynfzFSQnKf4pRlYuaYr7ju3dsr4wNn vJsrmkZOixRA7rzFpB2RrBUpOLbgcZ5QschoYKgAT8wVTHy9gtqZNlKqjsAfzaX5tda4 l6IdjhtWu7KQtTYxr0qb+oFhPxyV7gI0h3MPeiEiO3QX+ymS3uiHA/bnotLK8Skk3Iba 6G9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="pCICPBF/"; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-88678-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88678-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j6-20020ac85c46000000b0042e8e35b093si4093780qtj.17.2024.03.01.08.19.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 08:19:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88678-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="pCICPBF/"; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-88678-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88678-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AD9431C22C9C for ; Fri, 1 Mar 2024 16:19:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1194770CB8; Fri, 1 Mar 2024 16:19:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="pCICPBF/" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 885136F523 for ; Fri, 1 Mar 2024 16:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709309981; cv=none; b=B0LkDI2jtqnzWOa8oZJRoG78CC7AV5xmJYTA7fK/tBbxsV0jpprZWgGSnmzMBDsZCc9NY1p+N+bh/TDUkydZSSRXZA64vSzDVQyZpmJnwm7WD3yxpKsqgVwASRzBaS3UZ/rUR+6PkzTEvA86NHNLXuNe11GQDGnAR+G4aca18wk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709309981; c=relaxed/simple; bh=kqHrLNm7gDmwTCEs36YV2jdsUTVUUwpuDbx4vMGSjBY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UsuApNnGPmyXQVZabGyisSq/z21MtO7HYsP7pk6iXaOSt+yAwTBtIgSV3oEgZbB6TOYi1uYJm0AvCTp8LVZkUkogcg5Vo7UICnjb6vbgbLTujwicI5ENkO55Grx1utg01B9xeDTgAJX9hnAjpS7Naq/L5tqkl+77Mf2bM5DlI8w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=pCICPBF/; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1709309975; bh=kqHrLNm7gDmwTCEs36YV2jdsUTVUUwpuDbx4vMGSjBY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pCICPBF/U+f0qA9JBho7Cn4BcnOMh7J9a6GJRnJM70+TKdPZJvA+UQgKeB/ZN7x5r iuKY1AdEjmvtKAMlNcFQ7QOMltgsxDhIh+uNNp0MsMSCe5mNno0MKtJhrFzwP4VJvg mqDaI9sG7ThZOwLhWmRg6kzQC8I+7bm3rZ/Ww9kvEAwB5oRscDHmaj7RccIYmIZam1 gOfryn3fu76cTmnnZxaDzvexSd7t5P7agslSTbFJ7GaUErw0Hjlamht4WGtUqEy93e Dfl7EoZvCoYTwUrDnc9c7XENiKzBQi1fvTeqFGY+aEifREVWG9GO2pIVxmdE5RfKzF 7RKGyUXyfoKiA== Received: from notapiano (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 9CC7F37813F2; Fri, 1 Mar 2024 16:19:29 +0000 (UTC) Date: Fri, 1 Mar 2024 11:19:27 -0500 From: =?utf-8?B?TsOtY29sYXMgRi4gUi4gQS4=?= Prado To: Laurent Pinchart Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , owen , Jagan Teki , Marek Vasut , Adrien Grassein , Srinivas Kandagatla , Sam Ravnborg , Bjorn Andersson , Vinod Koul , Dmitry Baryshkov , Vinay Simha BN , Christopher Vollo , Jessica Zhang , Marijn Suijten , AngeloGioacchino Del Regno , kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, AngeloGioacchino Del Regno Subject: Re: [PATCH v2 0/9] drm: Switch from dev_err to dev_err_probe for missing DSI host error path Message-ID: <33209063-de58-4d53-a6e0-2d9f74052358@notapiano> References: <20240229-anx7625-defer-log-no-dsi-host-v2-0-00506941049a@collabora.com> <20240301063431.GM30889@pendragon.ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240301063431.GM30889@pendragon.ideasonboard.com> On Fri, Mar 01, 2024 at 08:34:31AM +0200, Laurent Pinchart wrote: > Hi N?colas, > > On Thu, Feb 29, 2024 at 07:12:06PM -0500, N?colas F. R. A. Prado wrote: > > This series changes every occurence of the following pattern: > > > > dsi_host = of_find_mipi_dsi_host_by_node(dsi); > > if (!dsi_host) { > > dev_err(dev, "failed to find dsi host\n"); > > return -EPROBE_DEFER; > > } > > > > into > > > > dsi_host = of_find_mipi_dsi_host_by_node(dsi); > > if (!dsi_host) > > return dev_err_probe(dev, -EPROBE_DEFER, "failed to find dsi host\n"); > > > > This registers the defer probe reason (so it can later be printed by the > > driver core or checked on demand through the devices_deferred file in > > debugfs) and prevents errors to be spammed in the kernel log every time > > the driver retries to probe, unnecessarily alerting userspace about > > something that is a normal part of the boot process. > > The idea is good, but I have a small issue with patches 1/9 to 7/9. They > all patch a function that is called by the probe function. Calling > dev_err_probe() in such functions is error-prone. I had to manually > check when reviewing the patches that those functions were indeed called > at probe time, and not through other code paths, and I also had to check > that no callers were using dev_err_probe() in the error handling path, > as that would have overridden the error message. > > Would there be a way to move the dev_err_probe() to the top-level ? I > understand it's not always possible or convenient, but if it was doable > in at least some of the drivers, I think it would be better. I'll let > you be the judge. Hey Laurent, thanks for the review. I get where you're coming from, as I checked those things myself while writing the patch. That said, I don't think moving dev_err_probe() to the top-level is a good move for a few reasons: * Keeping the log message as close to the source of the error makes it more specific, and consequently, more useful. * The original code already returned -EPROBE_DEFER, implying the function is expected to be called only from the probe function. With those points in mind, the only way I see to guarantee dev_err_probe(...,-EPROBE_DEFER...) would only be called by probe, and that the reason wouldn't be overriden, would be to move the entire code path of that function that calls into dev_err_probe() up into the probe function. But if we adopt this pattern consistently across the drivers in the tree, I think it would drastically worsen readability and cancel out the benefits. IMO the way forward with the API we have, is to make use of warnings and static checkers to catch cases where dev_err_probe() is overriding a defer probe reason, and where it's called outside of the probe function scope. So I'm inclined to leave the patches as they are, but am happy to discuss this further or other ideas. Thanks, N?colas