{"id":2008483,"url":"http://patchwork.ozlabs.org/api/patches/2008483/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20241108143600.756224-4-herve.codina@bootlin.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20241108143600.756224-4-herve.codina@bootlin.com>","list_archive_url":null,"date":"2024-11-08T14:35:56","name":"[v2,3/6] PCI: of_property: Add support for NULL pdev in of_pci_set_address()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"6dc66218dfdfa6093e5b60ba09e82624553912a6","submitter":{"id":81983,"url":"http://patchwork.ozlabs.org/api/people/81983/?format=json","name":"Herve Codina","email":"herve.codina@bootlin.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20241108143600.756224-4-herve.codina@bootlin.com/mbox/","series":[{"id":431925,"url":"http://patchwork.ozlabs.org/api/series/431925/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=431925","date":"2024-11-08T14:35:53","name":"Add support for the PCI host bridge device-tree node creation.","version":2,"mbox":"http://patchwork.ozlabs.org/series/431925/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2008483/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2008483/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-16330-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256\n header.s=gm1 header.b=UdTNNBgb;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org;\n envelope-from=linux-pci+bounces-16330-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com\n header.b=\"UdTNNBgb\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=217.70.183.200","smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=bootlin.com"],"Received":["from sv.mirrors.kernel.org (sv.mirrors.kernel.org\n [IPv6:2604:1380:45e3:2400::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature ECDSA (secp384r1))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4XlM2T17gSz1xyM\n\tfor <incoming@patchwork.ozlabs.org>; Sat,  9 Nov 2024 01:36:33 +1100 (AEDT)","from smtp.subspace.kernel.org (wormhole.subspace.kernel.org\n [52.25.139.140])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby sv.mirrors.kernel.org (Postfix) with ESMTPS id D74512817CB\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  8 Nov 2024 14:36:31 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 208031F5857;\n\tFri,  8 Nov 2024 14:36:11 +0000 (UTC)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n [217.70.183.200])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 89D241EABA2;\n\tFri,  8 Nov 2024 14:36:08 +0000 (UTC)","by mail.gandi.net (Postfix) with ESMTPA id BA51F20002;\n\tFri,  8 Nov 2024 14:36:05 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1731076571; cv=none;\n b=an3xWGH/JbDQjrHu+epiMZ/8k6TTHjPSpdkGrZml3RUcAZH/+ObkUVeBaMHSP18rNskD2Tu7RtQU1JVmAneLvdQd/G6QzK4U4tQi+NTCC6il8w4v8vHnMekJ0Vi5PtaMDbo4B7l8LVPfTSOT33fPRApSc1uT5Th+hkdU7YW48ns=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1731076571; c=relaxed/simple;\n\tbh=KbQcH2DUBO4XBFA/lTskG3ADO76dFxPNoXmfqDECx2E=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=apkgkeU5zjNDtA1RYo279GjXSFfNZLmMpIFtkoOp/1FGGRnHIFDYKuFcnBM0uVaQOwU3RdlzxpNN/N9xRjCG3GpLHO00e9n0Vo7DmpYVljXcFO1od4VLDwubGtFy28hjo5S9z57v+TqFEdorQMTEns/2LzixojoHjcu7DIsmpEA=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com;\n spf=pass smtp.mailfrom=bootlin.com;\n dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com\n header.b=UdTNNBgb; arc=none smtp.client-ip=217.70.183.200","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1;\n\tt=1731076566;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\t to:to:cc:cc:mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=OWUWbgIcwwkYpx2sGFB36arAHxZpqg+uUR07E7hW3jI=;\n\tb=UdTNNBgbzpcSv/Bb4gIeUvZkAIjcOcCmraY864z9PUzZCEy4upyj70UvLnqgj7eUkCaVq5\n\t0o1Uh0zPJo8QpvwUtFFhbKLDhCWtcMStFdPIIunkqOt8rQ5zBAUwA7uG76pNM1/VrrLEIb\n\twzqxLr/fmWkVaOIbcCEdGg3uSTMlmxMW5VNtS73Y/fleR9NAfq6s/CmXti6FNK/6zQhC0+\n\tT8hgrlcluwiA4L9UUiCY9CL2GbehNIod7VWlpxS7f5C16XuQCZ5SM0ELpZ3OeivqX5GwyG\n\tXu1vF6me6lPNLX3tOVu7nx4L3UWYn7Wnu0dvOYHS0XpqK3ur1Xn77NFkDZpJlA==","From":"Herve Codina <herve.codina@bootlin.com>","To":"Greg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\t\"Rafael J. Wysocki\" <rafael@kernel.org>,\n\tRob Herring <robh@kernel.org>,\n\tSaravana Kannan <saravanak@google.com>,\n\tBjorn Helgaas <bhelgaas@google.com>,\n\tLizhi Hou <lizhi.hou@amd.com>","Cc":"linux-kernel@vger.kernel.org,\n\tdevicetree@vger.kernel.org,\n\tlinux-pci@vger.kernel.org,\n\tAllan Nielsen <allan.nielsen@microchip.com>,\n\tHoratiu Vultur <horatiu.vultur@microchip.com>,\n\tSteen Hegelund <steen.hegelund@microchip.com>,\n\tThomas Petazzoni <thomas.petazzoni@bootlin.com>,\n\tHerve Codina <herve.codina@bootlin.com>","Subject":"[PATCH v2 3/6] PCI: of_property: Add support for NULL pdev in\n of_pci_set_address()","Date":"Fri,  8 Nov 2024 15:35:56 +0100","Message-ID":"<20241108143600.756224-4-herve.codina@bootlin.com>","X-Mailer":"git-send-email 2.46.2","In-Reply-To":"<20241108143600.756224-1-herve.codina@bootlin.com>","References":"<20241108143600.756224-1-herve.codina@bootlin.com>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-GND-Sasl":"herve.codina@bootlin.com"},"content":"The pdev (pointer to a struct pci_dev) parameter of of_pci_set_address()\ncannot be NULL.\n\nIn order to reuse of_pci_set_address() when creating the PCI root bus\nnode, this function needs to support a NULL pdev parameter. Indeed, in\nthe case of the PCI root bus node creation, no pdev are available and\nof_pci_set_address() will be used with the bridge windows.\n\nAllow to call of_pci_set_address() with a NULL pdev.\n\nSigned-off-by: Herve Codina <herve.codina@bootlin.com>\n---\n drivers/pci/of_property.c | 10 +++++++---\n 1 file changed, 7 insertions(+), 3 deletions(-)","diff":"diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c\nindex 5a0b98e69795..59cc5c851fc3 100644\n--- a/drivers/pci/of_property.c\n+++ b/drivers/pci/of_property.c\n@@ -54,9 +54,13 @@ enum of_pci_prop_compatible {\n static void of_pci_set_address(struct pci_dev *pdev, u32 *prop, u64 addr,\n \t\t\t       u32 reg_num, u32 flags, bool reloc)\n {\n-\tprop[0] = FIELD_PREP(OF_PCI_ADDR_FIELD_BUS, pdev->bus->number) |\n-\t\tFIELD_PREP(OF_PCI_ADDR_FIELD_DEV, PCI_SLOT(pdev->devfn)) |\n-\t\tFIELD_PREP(OF_PCI_ADDR_FIELD_FUNC, PCI_FUNC(pdev->devfn));\n+\tif (pdev)\n+\t\tprop[0] = FIELD_PREP(OF_PCI_ADDR_FIELD_BUS, pdev->bus->number) |\n+\t\t\t  FIELD_PREP(OF_PCI_ADDR_FIELD_DEV, PCI_SLOT(pdev->devfn)) |\n+\t\t\t  FIELD_PREP(OF_PCI_ADDR_FIELD_FUNC, PCI_FUNC(pdev->devfn));\n+\telse\n+\t\tprop[0] = 0;\n+\n \tprop[0] |= flags | reg_num;\n \tif (!reloc) {\n \t\tprop[0] |= OF_PCI_ADDR_FIELD_NONRELOC;\n","prefixes":["v2","3/6"]}