public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] nvme: add comment to not use kobj_to_dev()
@ 2021-06-21  3:09 Chaitanya Kulkarni
  2021-06-21  5:32 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-21  3:09 UTC (permalink / raw)
  To: linux-nvme; +Cc: hch, sagi, kbusch, Chaitanya Kulkarni

Add a comment in nvme_ns_id_attrs_are_visible() and
nvme_dev_attrs_are_visible() not to replace container_of() with
kobj_to_dev(). Since use of kobj_to_dev() makes code harder to read.

Suggested-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/nvme/host/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 14d96ee4d341..559637ebda25 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3191,6 +3191,7 @@ static struct attribute *nvme_ns_id_attrs[] = {
 static umode_t nvme_ns_id_attrs_are_visible(struct kobject *kobj,
 		struct attribute *a, int n)
 {
+	/* Don't use kobj_to_dev(), since it makes code harder to read. */
 	struct device *dev = container_of(kobj, struct device, kobj);
 	struct nvme_ns_ids *ids = &dev_to_ns_head(dev)->ids;
 
@@ -3463,6 +3464,7 @@ static struct attribute *nvme_dev_attrs[] = {
 static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
 		struct attribute *a, int n)
 {
+	/* Don't use kobj_to_dev(), since it makes code harder to read. */
 	struct device *dev = container_of(kobj, struct device, kobj);
 	struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
 
-- 
2.22.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-21 16:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-21  3:09 [PATCH] nvme: add comment to not use kobj_to_dev() Chaitanya Kulkarni
2021-06-21  5:32 ` Christoph Hellwig
2021-06-21 16:17   ` Keith Busch
2021-06-21 16:19     ` Jens Axboe
2021-06-21 16:20     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox