Lines Matching +full:activate +full:- +full:to +full:- +full:activate
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 if (!strncmp(tmp->name, name, strlen(tmp->name))) { in get_device_handler()
48 * device_handler_match_function - Match a device handler to a device
49 * @sdev - SCSI device to be tested
61 if (tmp_dh->match && tmp_dh->match(sdev)) { in device_handler_match_function()
71 * device_handler_match - Attach a device handler to a device
72 * @scsi_dh - The device handler to match against or NULL
73 * @sdev - SCSI device to be tested against @scsi_dh
94 * scsi_dh_handler_attach - Attach a device handler to a device
95 * @sdev - SCSI device the device handler should attach to
96 * @scsi_dh - The device handler to attach
103 if (sdev->scsi_dh_data) { in scsi_dh_handler_attach()
104 if (sdev->scsi_dh_data->scsi_dh != scsi_dh) in scsi_dh_handler_attach()
105 err = -EBUSY; in scsi_dh_handler_attach()
107 kref_get(&sdev->scsi_dh_data->kref); in scsi_dh_handler_attach()
108 } else if (scsi_dh->attach) { in scsi_dh_handler_attach()
109 err = scsi_dh->attach(sdev); in scsi_dh_handler_attach()
111 kref_init(&sdev->scsi_dh_data->kref); in scsi_dh_handler_attach()
112 sdev->scsi_dh_data->sdev = sdev; in scsi_dh_handler_attach()
121 scsi_dh_data->scsi_dh->detach(scsi_dh_data->sdev); in __detach_handler()
125 * scsi_dh_handler_detach - Detach a device handler from a device
126 * @sdev - SCSI device the device handler should be detached from
127 * @scsi_dh - Device handler to be detached
135 if (!sdev->scsi_dh_data) in scsi_dh_handler_detach()
138 if (scsi_dh && scsi_dh != sdev->scsi_dh_data->scsi_dh) in scsi_dh_handler_detach()
142 scsi_dh = sdev->scsi_dh_data->scsi_dh; in scsi_dh_handler_detach()
144 if (scsi_dh && scsi_dh->detach) in scsi_dh_handler_detach()
145 kref_put(&sdev->scsi_dh_data->kref, __detach_handler); in scsi_dh_handler_detach()
157 int err = -EINVAL; in store_dh_state()
159 if (sdev->sdev_state == SDEV_CANCEL || in store_dh_state()
160 sdev->sdev_state == SDEV_DEL) in store_dh_state()
161 return -ENODEV; in store_dh_state()
163 if (!sdev->scsi_dh_data) { in store_dh_state()
165 * Attach to a device handler in store_dh_state()
171 scsi_dh = sdev->scsi_dh_data->scsi_dh; in store_dh_state()
178 } else if (!strncmp(buf, "activate", 8)) { in store_dh_state()
180 * Activate a device handler in store_dh_state()
182 if (scsi_dh->activate) in store_dh_state()
183 err = scsi_dh->activate(sdev, NULL, NULL); in store_dh_state()
197 if (!sdev->scsi_dh_data) in show_dh_state()
200 return snprintf(buf, 20, "%s\n", sdev->scsi_dh_data->scsi_dh->name); in show_dh_state()
208 * scsi_dh_sysfs_attr_add - Callback for scsi_init_dh
220 err = device_create_file(&sdev->sdev_gendev, in scsi_dh_sysfs_attr_add()
227 * scsi_dh_sysfs_attr_remove - Callback for scsi_exit_dh
238 device_remove_file(&sdev->sdev_gendev, in scsi_dh_sysfs_attr_remove()
245 * scsi_dh_notifier - notifier chain callback
274 * scsi_dh_notifier_add - Callback for scsi_register_device_handler
298 * scsi_dh_notifier_remove - Callback for scsi_unregister_device_handler
321 * scsi_register_device_handler - register a device handler personality
323 * @scsi_dh - device handler to be registered.
325 * Returns 0 on success, -EBUSY if handler already registered.
330 if (get_device_handler(scsi_dh->name)) in scsi_register_device_handler()
331 return -EBUSY; in scsi_register_device_handler()
334 list_add(&scsi_dh->list, &scsi_dh_list); in scsi_register_device_handler()
338 printk(KERN_INFO "%s: device handler registered\n", scsi_dh->name); in scsi_register_device_handler()
345 * scsi_unregister_device_handler - register a device handler personality
347 * @scsi_dh - device handler to be unregistered.
349 * Returns 0 on success, -ENODEV if handler not registered.
354 if (!get_device_handler(scsi_dh->name)) in scsi_unregister_device_handler()
355 return -ENODEV; in scsi_unregister_device_handler()
361 list_del(&scsi_dh->list); in scsi_unregister_device_handler()
363 printk(KERN_INFO "%s: device handler unregistered\n", scsi_dh->name); in scsi_unregister_device_handler()
370 * scsi_dh_activate - activate the path associated with the scsi_device
371 * corresponding to the given request queue.
372 * Returns immediately without waiting for activation to be completed.
373 * @q - Request queue that is associated with the scsi_device to be
375 * @fn - Function to be called upon completion of the activation.
379 * @data - data passed to the function fn upon completion.
390 spin_lock_irqsave(q->queue_lock, flags); in scsi_dh_activate()
391 sdev = q->queuedata; in scsi_dh_activate()
393 spin_unlock_irqrestore(q->queue_lock, flags); in scsi_dh_activate()
400 if (sdev->scsi_dh_data) in scsi_dh_activate()
401 scsi_dh = sdev->scsi_dh_data->scsi_dh; in scsi_dh_activate()
402 dev = get_device(&sdev->sdev_gendev); in scsi_dh_activate()
404 sdev->sdev_state == SDEV_CANCEL || in scsi_dh_activate()
405 sdev->sdev_state == SDEV_DEL) in scsi_dh_activate()
407 if (sdev->sdev_state == SDEV_OFFLINE) in scsi_dh_activate()
409 spin_unlock_irqrestore(q->queue_lock, flags); in scsi_dh_activate()
417 if (scsi_dh->activate) in scsi_dh_activate()
418 err = scsi_dh->activate(sdev, fn, data); in scsi_dh_activate()
426 * scsi_dh_set_params - set the parameters for the device as per the
428 * @q - Request queue that is associated with the scsi_device for
429 * which the parameters to be set.
430 * @params - parameters in the following format
437 int err = -SCSI_DH_NOSYS; in scsi_dh_set_params()
442 spin_lock_irqsave(q->queue_lock, flags); in scsi_dh_set_params()
443 sdev = q->queuedata; in scsi_dh_set_params()
444 if (sdev && sdev->scsi_dh_data) in scsi_dh_set_params()
445 scsi_dh = sdev->scsi_dh_data->scsi_dh; in scsi_dh_set_params()
446 if (scsi_dh && scsi_dh->set_params && get_device(&sdev->sdev_gendev)) in scsi_dh_set_params()
448 spin_unlock_irqrestore(q->queue_lock, flags); in scsi_dh_set_params()
452 err = scsi_dh->set_params(sdev, params); in scsi_dh_set_params()
453 put_device(&sdev->sdev_gendev); in scsi_dh_set_params()
459 * scsi_dh_handler_exist - Return TRUE(1) if a device handler exists for
461 * @name - name of the device handler.
470 * scsi_dh_attach - Attach device handler
471 * @sdev - sdev the handler should be attached to
472 * @name - name of the handler to attach
483 return -EINVAL; in scsi_dh_attach()
485 spin_lock_irqsave(q->queue_lock, flags); in scsi_dh_attach()
486 sdev = q->queuedata; in scsi_dh_attach()
487 if (!sdev || !get_device(&sdev->sdev_gendev)) in scsi_dh_attach()
488 err = -ENODEV; in scsi_dh_attach()
489 spin_unlock_irqrestore(q->queue_lock, flags); in scsi_dh_attach()
493 put_device(&sdev->sdev_gendev); in scsi_dh_attach()
500 * scsi_dh_detach - Detach device handler
501 * @sdev - sdev the handler should be detached from
513 spin_lock_irqsave(q->queue_lock, flags); in scsi_dh_detach()
514 sdev = q->queuedata; in scsi_dh_detach()
515 if (!sdev || !get_device(&sdev->sdev_gendev)) in scsi_dh_detach()
517 spin_unlock_irqrestore(q->queue_lock, flags); in scsi_dh_detach()
522 if (sdev->scsi_dh_data) { in scsi_dh_detach()
523 scsi_dh = sdev->scsi_dh_data->scsi_dh; in scsi_dh_detach()
526 put_device(&sdev->sdev_gendev); in scsi_dh_detach()