forked from Minki/linux
scsi_sysfs: call 'device_add' after attaching device handler
'device_add' will be evaluating the 'is_visible' callback when creating the sysfs attributes. As by this time the device handler has not been attached the 'access_state' attribute will never be visible. This patch moves the code around so that the device handler is present by the time 'is_visible' is evaluated to correctly display the 'access_state' attribute. Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Bart van Assche <bart.vanassche@sandisk.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
0323375c8b
commit
4cd2459c06
@ -1220,13 +1220,6 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
|
|||||||
|
|
||||||
scsi_autopm_get_device(sdev);
|
scsi_autopm_get_device(sdev);
|
||||||
|
|
||||||
error = device_add(&sdev->sdev_gendev);
|
|
||||||
if (error) {
|
|
||||||
sdev_printk(KERN_INFO, sdev,
|
|
||||||
"failed to add device: %d\n", error);
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
error = scsi_dh_add_device(sdev);
|
error = scsi_dh_add_device(sdev);
|
||||||
if (error)
|
if (error)
|
||||||
/*
|
/*
|
||||||
@ -1235,6 +1228,14 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
|
|||||||
sdev_printk(KERN_INFO, sdev,
|
sdev_printk(KERN_INFO, sdev,
|
||||||
"failed to add device handler: %d\n", error);
|
"failed to add device handler: %d\n", error);
|
||||||
|
|
||||||
|
error = device_add(&sdev->sdev_gendev);
|
||||||
|
if (error) {
|
||||||
|
sdev_printk(KERN_INFO, sdev,
|
||||||
|
"failed to add device: %d\n", error);
|
||||||
|
scsi_dh_remove_device(sdev);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
device_enable_async_suspend(&sdev->sdev_dev);
|
device_enable_async_suspend(&sdev->sdev_dev);
|
||||||
error = device_add(&sdev->sdev_dev);
|
error = device_add(&sdev->sdev_dev);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user