Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp452941rdb; Thu, 30 Nov 2023 08:57:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IF91DOz82R3F+1wUkC4klYuihwPCVkzmRH8fhWsGLYp8XxgDW0aU0iDDoyKa2XMz/VUtD2D X-Received: by 2002:a17:90b:1e4f:b0:285:a65c:64e7 with SMTP id pi15-20020a17090b1e4f00b00285a65c64e7mr16522004pjb.18.1701363457262; Thu, 30 Nov 2023 08:57:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701363457; cv=none; d=google.com; s=arc-20160816; b=UscozZl769QJB9T4CFYDGYT5GHrRaglkTcfpVFIx3LZiuBzKEVBu2G+/OoAo4yunbg zDdAGM5pRtLSW5GA76BfYAL346lqT/aMH86w2wBzcdEl9Xv8GqHdCGDyMBUbGtQWQvSe 2qudNBhnEZYoWq1x42KgE5e3rPrlT++Pz4+tDex8u7zGW4ZxP1oD9W6wqKsK5vLQquJQ b1n99aAb7y+apn9E5szywNQux4xd08a12MfFEvHNlbD8QDQtPrQuaXa0E/TSGwtCLIEC iIjeU2SDIpptxumshGFsu1utA4GI+K22zfUFyqg3WIHxZIx6blyW+YzW6KEdi7oxd80u NmZg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=03BrarHheQTm2ykoOQK9Gavt52h0IRg+LP2b9wAKWEI=; fh=r3rbJaPqE4hQFHY4oUeoPN843sW9np5FjfChyrg+FWc=; b=BUN4IWuk+3as4ORx/pAxYbaEmdFOjiEoSpslMZ3RxfOXw8iQDunpuWhtBLpXlS/3Rk Icy9wAXjb6Ru2Yd8VYEVNf0wz0+Gb9GUMHxg99J/5vo3n/aGp/9ZTopL/gOwce8Jrs60 LrXuwQUWV4r5PVSRcNYwL25KDwyYW0c8Ao/8A8DmpEtNXzYquxQy4RaUjellam7Sxv+T w1KN3g98Jr3ew/pxthyAOnh+y9NUvZEhtgj3nUxp+c/Z3PkZHFUGANAvt/ZH/Bb4watS ptfZboDaMRH9LW6pFiuQvIcDEKalOX5mKUg9GcEktGtac5uybtvKuv/LoAN1au/ssCWq aD2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LkBoNsPO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id cv19-20020a17090afd1300b002859aaee807si1761367pjb.33.2023.11.30.08.57.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 08:57:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LkBoNsPO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A237A84EAC4B; Thu, 30 Nov 2023 08:57:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345993AbjK3Q5I (ORCPT + 99 others); Thu, 30 Nov 2023 11:57:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345884AbjK3Q5G (ORCPT ); Thu, 30 Nov 2023 11:57:06 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3650710F3; Thu, 30 Nov 2023 08:57:12 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPA id 92DB61BF212; Thu, 30 Nov 2023 16:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701363430; 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; bh=03BrarHheQTm2ykoOQK9Gavt52h0IRg+LP2b9wAKWEI=; b=LkBoNsPO/NLskV7htM0BtXTYvsIr1YwKc7YidAZmSHGGnE+7fWKR94HrejLqgdm7qWiSML 16FNvIu8vRzphRZF8c7E99Vk1wl+BHoGwUAU01gRqVbAm8V7G924FRXwRR9+i79oImKiCP Gf7Ff/DRQpOHTLJ2Pm9iE/wy8NPKI772SQTR34CDeBn/fjqlJ4kc48VNNLvPV9S5jTxfP/ 7Szd9nqw7vPINBajJpFXn5hC7XaxmxS5J7wue6serYuyIx73iT2bp90I7OrQ1qvkrhPQQ1 MNO4/PpE+q5Od4T2oXNYOGVZcsUAWPhmYSkBVO4pguxV6LX6Yi+U0gf3CI/nKQ== From: Herve Codina To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Bjorn Helgaas , Lizhi Hou , Rob Herring Cc: Max Zhen , Sonal Santan , Stefano Stabellini , Jonathan Cameron , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina Subject: [PATCH v2 0/2] Attach DT nodes to existing PCI devices Date: Thu, 30 Nov 2023 17:56:57 +0100 Message-ID: <20231130165700.685764-1-herve.codina@bootlin.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 30 Nov 2023 08:57:34 -0800 (PST) Hi, The commit 407d1a51921e ("PCI: Create device tree node for bridge") creates of_node for PCI devices. During the insertion handling of these new DT nodes done by of_platform, new devices (struct device) are created. For each PCI devices a struct device is already present (created and handled by the PCI core). Creating a new device from a DT node leads to some kind of wrong struct device duplication to represent the exact same PCI device. This patch series first introduces device_{add,remove}_of_node() in order to add or remove a newly created of_node to an already existing device. Then it fixes the DT node creation for PCI devices to add or remove the created node to the existing PCI device without any new device creation. Best regards, Hervé Changes v1 -> v2 - Patch 1 Add 'Cc: stable@vger.kernel.org' Herve Codina (2): driver core: Introduce device_{add,remove}_of_node() PCI: of: Attach created of_node to existing device drivers/base/core.c | 74 ++++++++++++++++++++++++++++++++++++++++++ drivers/pci/of.c | 15 +++++++-- include/linux/device.h | 2 ++ 3 files changed, 89 insertions(+), 2 deletions(-) -- 2.42.0