* [PATCH] nvme: Use kobj_to_dev() instead of container_of()
@ 2020-08-26 1:20 Tian Tao
2020-08-26 5:44 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Tian Tao @ 2020-08-26 1:20 UTC (permalink / raw)
To: kbusch, axboe, hch, sagi, linux-nvme; +Cc: linuxarm
Use kobj_to_dev() instead of container_of()
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
drivers/nvme/host/core.c | 4 ++--
drivers/nvme/host/lightnvm.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 154942f..eb50615 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3422,7 +3422,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)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct nvme_ns_ids *ids = &dev_to_ns_head(dev)->ids;
if (a == &dev_attr_uuid.attr) {
@@ -3665,7 +3665,7 @@ static struct attribute *nvme_dev_attrs[] = {
static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
struct attribute *a, int n)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
if (a == &dev_attr_delete_controller.attr && !ctrl->ops->delete_ctrl)
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 8e562d0..70c87ff 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -1241,7 +1241,7 @@ static struct attribute *nvm_dev_attrs[] = {
static umode_t nvm_dev_attrs_visible(struct kobject *kobj,
struct attribute *attr, int index)
{
- struct device *dev = container_of(kobj, struct device, kobj);
+ struct device *dev = kobj_to_dev(kobj);
struct gendisk *disk = dev_to_disk(dev);
struct nvme_ns *ns = disk->private_data;
struct nvm_dev *ndev = ns->ndev;
--
2.7.4
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme: Use kobj_to_dev() instead of container_of()
2020-08-26 1:20 [PATCH] nvme: Use kobj_to_dev() instead of container_of() Tian Tao
@ 2020-08-26 5:44 ` Christoph Hellwig
2020-08-26 6:29 ` 答复: " tiantao (H)
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2020-08-26 5:44 UTC (permalink / raw)
To: Tian Tao; +Cc: sagi, linuxarm, linux-nvme, axboe, kbusch, hch
On Wed, Aug 26, 2020 at 09:20:48AM +0800, Tian Tao wrote:
> Use kobj_to_dev() instead of container_of()
Why?
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
* 答复: [PATCH] nvme: Use kobj_to_dev() instead of container_of()
2020-08-26 5:44 ` Christoph Hellwig
@ 2020-08-26 6:29 ` tiantao (H)
0 siblings, 0 replies; 3+ messages in thread
From: tiantao (H) @ 2020-08-26 6:29 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: kbusch, axboe, sagi, linux-nvme, Linuxarm
Doesn't really matter for an individual driver, but it may get coppied to lots more.
I consider it's a little tidy up.
-----邮件原件-----
发件人: Christoph Hellwig [mailto:hch@lst.de]
发送时间: 2020年8月26日 13:44
收件人: tiantao (H) <tiantao6@hisilicon.com>
抄送: kbusch@kernel.org; axboe@fb.com; hch@lst.de; sagi@grimberg.me; linux-nvme@lists.infradead.org; Linuxarm <linuxarm@huawei.com>
主题: Re: [PATCH] nvme: Use kobj_to_dev() instead of container_of()
On Wed, Aug 26, 2020 at 09:20:48AM +0800, Tian Tao wrote:
> Use kobj_to_dev() instead of container_of()
Why?
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-26 6:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 1:20 [PATCH] nvme: Use kobj_to_dev() instead of container_of() Tian Tao
2020-08-26 5:44 ` Christoph Hellwig
2020-08-26 6:29 ` 答复: " tiantao (H)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.