Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2008482/?format=api
{ "id": 2008482, "url": "http://patchwork.ozlabs.org/api/patches/2008482/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20241108143600.756224-2-herve.codina@bootlin.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api", "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-2-herve.codina@bootlin.com>", "list_archive_url": null, "date": "2024-11-08T14:35:54", "name": "[v2,1/6] driver core: Introduce device_{add,remove}_of_node()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "1c240e9883367db4d1759ed4e283a5490bbebf02", "submitter": { "id": 81983, "url": "http://patchwork.ozlabs.org/api/people/81983/?format=api", "name": "Herve Codina", "email": "herve.codina@bootlin.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20241108143600.756224-2-herve.codina@bootlin.com/mbox/", "series": [ { "id": 431925, "url": "http://patchwork.ozlabs.org/api/series/431925/?format=api", "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/2008482/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2008482/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-16329-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=pgS0KQfn;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org;\n envelope-from=linux-pci+bounces-16329-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=\"pgS0KQfn\"", "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 am.mirrors.kernel.org (am.mirrors.kernel.org\n [IPv6:2604:1380:4601:e00::3])\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 4XlM2F6gvVz1xyS\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 9 Nov 2024 01:36:21 +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 am.mirrors.kernel.org (Postfix) with ESMTPS id C22E21F260E6\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 8 Nov 2024 14:36:19 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id CF7291F4FA3;\n\tFri, 8 Nov 2024 14:36:09 +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 303F01F4274;\n\tFri, 8 Nov 2024 14:36:05 +0000 (UTC)", "by mail.gandi.net (Postfix) with ESMTPA id 156272000D;\n\tFri, 8 Nov 2024 14:36:04 +0000 (UTC)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1731076569; cv=none;\n b=JELTTSsTwuWDYKfME4Oot0MXeHZXD4K6XBamvmU/SWpG6mYb62wdsphQ2qv45uy5SawNN7mXlSFHb4d/fVx4+SwmXn2zfahPlHq3TZQhEaZIvarJFs+vsoYYVX91mlh6shusnzjJoF4qZ3SBgFDlW6EQVXlRrhjlDLqmAGxutfU=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1731076569; c=relaxed/simple;\n\tbh=fFlSWRo5CGj/soJ4FeN/4ywI5xwXWTwJU19CnsnNvWU=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=eiBSgkyY/AO1CED7opo0FtGDIy8SyPBpQ6UND9nPDisnGtKPZIvER1MKQJYoUFv2d2kY4iM33cyufbOLaxjA/1+moUTOv88lHFk5ub9KlCk+mC7T72tcvJUG7kspmehw+9ohLrcetpb78IIi90RSHFnis8XXQF0woA0USMM7dEE=", "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=pgS0KQfn; 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=1731076564;\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=UOcOQCBpfyT+DU0uSsNnEAQ1wPpL7/ZNAwbM9KbqeXY=;\n\tb=pgS0KQfnEvMpUgDgcdBiPM9hmo93VLDBQugwgdC70MGNn2uOctv+E3Dvt38rPb3bLImHLJ\n\tmxACsq51Uicj/5zprU0oeM/TQLgYfOV3qmswjcixmzg5mCyLplUIa6KZ/uGHfmTP20p8bl\n\t9pTba6X3gyaxpaXkSpktrCXNVuUgU6Mk1B4qlo+4FV6HVTqpsOlhXtgKyFV1Q+HNdpJG4P\n\tcG0s4OqJO90Jx6ATaKvEOwjhdY9Pv8n2qT3Davk3DvSJXc+9tDAJs9Fz+khXQMMwoHzYZw\n\tuOcTNNoJ8VnAbqX9vbLJ+1IvJiU2YUZtdxKCq+TjnzTyLzYBUxpQxYSbioKSyQ==", "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 1/6] driver core: Introduce device_{add,remove}_of_node()", "Date": "Fri, 8 Nov 2024 15:35:54 +0100", "Message-ID": "<20241108143600.756224-2-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": "An of_node can be set to a device using device_set_node().\nThis function cannot prevent any of_node and/or fwnode overwrites.\n\nWhen adding an of_node on an already present device, the following\noperations need to be done:\n- Attach the of_node if no of_node were already attached\n- Attach the of_node as a fwnode if no fwnode were already attached\n\nThis is the purpose of device_add_of_node().\ndevice_remove_of_node() reverts the operations done by\ndevice_add_of_node().\n\nSigned-off-by: Herve Codina <herve.codina@bootlin.com>\n---\n drivers/base/core.c | 52 ++++++++++++++++++++++++++++++++++++++++++\n include/linux/device.h | 2 ++\n 2 files changed, 54 insertions(+)", "diff": "diff --git a/drivers/base/core.c b/drivers/base/core.c\nindex 24c572031403..0aa63371f55d 100644\n--- a/drivers/base/core.c\n+++ b/drivers/base/core.c\n@@ -5118,6 +5118,58 @@ void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode)\n }\n EXPORT_SYMBOL_GPL(set_secondary_fwnode);\n \n+/**\n+ * device_remove_of_node - Remove an of_node from a device\n+ * @dev: device whose device-tree node is being removed\n+ */\n+void device_remove_of_node(struct device *dev)\n+{\n+\tdev = get_device(dev);\n+\tif (!dev)\n+\t\treturn;\n+\n+\tif (!dev->of_node)\n+\t\tgoto end;\n+\n+\tif (dev->fwnode == of_fwnode_handle(dev->of_node))\n+\t\tdev->fwnode = NULL;\n+\n+\tof_node_put(dev->of_node);\n+\tdev->of_node = NULL;\n+\n+end:\n+\tput_device(dev);\n+}\n+EXPORT_SYMBOL_GPL(device_remove_of_node);\n+\n+/**\n+ * device_add_of_node - Add an of_node to an existing device\n+ * @dev: device whose device-tree node is being added\n+ * @of_node: of_node to add\n+ */\n+void device_add_of_node(struct device *dev, struct device_node *of_node)\n+{\n+\tif (!of_node)\n+\t\treturn;\n+\n+\tdev = get_device(dev);\n+\tif (!dev)\n+\t\treturn;\n+\n+\tif (WARN(dev->of_node, \"%s: Cannot replace node %pOF with %pOF\\n\",\n+\t\t dev_name(dev), dev->of_node, of_node))\n+\t\tgoto end;\n+\n+\tdev->of_node = of_node_get(of_node);\n+\n+\tif (!dev->fwnode)\n+\t\tdev->fwnode = of_fwnode_handle(of_node);\n+\n+end:\n+\tput_device(dev);\n+}\n+EXPORT_SYMBOL_GPL(device_add_of_node);\n+\n /**\n * device_set_of_node_from_dev - reuse device-tree node of another device\n * @dev: device whose device-tree node is being set\ndiff --git a/include/linux/device.h b/include/linux/device.h\nindex b4bde8d22697..e3aa25ce1f90 100644\n--- a/include/linux/device.h\n+++ b/include/linux/device.h\n@@ -1146,6 +1146,8 @@ int device_online(struct device *dev);\n void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);\n void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);\n void device_set_node(struct device *dev, struct fwnode_handle *fwnode);\n+void device_add_of_node(struct device *dev, struct device_node *of_node);\n+void device_remove_of_node(struct device *dev);\n void device_set_of_node_from_dev(struct device *dev, const struct device *dev2);\n \n static inline struct device_node *dev_of_node(struct device *dev)\n", "prefixes": [ "v2", "1/6" ] }