public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] device-dax: don't set kobj parent during cdev init
@ 2017-02-10 19:19 Logan Gunthorpe
  2017-02-10 19:22 ` Logan Gunthorpe
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Logan Gunthorpe @ 2017-02-10 19:19 UTC (permalink / raw)
  To: Dan Williams, Johannes Thumshirn, Paul E. McKenney,
	Sajjan Vikas C, Arnd Bergmann, Jan Kara
  Cc: linux-kernel, Greg Kroah-Hartman, linux-nvdimm, Logan Gunthorpe

I copied this code and per feedback from Greg Kroah-Hartman [1] the
cdev's kobject's parent should not be set to the related device.
This should have minor consequences but isn't doing what anyone
expects it to.

This patch then fixes device-dax so it doesn't make the same mistake.

[1] https://lkml.org/lkml/2017/2/10/370

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
 drivers/dax/dax.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
index ed758b7..24e53b7 100644
--- a/drivers/dax/dax.c
+++ b/drivers/dax/dax.c
@@ -699,13 +699,9 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region,
 		goto err_inode;
 	}
 
-	/* device_initialize() so cdev can reference kobj parent */
-	device_initialize(dev);
-
 	cdev = &dax_dev->cdev;
 	cdev_init(cdev, &dax_fops);
 	cdev->owner = parent->driver->owner;
-	cdev->kobj.parent = &dev->kobj;
 	rc = cdev_add(&dax_dev->cdev, dev_t, 1);
 	if (rc)
 		goto err_cdev;
@@ -722,7 +718,7 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region,
 	dev->groups = dax_attribute_groups;
 	dev->release = dax_dev_release;
 	dev_set_name(dev, "dax%d.%d", dax_region->id, dax_dev->id);
-	rc = device_add(dev);
+	rc = device_register(dev);
 	if (rc) {
 		put_device(dev);
 		return ERR_PTR(rc);
-- 
2.1.4

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

end of thread, other threads:[~2017-02-13 22:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-10 19:19 [PATCH] device-dax: don't set kobj parent during cdev init Logan Gunthorpe
2017-02-10 19:22 ` Logan Gunthorpe
2017-02-10 19:41 ` Dan Williams
2017-02-10 20:17   ` Greg Kroah-Hartman
2017-02-10 22:25     ` Dan Williams
2017-02-11  7:16       ` Greg Kroah-Hartman
2017-02-11  8:56         ` Dan Williams
2017-02-11 17:59           ` Logan Gunthorpe
2017-02-11 18:27             ` Dan Williams
2017-02-11 18:43               ` Logan Gunthorpe
2017-02-11 18:55                 ` Dan Williams
2017-02-11 18:58                   ` Dan Williams
2017-02-12  5:42                     ` Logan Gunthorpe
2017-02-13 20:47                       ` Dan Williams
2017-02-13 22:38                         ` Logan Gunthorpe
2017-02-10 19:46 ` Greg Kroah-Hartman

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