/* scsi_dh_handler_attach - Attach a device handler to a device @sdev - SCSI device the device handler should attach to @scsi_dh - The device handler to attach  */
static int scsi_dh_handler_attach(struct scsi_device *sdev, struct scsi_device_handler *scsi_dh)
/* scsi_dh_handler_attach - Attach a device handler to a device @sdev - SCSI device the device handler should attach to @scsi_dh - The device handler to attach  */
static int scsi_dh_handler_attach(struct scsi_device *sdev, struct scsi_device_handler *scsi_dh)
{
	int err = 0;
	if (sdev->scsi_dh_data) {
		if (sdev->scsi_dh_data->scsi_dh != scsi_dh)
			err = -EBUSY;
		else
			kref_get(&sdev->scsi_dh_data->kref);
	} else if (scsi_dh->attach) {
		err = scsi_dh->attach(sdev);
		if (!err) {
			kref_init(&sdev->scsi_dh_data->kref);
			sdev->scsi_dh_data->sdev = sdev;
		}
	}
	return err;
}