Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f12ffa5 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

scsi: device handlers must have attach and detach methods

parent a64d01dc
Loading
Loading
Loading
Loading
+13 −12
Original line number Diff line number Diff line
@@ -108,7 +108,6 @@ static int scsi_dh_handler_attach(struct scsi_device *sdev,
		return 0;
	}

	if (scsi_dh->attach) {
	if (!try_module_get(scsi_dh->module))
		return -EINVAL;

@@ -120,7 +119,6 @@ static int scsi_dh_handler_attach(struct scsi_device *sdev,

	kref_init(&sdev->scsi_dh_data->kref);
	sdev->scsi_dh_data->sdev = sdev;
	}
	return err;
}

@@ -154,7 +152,7 @@ static void scsi_dh_handler_detach(struct scsi_device *sdev,
	if (!scsi_dh)
		scsi_dh = sdev->scsi_dh_data->scsi_dh;

	if (scsi_dh && scsi_dh->detach)
	if (scsi_dh)
		kref_put(&sdev->scsi_dh_data->kref, __detach_handler);
}

@@ -343,6 +341,9 @@ int scsi_register_device_handler(struct scsi_device_handler *scsi_dh)
	if (get_device_handler(scsi_dh->name))
		return -EBUSY;

	if (!scsi_dh->attach || !scsi_dh->detach)
		return -EINVAL;

	spin_lock(&list_lock);
	list_add(&scsi_dh->list, &scsi_dh_list);
	spin_unlock(&list_lock);