mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
rbd: switch to dynamic root device
Driver core expects devices to be dynamically allocated and will, for example, complain loudly when no release function has been provided. Use root_device_register() to allocate and register the root device instead of open coding using a static device. Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
8cd9520d35
commit
e5c6b06a97
|
|
@ -580,14 +580,7 @@ static const struct bus_type rbd_bus_type = {
|
|||
.bus_groups = rbd_bus_groups,
|
||||
};
|
||||
|
||||
static void rbd_root_dev_release(struct device *dev)
|
||||
{
|
||||
}
|
||||
|
||||
static struct device rbd_root_dev = {
|
||||
.init_name = "rbd",
|
||||
.release = rbd_root_dev_release,
|
||||
};
|
||||
static struct device *rbd_root_dev;
|
||||
|
||||
static __printf(2, 3)
|
||||
void rbd_warn(struct rbd_device *rbd_dev, const char *fmt, ...)
|
||||
|
|
@ -5378,7 +5371,7 @@ static struct rbd_device *__rbd_dev_create(struct rbd_spec *spec)
|
|||
|
||||
rbd_dev->dev.bus = &rbd_bus_type;
|
||||
rbd_dev->dev.type = &rbd_device_type;
|
||||
rbd_dev->dev.parent = &rbd_root_dev;
|
||||
rbd_dev->dev.parent = rbd_root_dev;
|
||||
device_initialize(&rbd_dev->dev);
|
||||
|
||||
return rbd_dev;
|
||||
|
|
@ -7327,15 +7320,13 @@ static int __init rbd_sysfs_init(void)
|
|||
{
|
||||
int ret;
|
||||
|
||||
ret = device_register(&rbd_root_dev);
|
||||
if (ret < 0) {
|
||||
put_device(&rbd_root_dev);
|
||||
return ret;
|
||||
}
|
||||
rbd_root_dev = root_device_register("rbd");
|
||||
if (IS_ERR(rbd_root_dev))
|
||||
return PTR_ERR(rbd_root_dev);
|
||||
|
||||
ret = bus_register(&rbd_bus_type);
|
||||
if (ret < 0)
|
||||
device_unregister(&rbd_root_dev);
|
||||
root_device_unregister(rbd_root_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -7343,7 +7334,7 @@ static int __init rbd_sysfs_init(void)
|
|||
static void __exit rbd_sysfs_cleanup(void)
|
||||
{
|
||||
bus_unregister(&rbd_bus_type);
|
||||
device_unregister(&rbd_root_dev);
|
||||
root_device_unregister(rbd_root_dev);
|
||||
}
|
||||
|
||||
static int __init rbd_slab_init(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user