mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
mm: backing-dev: make bdi_class a static const structure
Now that the driver core allows for struct class to be in read-only memory, move the bdi_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at load time. Link: https://lkml.kernel.org/r/20230620183314.682822-2-gregkh@linuxfoundation.org Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
3fda49e89f
commit
b5665cf936
1 changed files with 11 additions and 6 deletions
|
@ -20,7 +20,6 @@
|
||||||
struct backing_dev_info noop_backing_dev_info;
|
struct backing_dev_info noop_backing_dev_info;
|
||||||
EXPORT_SYMBOL_GPL(noop_backing_dev_info);
|
EXPORT_SYMBOL_GPL(noop_backing_dev_info);
|
||||||
|
|
||||||
static struct class *bdi_class;
|
|
||||||
static const char *bdi_unknown_name = "(unknown)";
|
static const char *bdi_unknown_name = "(unknown)";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -345,13 +344,19 @@ static struct attribute *bdi_dev_attrs[] = {
|
||||||
};
|
};
|
||||||
ATTRIBUTE_GROUPS(bdi_dev);
|
ATTRIBUTE_GROUPS(bdi_dev);
|
||||||
|
|
||||||
|
static const struct class bdi_class = {
|
||||||
|
.name = "bdi",
|
||||||
|
.dev_groups = bdi_dev_groups,
|
||||||
|
};
|
||||||
|
|
||||||
static __init int bdi_class_init(void)
|
static __init int bdi_class_init(void)
|
||||||
{
|
{
|
||||||
bdi_class = class_create("bdi");
|
int ret;
|
||||||
if (IS_ERR(bdi_class))
|
|
||||||
return PTR_ERR(bdi_class);
|
ret = class_register(&bdi_class);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
bdi_class->dev_groups = bdi_dev_groups;
|
|
||||||
bdi_debug_init();
|
bdi_debug_init();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1001,7 +1006,7 @@ int bdi_register_va(struct backing_dev_info *bdi, const char *fmt, va_list args)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
vsnprintf(bdi->dev_name, sizeof(bdi->dev_name), fmt, args);
|
vsnprintf(bdi->dev_name, sizeof(bdi->dev_name), fmt, args);
|
||||||
dev = device_create(bdi_class, NULL, MKDEV(0, 0), bdi, bdi->dev_name);
|
dev = device_create(&bdi_class, NULL, MKDEV(0, 0), bdi, bdi->dev_name);
|
||||||
if (IS_ERR(dev))
|
if (IS_ERR(dev))
|
||||||
return PTR_ERR(dev);
|
return PTR_ERR(dev);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue