public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Luis Chamberlain <mcgrof@kernel.org>,
	minchan@kernel.org, ngupta@vflare.org, senozhatsky@chromium.org,
	axboe@kernel.dk
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH] zram: use ATTRIBUTE_GROUPS
Date: Thu, 28 Oct 2021 13:44:38 -0700	[thread overview]
Message-ID: <520834ee-edd2-282c-017a-b7ed075bd8a0@acm.org> (raw)
In-Reply-To: <20211028203600.2157356-1-mcgrof@kernel.org>

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>

  reply	other threads:[~2021-10-28 20:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 20:36 [PATCH] zram: use ATTRIBUTE_GROUPS Luis Chamberlain
2021-10-28 20:44 ` Bart Van Assche [this message]
2021-11-03 12:14   ` Luis Chamberlain
2021-11-04  0:12 ` Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=520834ee-edd2-282c-017a-b7ed075bd8a0@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox