On Thu, 2018-02-01 at 18:15 +0200, Stanislav Nijnikov wrote: > diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c > index cbc0fe2..69a6a1f 100644 > --- a/drivers/scsi/scsi_sysfs.c > +++ b/drivers/scsi/scsi_sysfs.c > @@ -1309,6 +1309,14 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) > } > } > > + if (sdev->host->hostt->sdev_groups) { > + error = sysfs_create_groups(&sdev->sdev_gendev.kobj, > + (const struct attribute_group **) > + sdev->host->hostt->sdev_groups); > + if (error) > + return error; > + } > + > scsi_autopm_put_device(sdev); > return error; > } > @@ -1326,6 +1334,12 @@ void __scsi_remove_device(struct scsi_device *sdev) > if (sdev->sdev_state == SDEV_DEL) > return; > > + if (sdev->host->hostt->sdev_groups) { > + sysfs_remove_groups(&sdev->sdev_gendev.kobj, > + (const struct attribute_group **) > + sdev->host->hostt->sdev_groups); > + } > + > if (sdev->is_visible) { > /* > * If scsi_internal_target_block() is running concurrently, Please split this patch into two patches, namely one patch that introduces the sdev_groups attribute in the SCSI core and a second patch that does not modify the SCSI core but only the UFS driver. That will make these changes easier to review. Additionally, it seems wrong to me to cast the third argument of sysfs_create_groups() and sysfs_remove_groups() from a non-const to a const pointer. Please consider to declare the sdev_groups member const and also the corresponding data structures in the UFS driver. Thanks, Bart.