Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp780352rwl; Wed, 5 Apr 2023 07:38:43 -0700 (PDT) X-Google-Smtp-Source: AKy350aoivKbrqAyTak+vcvwn5HVQo/Cd2K8iaZmQEHhvmfbc+Py6PZ8xEiS5KxsGH0Y49aM7/DE X-Received: by 2002:a17:906:d152:b0:930:27c2:6d8d with SMTP id br18-20020a170906d15200b0093027c26d8dmr3679969ejb.61.1680705523563; Wed, 05 Apr 2023 07:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680705523; cv=none; d=google.com; s=arc-20160816; b=R3DT0virwtGHJ7kIk3IRG61bUlGulAHK1chUGljosOJX+nbGaSmbvRKAzSw9cZUTT1 JCfVMM8h1BX7a4NznyjyqNv0rjxbLEQKXE9DHYsj78OvLLjvaOh+ovyNQiPWLJ5FSOJ5 miBSXh0xXQcRh7msh9854PqlfHdp7n6TjbMdIRmohc7Hyf3mNNPllHefwxQe4aUnumC1 PDUSE7hBkW4Xs2cC/18iDMWVCFKhq862Nrg41p+RLCjna/BSRSZ1vHra0wBheUtNCstS 1Mkmla7ILGK3nmEKDd9fVpTex8HIQeQeb6hoQlhDLftGiqBr0Ud/jffYzrHX76LnI1WK D7Yw== 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=3EVpp0NmAOmUek1AG4MCfBzFSM6+mNu01GoxkYlGvfA=; b=sU//nuSJyTjcCPevEoDDB4FxNQhHHmynywU75Wx7l5GUDQMErTzq3rzpAIKpmns5Fx DiDrNtTpZUuUUsdncpifchP3EM6BSqEN9i/BtGYEKpkt6NG+ClB39KG0S+QMnjUl32Cx DnICygRF7EhaToHLg6LoZvXm1azfF+TSnTOdiyN19cPTzM49CiIJPCBPYg5lw2aDiCCS GFcOH0h35mV4l2afm9q5InLj9TGtBDs4Ue1d4B/rCKwfJqwb54LbjVQI3/jtxCboDuHV l0K20mtuovzabrbVbESQmKG13WfEnUgR1gcZdqHCsV3pk+O5jT1AZXWq4gcRKwmqtxXF itiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ImRaG3GV; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24-20020a170906185800b00931536d485asi4200218eje.507.2023.04.05.07.38.14; Wed, 05 Apr 2023 07:38:43 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=ImRaG3GV; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237184AbjDEO2x (ORCPT + 99 others); Wed, 5 Apr 2023 10:28:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237766AbjDEO2v (ORCPT ); Wed, 5 Apr 2023 10:28:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1924B65B0; Wed, 5 Apr 2023 07:28:21 -0700 (PDT) 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 4642A63E44; Wed, 5 Apr 2023 14:27:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEF11C433D2; Wed, 5 Apr 2023 14:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680704868; bh=Pzi6zJxJr8ZUgmTZZZ6XD+HYvxPprYklmZaH/0dEtMk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ImRaG3GVvpmqJNe1S1e8k+pepVfUqu3UM9plmOCyikVY8gYB6aJzgjb8sMQg3A2r/ KMGDHqlNG+R53It2QnpunzBxNsOlSY/fdAq/bI+9XomAP2dHQNJFEDd6pwf1/lmg7/ 1oMVTm0Pm+FKilQuUhP7LZQOK+SJOZyfSG4aNFlwJSfYYcZUF50/kFu4e1YoUMr8Jp s3fGRSMkHOmOc6X+IRGhODnKcRLyUN/TZS/SGidTHDH0N3Jqh7CQF2rB6obnqte0Mp nF1ZUTO5v9xP01Un2nOGctkdwjH+SzH2fONJeCWj+3pyxFHGCI5P9B8dNbhjdK/2UD BXWwm5RfeCfrw== Date: Wed, 5 Apr 2023 22:27:37 +0800 From: Shawn Guo To: Geert Uytterhoeven Cc: Greg Kroah-Hartman , Saravana Kannan , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Wolfram Sang , Rob Herring , Frank Rowand , Mark Brown , Ivan Bornyakov , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] treewide: Fix probing of devices in DT overlays Message-ID: <20230405142737.GH11367@dragon> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 Thu, Mar 30, 2023 at 03:26:13PM +0200, Geert Uytterhoeven wrote: > When loading a DT overlay that creates a device, the device is not > probed, unless the DT overlay is unloaded and reloaded again. > > After the recent refactoring to improve fw_devlink, it no longer depends > on the "compatible" property to identify which device tree nodes will > become struct devices. fw_devlink now picks up dangling consumers > (consumers pointing to descendent device tree nodes of a device that > aren't converted to child devices) when a device is successfully bound > to a driver. See __fw_devlink_pickup_dangling_consumers(). > > However, during DT overlay, a device's device tree node can have > sub-nodes added/removed without unbinding/rebinding the driver. This > difference in behavior between the normal device instantiation and > probing flow vs. the DT overlay flow has a bunch of implications that > are pointed out elsewhere[1]. One of them is that the fw_devlink logic > to pick up dangling consumers is never exercised. > > This patch solves the fw_devlink issue by marking all DT nodes added by > DT overlays with FWNODE_FLAG_NOT_DEVICE (fwnode that won't become > device), and by clearing the flag when a struct device is actually > created for the DT node. This way, fw_devlink knows not to have > consumers waiting on these newly added DT nodes, and to propagate the > dependency to an ancestor DT node that has the corresponding struct > device. > > Based on a patch by Saravana Kannan, which covered only platform and spi > devices. > > [1] https://lore.kernel.org/r/CAGETcx_bkuFaLCiPrAWCPQz+w79ccDp6=9e881qmK=vx3hBMyg@mail.gmail.com > > Fixes: 4a032827daa89350 ("of: property: Simplify of_link_to_phandle()") > Link: https://lore.kernel.org/r/CAGETcx_+rhHvaC_HJXGrr5_WAd2+k5f=rWYnkCZ6z5bGX-wj4w@mail.gmail.com > Signed-off-by: Geert Uytterhoeven > Acked-by: Mark Brown > Acked-by: Wolfram Sang # for I2C > --- > v3: > - Add Acked-by, > - s/instantiate/probe/, > - Improve commit description, > - Add comment before clearing FWNODE_FLAG_NOT_DEVICE, > > v2: > - Add Acked-by, > - Drop RFC. > --- > drivers/bus/imx-weim.c | 6 ++++++ Acked-by: Shawn Guo > drivers/i2c/i2c-core-of.c | 5 +++++ > drivers/of/dynamic.c | 1 + > drivers/of/platform.c | 5 +++++ > drivers/spi/spi.c | 5 +++++ > 5 files changed, 22 insertions(+)