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 56146C2BD05 for ; Mon, 24 Jun 2024 08:20:30 +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:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Vpj1bjYXlBzUfYOefDTjh4xiC9L+rWuuQmo0xQfNisQ=; b=VuO9E+IANefIsMUKashiGVSclL 2PmuQKBMx92fbJ9Yz+TYby6PGdCRt8puhYeevLyPlgZ3JQF1IDlFC0Fy/OUQbP6AVQNZ4fqgjqX1q I39J/cvnvMQc4h6HYZNz3C3IRNL3VN3DJFZSKVg2w/avBTuTmMREksLtj0rlGzVD/Tkuo0/agV6GS W4IlsQo9FFdo92ByciINbmVFQlbMtIQO63WfTttvJsL0MjSlMH8sf+huA7h35pio/WpREVqtBYowe NaIDkzAO1/UePXIcIbKKQfqsOWKbbMGLc0WdeUvSnCZK7A2hVy+GX8/b/DtwIChGDdvJqgne4U3r9 +Xw/Tlbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLevx-0000000G0Y9-23Mb; Mon, 24 Jun 2024 08:20:17 +0000 Received: from relay6-d.mail.gandi.net ([2001:4b98:dc4:8::226]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLevr-0000000G0X4-2Ztg for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2024 08:20:13 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 5563FC0009; Mon, 24 Jun 2024 08:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1719217207; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vpj1bjYXlBzUfYOefDTjh4xiC9L+rWuuQmo0xQfNisQ=; b=cxujiqvbjQcjSYkwhcOwJAczyZeKLHaVrwYHhoxhQTlS84njHLtQU7WqYt0TVoLRyIsj/L 7b9nOKN5UR7d/5EIQAZ7hEEcyhn0Cq+6hJ3IfkQniOqC7/JJyuIgqQamKLH2mhQ7NOQuh9 Bwd3PaIEVlv/8MPvj+C2QLY6hLlABB1P+K4ceJxNEy59dzQIB8t9FyVXIKmlA3YikrJZmh MtHsGb/kZflAGcFqL0O13KM/Hnm0pJ5l2xFN212IJL1m373ToUZfXE1Xq7oNN1cRC82Djb 9KGd+YUl4ms/PHS4Zds9ogBeUkZsyvcmGDX34hHAE1a5rk4uYg2iAebmKSH0qw== Date: Mon, 24 Jun 2024 10:20:03 +0200 From: Herve Codina To: Andy Shevchenko Cc: Simon Horman , Sai Krishna Gajula , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lee Jones , Arnd Bergmann , Horatiu Vultur , UNGLinuxDriver@microchip.com, Andrew Lunn , Heiner Kallweit , Russell King , Saravana Kannan , Bjorn Helgaas , Philipp Zabel , Lars Povlsen , Steen Hegelund , Daniel Machon , Alexandre Belloni , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Allan Nielsen , Luca Ceresoli , Thomas Petazzoni Subject: Re: [PATCH v2 18/19] mfd: Add support for LAN966x PCI device Message-ID: <20240624102003.3b11a8cc@bootlin.com> In-Reply-To: References: <20240527161450.326615-1-herve.codina@bootlin.com> <20240527161450.326615-19-herve.codina@bootlin.com> <20240620175646.24455efb@bootlin.com> <20240620184309.6d1a29a1@bootlin.com> <20240620191923.3d62c128@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240624_012011_998684_18B749FA X-CRM114-Status: GOOD ( 37.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, 21 Jun 2024 17:45:05 +0200 Andy Shevchenko wrote: > On Thu, Jun 20, 2024 at 7:19 PM Herve Codina wrote: > > On Thu, 20 Jun 2024 18:43:09 +0200 > > Herve Codina wrote: > > > On Thu, 20 Jun 2024 18:07:16 +0200 > > > Andy Shevchenko wrote: > > > > On Thu, Jun 20, 2024 at 5:56 PM Herve Codina wrote: > > > > > On Wed, 5 Jun 2024 23:24:43 +0300 > > > > > Andy Shevchenko wrote: > > > > > > Mon, May 27, 2024 at 06:14:45PM +0200, Herve Codina kirjoitti: > > ... > > > > > > > > + if (!dev->of_node) { > > > > > > > + dev_err(dev, "Missing of_node for device\n"); > > > > > > > + return -EINVAL; > > > > > > > + } > > > > > > > > > > > > Why do you need this? The code you have in _create_intr_ctrl() will take care > > > > > > already for this case. > > > > > > > > > > The code in _create_intr_ctrl checks for fwnode and not an of_node. > > > > > > > > > > The check here is to ensure that an of_node is available as it will be use > > > > > for DT overlay loading. > > > > > > > > So, what exactly do you want to check? fwnode check covers this. > > > > > > > > > I will keep the check here and use dev_of_node() instead of dev->of_node. > > > > > > > > It needs to be well justified as from a coding point of view this is a > > > > duplication. > > > > On DT based system, if a fwnode is set it is an of_node. > > On ACPI, if a fwnode is set is is an acpi_node. > > > > The core PCI, when it successfully creates the DT node for a device > > (CONFIG_PCI_DYNAMIC_OF_NODES) set the of_node of this device. > > So we can have a device with: > > - fwnode from ACPI > > - of_node from core PCI creation > > Does PCI device creation not set fwnode? No and IMHO it is correct. This device has the fwnode that point to an ACPI node: The description used for device creation. The of_node set is created based on PCI known information. This of_node, at PCI level is not used to create the PCI device but is created based on an already existing PCI device. > > > This driver needs the of_node to load the overlay. > > Even if the core PCI cannot create a DT node for the PCI device right > > now, I don't expect this LAN855x PCI driver updated when the core PCI > > is able to create this PCI device DT node. > > If it's really needed, I think the correct call here is is_of_node() > to show exactly why it's not a duplication. It also needs a comment on > top of this call. is_of_node() will not returns the expected result. It will return false as the fwnode->ops of the device is not related to of_node ops but ACPI node ops :( What do you thing it I keep the of_node test using dev_of_node() and add the following comment: --- 8< --- /* * On ACPI system, fwnode can point to the ACPI node. * This driver needs an of_node to be used as the device-tree overlay * target. This of_node should be set by the PCI core if it succeeds in * creating it (CONFIG_PCI_DYNAMIC_OF_NODES feature). * Check here for the validity of the of_node. */ if (!dev_of_node(dev)) { dev_err(dev, "Missing of_node for device\n"); return -EINVAL; } --- 8< --- Let me know if this can be ok. Hervé