lkml.org 
[lkml]   [2017]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] device-dax: don't set kobj parent during cdev init
Hey,

Also on the subject of very minor fixes: I noticed drivers/dax is not in
the maintainers file. I just assumed the nvdimm list should have been
included with those from get_maintainers.

Thanks,

Logan

On 10/02/17 12:19 PM, Logan Gunthorpe wrote:
> 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);
>

\
 
 \ /
  Last update: 2017-02-10 20:23    [W:0.072 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site