public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <kch@nvidia.com>
To: <linux-nvme@lists.infradead.org>
Cc: <kbusch@kernel.org>, <hch@lst.de>, <sagi@grimberg.me>,
	Chaitanya Kulkarni <kch@nvidia.com>
Subject: [PATCH] nvmet: nvmet.h configfs helper cleanup
Date: Sun, 11 Feb 2024 15:39:49 -0800	[thread overview]
Message-ID: <20240211233949.18219-1-kch@nvidia.com> (raw)

Functions to_nvmet_ns(), to_ana_group(), to_subsys(), to_host() and
namespaces_to_subsys() are only used in target/configfs.c, move it 
to the appropriate file instead of bloating common header.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/nvme/target/configfs.c | 28 ++++++++++++++++++++++++++++
 drivers/nvme/target/nvmet.h    | 28 ----------------------------
 2 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index 2482a0db2504..a4307cbf9cf7 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -49,6 +49,34 @@ static const struct nvmet_type_name_map nvmet_addr_family[] = {
 	{ NVMF_ADDR_FAMILY_LOOP,	"loop" },
 };
 
+static inline struct nvmet_ns *to_nvmet_ns(struct config_item *item)
+{
+	return container_of(to_config_group(item), struct nvmet_ns, group);
+}
+
+static inline struct nvmet_ana_group *to_ana_group(struct config_item *item)
+{
+	return container_of(to_config_group(item), struct nvmet_ana_group,
+			group);
+}
+
+static inline struct nvmet_subsys *to_subsys(struct config_item *item)
+{
+	return container_of(to_config_group(item), struct nvmet_subsys, group);
+}
+
+static inline struct nvmet_subsys *namespaces_to_subsys(
+		struct config_item *item)
+{
+	return container_of(to_config_group(item), struct nvmet_subsys,
+			namespaces_group);
+}
+
+static inline struct nvmet_host *to_host(struct config_item *item)
+{
+	return container_of(to_config_group(item), struct nvmet_host, group);
+}
+
 static bool nvmet_is_port_enabled(struct nvmet_port *p, const char *caller)
 {
 	if (p->enabled)
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 6c8acebe1a1a..ad8d1f096349 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -87,11 +87,6 @@ struct nvmet_ns {
 	u8			csi;
 };
 
-static inline struct nvmet_ns *to_nvmet_ns(struct config_item *item)
-{
-	return container_of(to_config_group(item), struct nvmet_ns, group);
-}
-
 static inline struct device *nvmet_ns_dev(struct nvmet_ns *ns)
 {
 	return ns->bdev ? disk_to_dev(ns->bdev->bd_disk) : NULL;
@@ -132,12 +127,6 @@ struct nvmet_ana_group {
 	u32			grpid;
 };
 
-static inline struct nvmet_ana_group *to_ana_group(struct config_item *item)
-{
-	return container_of(to_config_group(item), struct nvmet_ana_group,
-			group);
-}
-
 /**
  * struct nvmet_port -	Common structure to keep port
  *				information for the target.
@@ -293,18 +282,6 @@ struct nvmet_subsys {
 #endif /* CONFIG_BLK_DEV_ZONED */
 };
 
-static inline struct nvmet_subsys *to_subsys(struct config_item *item)
-{
-	return container_of(to_config_group(item), struct nvmet_subsys, group);
-}
-
-static inline struct nvmet_subsys *namespaces_to_subsys(
-		struct config_item *item)
-{
-	return container_of(to_config_group(item), struct nvmet_subsys,
-			namespaces_group);
-}
-
 struct nvmet_host {
 	struct config_group	group;
 	u8			*dhchap_secret;
@@ -315,11 +292,6 @@ struct nvmet_host {
 	u8			dhchap_dhgroup_id;
 };
 
-static inline struct nvmet_host *to_host(struct config_item *item)
-{
-	return container_of(to_config_group(item), struct nvmet_host, group);
-}
-
 static inline char *nvmet_host_name(struct nvmet_host *host)
 {
 	return config_item_name(&host->group.cg_item);
-- 
2.40.0



             reply	other threads:[~2024-02-12  1:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-11 23:39 Chaitanya Kulkarni [this message]
2024-02-12  6:59 ` [PATCH] nvmet: nvmet.h configfs helper cleanup Christoph Hellwig
2024-02-13  7:43   ` Chaitanya Kulkarni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240211233949.18219-1-kch@nvidia.com \
    --to=kch@nvidia.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox