[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1624025070-56253-1-git-send-email-zhouchuangao@vivo.com>
Date: Fri, 18 Jun 2021 07:04:29 -0700
From: zhouchuangao <zhouchuangao@...o.com>
To: Dan Williams <dan.j.williams@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
Ira Weiny <ira.weiny@...el.com>, nvdimm@...ts.linux.dev,
linux-kernel@...r.kernel.org
Cc: zhouchuangao <zhouchuangao@...o.com>
Subject: [PATCH] drivers/nvdimm: Use kobj_to_dev() API
Use kobj_to_dev() API instead of container_of().
Signed-off-by: zhouchuangao <zhouchuangao@...o.com>
---
drivers/nvdimm/namespace_devs.c | 2 +-
drivers/nvdimm/region_devs.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 2403b71..c74dcd2 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -1623,7 +1623,7 @@ static struct attribute *nd_namespace_attributes[] = {
static umode_t namespace_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);
if (a == &dev_attr_resource.attr && is_namespace_blk(dev))
return 0;
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index 9ccf3d6..3db3195 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -766,7 +766,7 @@ REGION_MAPPING(31);
static umode_t mapping_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 nd_region *nd_region = to_nd_region(dev);
if (n < nd_region->ndr_mappings)
--
2.7.4
Powered by blists - more mailing lists