[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1486754370-3057-1-git-send-email-logang@deltatee.com>
Date: Fri, 10 Feb 2017 12:19:30 -0700
From: Logan Gunthorpe <logang@...tatee.com>
To: Dan Williams <dan.j.williams@...el.com>,
Johannes Thumshirn <jthumshirn@...e.de>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
"Sajjan Vikas C" <vikas.cha.sajjan@....com>,
Arnd Bergmann <arnd@...db.de>, Jan Kara <jack@...e.cz>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-nvdimm@...ts.01.org, Logan Gunthorpe <logang@...tatee.com>
Subject: [PATCH] device-dax: don't set kobj parent during cdev init
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@...tatee.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
Powered by blists - more mailing lists