linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zram: use ATTRIBUTE_GROUPS
@ 2021-10-28 20:36 Luis Chamberlain
  2021-10-28 20:44 ` Bart Van Assche
  2021-11-04  0:12 ` Sergey Senozhatsky
  0 siblings, 2 replies; 4+ messages in thread
From: Luis Chamberlain @ 2021-10-28 20:36 UTC (permalink / raw)
  To: minchan, ngupta, senozhatsky, axboe
  Cc: linux-kernel, linux-block, Luis Chamberlain

Embrace ATTRIBUTE_GROUPS to avoid boiler plate code.
This should not introduce any functional changes.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/block/zram/zram_drv.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index fcaf2750f68f..268f727f7cba 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1874,14 +1874,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
@@ -1953,7 +1946,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);
-	device_add_disk(NULL, zram->disk, zram_disk_attr_groups);
+	device_add_disk(NULL, zram->disk, zram_disk_groups);
 
 	strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] zram: use ATTRIBUTE_GROUPS
  2021-10-28 20:36 [PATCH] zram: use ATTRIBUTE_GROUPS Luis Chamberlain
@ 2021-10-28 20:44 ` Bart Van Assche
  2021-11-03 12:14   ` Luis Chamberlain
  2021-11-04  0:12 ` Sergey Senozhatsky
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2021-10-28 20:44 UTC (permalink / raw)
  To: Luis Chamberlain, minchan, ngupta, senozhatsky, axboe
  Cc: linux-kernel, linux-block

On 10/28/21 1:36 PM, Luis Chamberlain wrote:
> Embrace ATTRIBUTE_GROUPS to avoid boiler plate code.
> This should not introduce any functional changes.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>   drivers/block/zram/zram_drv.c | 11 ++---------
>   1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index fcaf2750f68f..268f727f7cba 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -1874,14 +1874,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
> @@ -1953,7 +1946,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);
> -	device_add_disk(NULL, zram->disk, zram_disk_attr_groups);
> +	device_add_disk(NULL, zram->disk, zram_disk_groups);
>   
>   	strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
>   
> 

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] zram: use ATTRIBUTE_GROUPS
  2021-10-28 20:44 ` Bart Van Assche
@ 2021-11-03 12:14   ` Luis Chamberlain
  0 siblings, 0 replies; 4+ messages in thread
From: Luis Chamberlain @ 2021-11-03 12:14 UTC (permalink / raw)
  To: axboe, linux-kernel
  Cc: minchan, ngupta, senozhatsky, axboe, linux-kernel, linux-block,
	Bart Van Assche

On Thu, Oct 28, 2021 at 01:44:38PM -0700, Bart Van Assche wrote:
> 
> Reviewed-by: Bart Van Assche <bvanassche@acm.org>

Just a gentle reminder.

  Luis

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] zram: use ATTRIBUTE_GROUPS
  2021-10-28 20:36 [PATCH] zram: use ATTRIBUTE_GROUPS Luis Chamberlain
  2021-10-28 20:44 ` Bart Van Assche
@ 2021-11-04  0:12 ` Sergey Senozhatsky
  1 sibling, 0 replies; 4+ messages in thread
From: Sergey Senozhatsky @ 2021-11-04  0:12 UTC (permalink / raw)
  To: Luis Chamberlain
  Cc: Andrew Morton, minchan, ngupta, senozhatsky, axboe, linux-kernel,
	linux-block

On (21/10/28 13:36), Luis Chamberlain wrote:
> Embrace ATTRIBUTE_GROUPS to avoid boiler plate code.
> This should not introduce any functional changes.
> 

Cc-ing Andrew  (20211028203600.2157356-1-mcgrof@kernel.org)

Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-04  0:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 20:36 [PATCH] zram: use ATTRIBUTE_GROUPS Luis Chamberlain
2021-10-28 20:44 ` Bart Van Assche
2021-11-03 12:14   ` Luis Chamberlain
2021-11-04  0:12 ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).