This patchs adds a new helper scsi_destroy_device(). It will transition and sdev into the 'SDEV_DEL' state. Signed-off-by: Hannes Reinecke <hare@xxxxxxx> --- drivers/scsi/scsi_scan.c | 3 +-- include/scsi/scsi_device.h | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index a67f315..4874bdd 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -921,8 +921,7 @@ static inline void scsi_destroy_sdev(str scsi_device_set_state(sdev, SDEV_DEL); if (sdev->host->hostt->slave_destroy) sdev->host->hostt->slave_destroy(sdev); - transport_destroy_device(&sdev->sdev_gendev); - put_device(&sdev->sdev_gendev); + scsi_destroy_device(sdev); } #ifdef CONFIG_SCSI_LOGGING diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 2f3c5b8..dad55d2 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -322,6 +322,12 @@ static inline unsigned int sdev_id(struc #define scmd_id(scmd) sdev_id((scmd)->device) #define scmd_channel(scmd) sdev_channel((scmd)->device) +static inline void scsi_destroy_device(struct scsi_device *sdev) +{ + scsi_device_set_state(sdev, SDEV_DEL); + put_device(&sdev->sdev_gendev); +} + static inline int scsi_device_online(struct scsi_device *sdev) { return sdev->sdev_state != SDEV_OFFLINE; -- 1.4.3.4 - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html