aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 5326f5cbeae9..67a38a1409ba 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -489,10 +489,22 @@ store_rescan_field (struct device *dev, struct device_attribute *attr, const cha
489} 489}
490static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field); 490static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field);
491 491
492static void sdev_store_delete_callback(struct device *dev)
493{
494 scsi_remove_device(to_scsi_device(dev));
495}
496
492static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf, 497static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf,
493 size_t count) 498 size_t count)
494{ 499{
495 scsi_remove_device(to_scsi_device(dev)); 500 int rc;
501
502 /* An attribute cannot be unregistered by one of its own methods,
503 * so we have to use this roundabout approach.
504 */
505 rc = device_schedule_callback(dev, sdev_store_delete_callback);
506 if (rc)
507 count = rc;
496 return count; 508 return count;
497}; 509};
498static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); 510static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);