diff mbox series

libnvdimm: Switch to using the new API kobj_to_dev()

Message ID 1608514782-19193-1-git-send-email-tiantao6@hisilicon.com (mailing list archive)
State New, archived
Headers show
Series libnvdimm: Switch to using the new API kobj_to_dev() | expand

Commit Message

Tian Tao Dec. 21, 2020, 1:39 a.m. UTC
fixed the following coccicheck:
drivers/nvdimm/region_devs.c:762:60-61: WARNING opportunity for
kobj_to_dev().

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/nvdimm/region_devs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Williams Dec. 24, 2020, 6:04 p.m. UTC | #1
On Sun, Dec 20, 2020 at 5:40 PM Tian Tao <tiantao6@hisilicon.com> wrote:
>
> fixed the following coccicheck:
> drivers/nvdimm/region_devs.c:762:60-61: WARNING opportunity for
> kobj_to_dev().
>

Thanks for this, but you missed a few:

drivers/nvdimm/bus.c:716:       struct device *dev =
container_of(kobj, typeof(*dev), kobj);
drivers/nvdimm/core.c:506:      struct device *dev =
container_of(kobj, typeof(*dev), kobj);
drivers/nvdimm/dimm_devs.c:421: struct device *dev =
container_of(kobj, typeof(*dev), kobj);
drivers/nvdimm/dimm_devs.c:537: struct device *dev =
container_of(kobj, typeof(*dev), kobj);
drivers/nvdimm/namespace_devs.c:1626:   struct device *dev =
container_of(kobj, struct device, kobj);
drivers/nvdimm/region_devs.c:647:       struct device *dev =
container_of(kobj, typeof(*dev), kobj);
drivers/nvdimm/region_devs.c:762:       struct device *dev =
container_of(kobj, struct device, kobj);

Care to resend with those included?
diff mbox series

Patch

diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index ef23119..d71d4e9 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -759,7 +759,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)