Skip to content

Commit ac0ece9

Browse files
htejungregkh
authored andcommitted
scsi: use device_remove_file_self() instead of device_schedule_callback()
driver-core now supports synchrnous self-deletion of attributes and the asynchrnous removal mechanism is scheduled for removal. Use it instead of device_schedule_callback(). This makes "delete" behave synchronously. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: "James E.J. Bottomley" <JBottomley@parallels.com> Cc: linux-scsi@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bc6caf0 commit ac0ece9

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

drivers/scsi/scsi_sysfs.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -649,23 +649,12 @@ store_rescan_field (struct device *dev, struct device_attribute *attr,
649649
}
650650
static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field);
651651

652-
static void sdev_store_delete_callback(struct device *dev)
653-
{
654-
scsi_remove_device(to_scsi_device(dev));
655-
}
656-
657652
static ssize_t
658653
sdev_store_delete(struct device *dev, struct device_attribute *attr,
659654
const char *buf, size_t count)
660655
{
661-
int rc;
662-
663-
/* An attribute cannot be unregistered by one of its own methods,
664-
* so we have to use this roundabout approach.
665-
*/
666-
rc = device_schedule_callback(dev, sdev_store_delete_callback);
667-
if (rc)
668-
count = rc;
656+
if (device_remove_file_self(dev, attr))
657+
scsi_remove_device(to_scsi_device(dev));
669658
return count;
670659
};
671660
static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);

0 commit comments

Comments
 (0)