[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240806114118.17198-3-ansuelsmth@gmail.com>
Date: Tue, 6 Aug 2024 13:41:12 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Ulf Hansson <ulf.hansson@...aro.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Joern Engel <joern@...ybastard.org>,
Keith Busch <kbusch@...nel.org>,
Jens Axboe <axboe@...nel.dk>,
Christoph Hellwig <hch@....de>,
Sagi Grimberg <sagi@...mberg.me>,
Christian Marangi <ansuelsmth@...il.com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Florian Fainelli <f.fainelli@...il.com>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
linux-mmc@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-mtd@...ts.infradead.org,
linux-nvme@...ts.infradead.org
Subject: [PATCH v3 2/6] nvme: assign of_node to nvme device
Introduce support for a dedicated node for a nvme card. This will be a
subnode of the nvme controller node that will have the "nvme-card"
compatible.
This follow a similar implementation done for mmc where the specific mmc
card have a dedicated of_node.
This can be used for scenario where block2mtd module is used to declare
partition in DT and block2mtd is called on the root block of the nvme
card, permitting the usage of fixed-partition parser or alternative
ones.
Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
---
drivers/nvme/host/core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 053d5b4909cd..344523274d1b 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/backing-dev.h>
+#include <linux/of.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/pr.h>
@@ -4651,6 +4652,7 @@ void nvme_uninit_ctrl(struct nvme_ctrl *ctrl)
nvme_hwmon_exit(ctrl);
nvme_fault_inject_fini(&ctrl->fault_inject);
dev_pm_qos_hide_latency_tolerance(ctrl->device);
+ of_node_put(ctrl->device->of_node);
cdev_device_del(&ctrl->cdev, ctrl->device);
nvme_put_ctrl(ctrl);
}
@@ -4771,6 +4773,8 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
else
ctrl->device->groups = nvme_dev_attr_groups;
ctrl->device->release = nvme_free_ctrl;
+ ctrl->device->of_node = of_get_compatible_child(ctrl->dev->of_node,
+ "nvme-card");
dev_set_drvdata(ctrl->device, ctrl);
return ret;
--
2.45.2
Powered by blists - more mailing lists