mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Sun Feng <loyou85@gmail.com>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: fix attribute_group lost if set before add_disk
Date: Fri, 10 Jun 2022 01:13:46 -0700	[thread overview]
Message-ID: <YqL9Ou+UlweAH/Me@infradead.org> (raw)
In-Reply-To: <1654845389-21741-1-git-send-email-loyou85@gmail.com>

On Fri, Jun 10, 2022 at 03:16:29PM +0800, Sun Feng wrote:
> after commit 52b85909f85d("block: fold register_disk into device_add_disk")
> when set attribute_group with following code:
> 
>   disk_to_dev(disk)->groups = attr_groups;
>   err = add_disk(disk);
> 
> disk_to_dev(disk)->groups will set to NULL in device_add_disk,
> 
>   static inline int __must_check add_disk(struct gendisk *disk)
>   {
>        	return device_add_disk(NULL, disk, NULL);
>   }
>   int __must_check device_add_disk(struct device *parent, ...
>                                  const struct attribute_group **groups)
>   {
> 	…
> 	ddev->groups = groups
> 
> and it will lose attribute group set.

Well, your are not supposed to set the attribute group yourself, but
instead pass it to device_add_disk.

      reply	other threads:[~2022-06-10  8:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10  7:16 Sun Feng
2022-06-10  8:13 ` Christoph Hellwig [this message]

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=YqL9Ou+UlweAH/Me@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loyou85@gmail.com \
    /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

all inboxes | Powered by JetHome®