@@ -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;
@@ -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)
Use kobj_to_dev() API instead of container_of(). Signed-off-by: zhouchuangao <zhouchuangao@vivo.com> --- drivers/nvdimm/namespace_devs.c | 2 +- drivers/nvdimm/region_devs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)