From patchwork Thu Nov 30 15:24:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 17339 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp466835vqy; Thu, 30 Nov 2023 07:24:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8LYwTzDxSu+X0DpykpOBWrdmbsI4uk45osCP/kxqDeIf81gv0Ix63Uq5QL0dhVq5Ibj0N X-Received: by 2002:a05:6e02:1b89:b0:35d:42ce:d8f3 with SMTP id h9-20020a056e021b8900b0035d42ced8f3mr1892128ili.0.1701357895209; Thu, 30 Nov 2023 07:24:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701357895; cv=none; d=google.com; s=arc-20160816; b=JcTR2DYkWxtLW/NDTyW2XE3++fxODy7io3ag281Lv7fY8Z7N7p4NMo44Y8+oEV3k4A u6082SnvodWYmrerVT6zTZ9p4DnDKRZxWn63hhF+VFDKN/HTKTfAl4CkwB+Qawv1JFR/ 5ka/bOOzp54KASQ2MPP+N++LHjH1h2YvuKk560Pl22Nv7rigBRn23QUlbYL7WYdw7cK9 KpcYeTeDBVbr77zbe7ussQ+xu/PASL4FQnIhyC+kqF4dNhzzrBPoGMz15iu5FktgC3Vj NraP6p+jzf+yQT7kYwT6jcg5ZjnpqMk0xJyw5sCXyfOMs3K3cvXwQ9kRNEpdJgmK0JZS aicA== 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=v+nQkelvQTnzRkwxNq+pa0F2OV4hlU4a1lu/z9jwG/s=; fh=r3rbJaPqE4hQFHY4oUeoPN843sW9np5FjfChyrg+FWc=; b=VK8IvW7O4MEJTrgWunWI5wYoEIy+7zXi6dE4HbFISbsanATT+HcdjS/BhYurvREZMa pZ/A7QWbDev8LowxJS1kfLGOyORII6tE27bRM/CbpLErsklGF1eo8f4nZktVFpfLqspP y9pPbVTmTC4ScDQw1BbXKGukWxnqG1o6oJnI172BNImgoWRgFu35rAMrXggdMnok0Ruz l0DtaKWXFoHHAoLu7iM+HjwRanUqsrrSI0alqkkmc73nd3S9cVOIxUmYRX067QbhVWqj /ajyI00O90rfFktV35BN1GkU2wDqAPC6tS7pwpw3hemKAd98ounSqzpEug+o/La2BPon 4Rsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=nhujXbLL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id q65-20020a632a44000000b005b9b45ba3c1si1442165pgq.563.2023.11.30.07.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 07:24:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=nhujXbLL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 3AB53809FA69; Thu, 30 Nov 2023 07:24:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346234AbjK3PYU (ORCPT + 99 others); Thu, 30 Nov 2023 10:24:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346197AbjK3PYU (ORCPT ); Thu, 30 Nov 2023 10:24:20 -0500 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A12B091; Thu, 30 Nov 2023 07:24:25 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPA id 33BF9FF819; Thu, 30 Nov 2023 15:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701357864; 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=v+nQkelvQTnzRkwxNq+pa0F2OV4hlU4a1lu/z9jwG/s=; b=nhujXbLLrrHYyrkii78atlpuWy3D4MaZDc/zTxdwqPaaImGYkMaRZDEUdbvKyC9Ft/PyRI 69+8sC8yBbcmWctv64fXgCTj+lpZ66wS5PxH29kNB0GTUEUhulBVpHJhhukIAUKy5imN45 oeGzoFhhHh+BUYjqI5l3SJ7507YIKzJPEnk5G7AzzPSCmPJQW9pTbgHngpQemjAPQ3LUtS YmtIFiASTaRdubN3zTmpGU1O2Fqro8clgq603HnznVE6Viq95j2L/fPvFAe/783nHUQdLG 0RH29lj5GFOfv1lrsmr8ok8Ak0GRVQhStf2j3+kY7Bte1mEDM1MkNot6hhGcSg== 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 0/2] Attach DT nodes to existing PCI devices Date: Thu, 30 Nov 2023 16:24:02 +0100 Message-ID: <20231130152418.680966-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 fry.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 (fry.vger.email [0.0.0.0]); Thu, 30 Nov 2023 07:24:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784003056711777494 X-GMAIL-MSGID: 1784003056711777494 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é 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(-)