From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F310C71136 for ; Mon, 16 Jun 2025 12:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fAvKVOo7ypmMCmp72ZiS14NVbWunU3ZEB5o/phDv6hI=; b=egUTZ5Kp+RbgkS/M8sDzLy/z9I LAl7mafLELCLMuH341eMdHkWAU1mSPGK9c+EdJ1ZrW0MN0LaCAqINUXeZagIIzVMVtfeUzOv4old5 EcR4zLUJ4+Lg22Qe66Oc90rFtEn994GB36BZx29pbeIVqyNoonfjluZXG+zE4YFvqkyfvLtyAAUei WCB946RkLaDYH9SDbVm6zqKP0+R2rKHHmH8sdBw5/taFMrQ1ZqvLjet9oeCdlI9Dr34ZF8Xdr/3Uy uaqrnL5qGO+16t3Xz9fJceh05EsIlY6QuAyeqpSh/hYfC+gqvqwrOTJxyDkivZHtMXKSV8Df+qezF 80uvKtjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uR8uD-00000004MZw-2yRI; Mon, 16 Jun 2025 12:25:41 +0000 Received: from mgamail.intel.com ([192.198.163.12]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uR81B-00000004CYo-2jeK for linux-arm-kernel@lists.infradead.org; Mon, 16 Jun 2025 11:28:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750073329; x=1781609329; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=tKv3IVxR4x+Lo88hvTXaRanXQjO9bR1OAuTbuJp33RA=; b=UfO4ujt7eKE0Fsh5S2JDfkq8qYRgdPt3WBWTb2KIi4SxoRnVkUUava1M bwiV0Kk8ZdzotUuh5rBXidWkwUaRRd9VNhxUFUd+L5mw2fy6rRl+Lpnw3 Optp5TzUJqKZE3X4PERqoeituhxNHTKE1E1gcxPjh1Oe8IWpwVHfAIzk5 FelySVJhVBMMa/TAO90ocSIJXMDCj+39Pl9YaETh8Zf4WBMoKAjLCdI6A G9uQR8YeD03oXcgQgK1kLKRgFT02t1Uxa15jCaLOvNrUxOe0x29KZwXdE S/r2wB3/IKy8pgVoWdEsAuT6mTXcDAnvV+/n5UfHBv7WR3DbpEp5ep8Rm w==; X-CSE-ConnectionGUID: jcaIm+6XQCWgYPCoR3+U9g== X-CSE-MsgGUID: u1p4N540T8Wr7ee4QtC1UQ== X-IronPort-AV: E=McAfee;i="6800,10657,11465"; a="56013995" X-IronPort-AV: E=Sophos;i="6.16,241,1744095600"; d="scan'208";a="56013995" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2025 04:28:49 -0700 X-CSE-ConnectionGUID: CavMHqxJRc6wvzpGQZrJ0Q== X-CSE-MsgGUID: 9jp8Syx1RJy/G1rE/YliHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,241,1744095600"; d="scan'208";a="179344519" Received: from smile.fi.intel.com ([10.237.72.52]) by orviesa002.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2025 04:28:38 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.98.2) (envelope-from ) id 1uR80v-000000073fj-0ZrN; Mon, 16 Jun 2025 14:28:33 +0300 Date: Mon, 16 Jun 2025 14:28:32 +0300 From: Andy Shevchenko To: Herve Codina Cc: Andrew Lunn , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michael Turquette , Stephen Boyd , Andi Shyti , Wolfram Sang , Peter Rosin , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Rob Herring , Saravana Kannan , Bjorn Helgaas , Mark Brown , Len Brown , Daniel Scally , Heikki Krogerus , Sakari Ailus , Wolfram Sang , Geert Uytterhoeven , Davidlohr Bueso , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, linux-spi@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni Subject: Re: [PATCH v3 05/28] bus: simple-pm-bus: Populate child nodes at probe Message-ID: References: <20250613134817.681832-1-herve.codina@bootlin.com> <20250613134817.681832-6-herve.codina@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250613134817.681832-6-herve.codina@bootlin.com> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250616_042849_705176_840ED050 X-CRM114-Status: GOOD ( 21.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jun 13, 2025 at 03:47:45PM +0200, Herve Codina wrote: > The simple-pm-bus driver handles several simple busses. When it is used > with busses other than a compatible "simple-pm-bus", it doesn't populate > its child devices during its probe. > > This confuses fw_devlink and results in wrong or missing devlinks. > > Once a driver is bound to a device and the probe() has been called, > device_links_driver_bound() is called. > > This function performs operation based on the following assumption: > If a child firmware node of the bound device is not added as a > device, it will never be added. > > Among operations done on fw_devlinks of those "never be added" devices, > device_links_driver_bound() changes their supplier. > > With devices attached to a simple-bus compatible device, this change > leads to wrong devlinks where supplier of devices points to the device > parent (i.e. simple-bus compatible device) instead of the device itself > (i.e. simple-bus child). > > When the device attached to the simple-bus is removed, because devlinks > are not correct, its consumers are not removed first. > > In order to have correct devlinks created, make the simple-pm-bus driver > compliant with the devlink assumption and create its child devices > during its probe. ... > if (match && match->data) { > if (of_property_match_string(np, "compatible", match->compatible) == 0) > - return 0; > + goto populate; > else > return -ENODEV; > } A nit: seems that now we don't need to keep a symmetry in the branches and hence the redundant 'else' can be dropped if (of_property_match_string(np, "compatible", match->compatible) != 0) return -ENODEV; goto populate; } But this might be out of the scope here and can be done later on. In my opinion it will make code slightly easier to follow. -- With Best Regards, Andy Shevchenko