scsi_sysfs: call 'device_add' after attaching device handler
authorHannes Reinecke <hare@suse.de>
Thu, 3 Mar 2016 06:54:12 +0000 (07:54 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 5 Mar 2016 22:21:41 +0000 (17:21 -0500)
commit4cd2459c066d2970241284b1fcdc5dca7ce6fbb2
treecea135d657fbf68f0f4ba353489865cac73a1a64
parent0323375c8bc5c101c9284856cac19a0b9ece71d4
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>
drivers/scsi/scsi_sysfs.c