/* Returns 0 on success, -ENODEV if handler not registered.  */
int scsi_unregister_device_handler(struct scsi_device_handler *scsi_dh)
/* Returns 0 on success, -ENODEV if handler not registered.  */
int scsi_unregister_device_handler(struct scsi_device_handler *scsi_dh)
{
	struct scsi_dh_devinfo_list *tmp, *pos;
	if (!get_device_handler(scsi_dh->name))
		return -ENODEV;
	bus_for_each_dev(&scsi_bus_type, NULL, scsi_dh,
			 scsi_dh_notifier_remove);
	spin_lock(&list_lock);
	list_del(&scsi_dh->list);
	list_for_each_entry_safe(pos, tmp, &scsi_dh_dev_list, node) {
		if (pos->handler == scsi_dh) {
			list_del(&pos->node);
			kfree(pos);
		}
	}
	spin_unlock(&list_lock);
	printk(KERN_INFO "%s: device handler unregistered\n", scsi_dh->name);
	return SCSI_DH_OK;
}