From patchwork Thu Nov 30 16:56:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 17344 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp532024vqy; Thu, 30 Nov 2023 08:57:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaHcHjhuVZMKa+pc/c5yj8VPhMT8Tib/bx+TrxRojDpS12pJ7f4lEB11HlX4UOXJmyrFep X-Received: by 2002:a05:6a21:19d:b0:18c:570d:c5b4 with SMTP id le29-20020a056a21019d00b0018c570dc5b4mr17878034pzb.35.1701363453214; Thu, 30 Nov 2023 08:57:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701363453; cv=none; d=google.com; s=arc-20160816; b=FLqBPp11EOlhRn4W1nNtK0Dk2U8IOSorkzNVTB2FMjCH+S6x/rbTlWnn3LKgm+C3i8 hs7gTYR4isQY7EJFTeS06abmuuTmmcbGyvqSIXy1rpqlhS+qkcfwJ1arhF19wq54aoAG TdkKvuXIOxZcp55wUxAiPcbDTdG5efmMYdK9ylhAhkKkOnskfrm0xwxTks0KFL4h/0N0 iDvI+QVTWuJATjXeUu7CuqFkQ8Ei7wqMM31dNzQVa84ROQSxo4xSq9Wskrfga+zfc7se f5URepXP9aH3bHeD/UiHU1wP0/6HiaF1NrrM/Jj27I0didPkV1LMHlR9TEyTFoCc9wgy fGHQ== 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 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id bi12-20020a056a02024c00b005bcfc4fffe4si1814262pgb.187.2023.11.30.08.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 08:57:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; 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 2620:137:e000::3:4 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 1E1CB84EAC54; Thu, 30 Nov 2023 08:57:30 -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 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:30 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784003056711777494 X-GMAIL-MSGID: 1784008884295929741 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(-)