]> git.baikalelectronics.ru Git - kernel.git/commitdiff
zram: use ATTRIBUTE_GROUPS
authorLuis Chamberlain <mcgrof@kernel.org>
Fri, 14 Jan 2022 22:09:22 +0000 (14:09 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 15 Jan 2022 14:30:31 +0000 (16:30 +0200)
Embrace ATTRIBUTE_GROUPS to avoid boiler plate code.  This should not
introduce any functional changes.

Link: https://lkml.kernel.org/r/20211028203600.2157356-1-mcgrof@kernel.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/block/zram/zram_drv.c

index 25071126995befb16c69e2c88a590fb54dd0491b..9a46b2ef6951d94909645afd13d1bc3a63a7b03b 100644 (file)
@@ -1903,14 +1903,7 @@ static struct attribute *zram_disk_attrs[] = {
        NULL,
 };
 
-static const struct attribute_group zram_disk_attr_group = {
-       .attrs = zram_disk_attrs,
-};
-
-static const struct attribute_group *zram_disk_attr_groups[] = {
-       &zram_disk_attr_group,
-       NULL,
-};
+ATTRIBUTE_GROUPS(zram_disk);
 
 /*
  * Allocate and initialize new zram device. the function returns
@@ -1982,7 +1975,7 @@ static int zram_add(void)
                blk_queue_max_write_zeroes_sectors(zram->disk->queue, UINT_MAX);
 
        blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, zram->disk->queue);
-       ret = device_add_disk(NULL, zram->disk, zram_disk_attr_groups);
+       ret = device_add_disk(NULL, zram->disk, zram_disk_groups);
        if (ret)
                goto out_cleanup_disk;