Re: [PATCH] block: fix attribute_group lost if set before add_disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux