Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / scsi / scsi_sysfs.c
blob134d3a3e4222a4154ad25b938e78b37276219bb4
1 /*
2 * scsi_sysfs.c
4 * SCSI sysfs interface routines.
6 * Created to pull SCSI mid layer sysfs routines into one file.
7 */
9 #include <linux/config.h>
10 #include <linux/module.h>
11 #include <linux/init.h>
12 #include <linux/blkdev.h>
13 #include <linux/device.h>
15 #include <scsi/scsi.h>
16 #include <scsi/scsi_device.h>
17 #include <scsi/scsi_host.h>
18 #include <scsi/scsi_tcq.h>
19 #include <scsi/scsi_transport.h>
21 #include "scsi_priv.h"
22 #include "scsi_logging.h"
24 static struct {
25 enum scsi_device_state value;
26 char *name;
27 } sdev_states[] = {
28 { SDEV_CREATED, "created" },
29 { SDEV_RUNNING, "running" },
30 { SDEV_CANCEL, "cancel" },
31 { SDEV_DEL, "deleted" },
32 { SDEV_QUIESCE, "quiesce" },
33 { SDEV_OFFLINE, "offline" },
34 { SDEV_BLOCK, "blocked" },
37 const char *scsi_device_state_name(enum scsi_device_state state)
39 int i;
40 char *name = NULL;
42 for (i = 0; i < sizeof(sdev_states)/sizeof(sdev_states[0]); i++) {
43 if (sdev_states[i].value == state) {
44 name = sdev_states[i].name;
45 break;
48 return name;
51 static int check_set(unsigned int *val, char *src)
53 char *last;
55 if (strncmp(src, "-", 20) == 0) {
56 *val = SCAN_WILD_CARD;
57 } else {
59 * Doesn't check for int overflow
61 *val = simple_strtoul(src, &last, 0);
62 if (*last != '\0')
63 return 1;
65 return 0;
68 static int scsi_scan(struct Scsi_Host *shost, const char *str)
70 char s1[15], s2[15], s3[15], junk;
71 unsigned int channel, id, lun;
72 int res;
74 res = sscanf(str, "%10s %10s %10s %c", s1, s2, s3, &junk);
75 if (res != 3)
76 return -EINVAL;
77 if (check_set(&channel, s1))
78 return -EINVAL;
79 if (check_set(&id, s2))
80 return -EINVAL;
81 if (check_set(&lun, s3))
82 return -EINVAL;
83 res = scsi_scan_host_selected(shost, channel, id, lun, 1);
84 return res;
88 * shost_show_function: macro to create an attr function that can be used to
89 * show a non-bit field.
91 #define shost_show_function(name, field, format_string) \
92 static ssize_t \
93 show_##name (struct class_device *class_dev, char *buf) \
94 { \
95 struct Scsi_Host *shost = class_to_shost(class_dev); \
96 return snprintf (buf, 20, format_string, shost->field); \
100 * shost_rd_attr: macro to create a function and attribute variable for a
101 * read only field.
103 #define shost_rd_attr2(name, field, format_string) \
104 shost_show_function(name, field, format_string) \
105 static CLASS_DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
107 #define shost_rd_attr(field, format_string) \
108 shost_rd_attr2(field, field, format_string)
111 * Create the actual show/store functions and data structures.
114 static ssize_t store_scan(struct class_device *class_dev, const char *buf,
115 size_t count)
117 struct Scsi_Host *shost = class_to_shost(class_dev);
118 int res;
120 res = scsi_scan(shost, buf);
121 if (res == 0)
122 res = count;
123 return res;
125 static CLASS_DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan);
127 shost_rd_attr(unique_id, "%u\n");
128 shost_rd_attr(host_busy, "%hu\n");
129 shost_rd_attr(cmd_per_lun, "%hd\n");
130 shost_rd_attr(sg_tablesize, "%hu\n");
131 shost_rd_attr(unchecked_isa_dma, "%d\n");
132 shost_rd_attr2(proc_name, hostt->proc_name, "%s\n");
134 static struct class_device_attribute *scsi_sysfs_shost_attrs[] = {
135 &class_device_attr_unique_id,
136 &class_device_attr_host_busy,
137 &class_device_attr_cmd_per_lun,
138 &class_device_attr_sg_tablesize,
139 &class_device_attr_unchecked_isa_dma,
140 &class_device_attr_proc_name,
141 &class_device_attr_scan,
142 NULL
145 static void scsi_device_cls_release(struct class_device *class_dev)
147 struct scsi_device *sdev;
149 sdev = class_to_sdev(class_dev);
150 put_device(&sdev->sdev_gendev);
153 void scsi_device_dev_release(struct device *dev)
155 struct scsi_device *sdev;
156 struct device *parent;
157 struct scsi_target *starget;
158 unsigned long flags;
160 parent = dev->parent;
161 sdev = to_scsi_device(dev);
162 starget = to_scsi_target(parent);
164 spin_lock_irqsave(sdev->host->host_lock, flags);
165 starget->reap_ref++;
166 list_del(&sdev->siblings);
167 list_del(&sdev->same_target_siblings);
168 list_del(&sdev->starved_entry);
169 spin_unlock_irqrestore(sdev->host->host_lock, flags);
171 if (sdev->request_queue) {
172 sdev->request_queue->queuedata = NULL;
173 scsi_free_queue(sdev->request_queue);
176 scsi_target_reap(scsi_target(sdev));
178 kfree(sdev->inquiry);
179 kfree(sdev);
181 if (parent)
182 put_device(parent);
185 struct class sdev_class = {
186 .name = "scsi_device",
187 .release = scsi_device_cls_release,
190 /* all probing is done in the individual ->probe routines */
191 static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
193 struct scsi_device *sdp = to_scsi_device(dev);
194 if (sdp->no_uld_attach)
195 return 0;
196 return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
199 struct bus_type scsi_bus_type = {
200 .name = "scsi",
201 .match = scsi_bus_match,
204 int scsi_sysfs_register(void)
206 int error;
208 error = bus_register(&scsi_bus_type);
209 if (!error) {
210 error = class_register(&sdev_class);
211 if (error)
212 bus_unregister(&scsi_bus_type);
215 return error;
218 void scsi_sysfs_unregister(void)
220 class_unregister(&sdev_class);
221 bus_unregister(&scsi_bus_type);
225 * sdev_show_function: macro to create an attr function that can be used to
226 * show a non-bit field.
228 #define sdev_show_function(field, format_string) \
229 static ssize_t \
230 sdev_show_##field (struct device *dev, char *buf) \
232 struct scsi_device *sdev; \
233 sdev = to_scsi_device(dev); \
234 return snprintf (buf, 20, format_string, sdev->field); \
238 * sdev_rd_attr: macro to create a function and attribute variable for a
239 * read only field.
241 #define sdev_rd_attr(field, format_string) \
242 sdev_show_function(field, format_string) \
243 static DEVICE_ATTR(field, S_IRUGO, sdev_show_##field, NULL);
247 * sdev_rd_attr: create a function and attribute variable for a
248 * read/write field.
250 #define sdev_rw_attr(field, format_string) \
251 sdev_show_function(field, format_string) \
253 static ssize_t \
254 sdev_store_##field (struct device *dev, const char *buf, size_t count) \
256 struct scsi_device *sdev; \
257 sdev = to_scsi_device(dev); \
258 snscanf (buf, 20, format_string, &sdev->field); \
259 return count; \
261 static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, sdev_show_##field, sdev_store_##field);
263 /* Currently we don't export bit fields, but we might in future,
264 * so leave this code in */
265 #if 0
267 * sdev_rd_attr: create a function and attribute variable for a
268 * read/write bit field.
270 #define sdev_rw_attr_bit(field) \
271 sdev_show_function(field, "%d\n") \
273 static ssize_t \
274 sdev_store_##field (struct device *dev, const char *buf, size_t count) \
276 int ret; \
277 struct scsi_device *sdev; \
278 ret = scsi_sdev_check_buf_bit(buf); \
279 if (ret >= 0) { \
280 sdev = to_scsi_device(dev); \
281 sdev->field = ret; \
282 ret = count; \
284 return ret; \
286 static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, sdev_show_##field, sdev_store_##field);
289 * scsi_sdev_check_buf_bit: return 0 if buf is "0", return 1 if buf is "1",
290 * else return -EINVAL.
292 static int scsi_sdev_check_buf_bit(const char *buf)
294 if ((buf[1] == '\0') || ((buf[1] == '\n') && (buf[2] == '\0'))) {
295 if (buf[0] == '1')
296 return 1;
297 else if (buf[0] == '0')
298 return 0;
299 else
300 return -EINVAL;
301 } else
302 return -EINVAL;
304 #endif
306 * Create the actual show/store functions and data structures.
308 sdev_rd_attr (device_blocked, "%d\n");
309 sdev_rd_attr (queue_depth, "%d\n");
310 sdev_rd_attr (type, "%d\n");
311 sdev_rd_attr (scsi_level, "%d\n");
312 sdev_rd_attr (vendor, "%.8s\n");
313 sdev_rd_attr (model, "%.16s\n");
314 sdev_rd_attr (rev, "%.4s\n");
316 static ssize_t
317 sdev_show_timeout (struct device *dev, char *buf)
319 struct scsi_device *sdev;
320 sdev = to_scsi_device(dev);
321 return snprintf (buf, 20, "%d\n", sdev->timeout / HZ);
324 static ssize_t
325 sdev_store_timeout (struct device *dev, const char *buf, size_t count)
327 struct scsi_device *sdev;
328 int timeout;
329 sdev = to_scsi_device(dev);
330 sscanf (buf, "%d\n", &timeout);
331 sdev->timeout = timeout * HZ;
332 return count;
334 static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout);
336 static ssize_t
337 store_rescan_field (struct device *dev, const char *buf, size_t count)
339 scsi_rescan_device(dev);
340 return count;
342 static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field);
344 static ssize_t sdev_store_delete(struct device *dev, const char *buf,
345 size_t count)
347 scsi_remove_device(to_scsi_device(dev));
348 return count;
350 static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
352 static ssize_t
353 store_state_field(struct device *dev, const char *buf, size_t count)
355 int i;
356 struct scsi_device *sdev = to_scsi_device(dev);
357 enum scsi_device_state state = 0;
359 for (i = 0; i < sizeof(sdev_states)/sizeof(sdev_states[0]); i++) {
360 const int len = strlen(sdev_states[i].name);
361 if (strncmp(sdev_states[i].name, buf, len) == 0 &&
362 buf[len] == '\n') {
363 state = sdev_states[i].value;
364 break;
367 if (!state)
368 return -EINVAL;
370 if (scsi_device_set_state(sdev, state))
371 return -EINVAL;
372 return count;
375 static ssize_t
376 show_state_field(struct device *dev, char *buf)
378 struct scsi_device *sdev = to_scsi_device(dev);
379 const char *name = scsi_device_state_name(sdev->sdev_state);
381 if (!name)
382 return -EINVAL;
384 return snprintf(buf, 20, "%s\n", name);
387 static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field);
389 static ssize_t
390 show_queue_type_field(struct device *dev, char *buf)
392 struct scsi_device *sdev = to_scsi_device(dev);
393 const char *name = "none";
395 if (sdev->ordered_tags)
396 name = "ordered";
397 else if (sdev->simple_tags)
398 name = "simple";
400 return snprintf(buf, 20, "%s\n", name);
403 static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL);
405 static ssize_t
406 show_iostat_counterbits(struct device *dev, char *buf)
408 return snprintf(buf, 20, "%d\n", (int)sizeof(atomic_t) * 8);
411 static DEVICE_ATTR(iocounterbits, S_IRUGO, show_iostat_counterbits, NULL);
413 #define show_sdev_iostat(field) \
414 static ssize_t \
415 show_iostat_##field(struct device *dev, char *buf) \
417 struct scsi_device *sdev = to_scsi_device(dev); \
418 unsigned long long count = atomic_read(&sdev->field); \
419 return snprintf(buf, 20, "0x%llx\n", count); \
421 static DEVICE_ATTR(field, S_IRUGO, show_iostat_##field, NULL)
423 show_sdev_iostat(iorequest_cnt);
424 show_sdev_iostat(iodone_cnt);
425 show_sdev_iostat(ioerr_cnt);
428 /* Default template for device attributes. May NOT be modified */
429 static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
430 &dev_attr_device_blocked,
431 &dev_attr_queue_depth,
432 &dev_attr_queue_type,
433 &dev_attr_type,
434 &dev_attr_scsi_level,
435 &dev_attr_vendor,
436 &dev_attr_model,
437 &dev_attr_rev,
438 &dev_attr_rescan,
439 &dev_attr_delete,
440 &dev_attr_state,
441 &dev_attr_timeout,
442 &dev_attr_iocounterbits,
443 &dev_attr_iorequest_cnt,
444 &dev_attr_iodone_cnt,
445 &dev_attr_ioerr_cnt,
446 NULL
449 static ssize_t sdev_store_queue_depth_rw(struct device *dev, const char *buf,
450 size_t count)
452 int depth, retval;
453 struct scsi_device *sdev = to_scsi_device(dev);
454 struct scsi_host_template *sht = sdev->host->hostt;
456 if (!sht->change_queue_depth)
457 return -EINVAL;
459 depth = simple_strtoul(buf, NULL, 0);
461 if (depth < 1)
462 return -EINVAL;
464 retval = sht->change_queue_depth(sdev, depth);
465 if (retval < 0)
466 return retval;
468 return count;
471 static struct device_attribute sdev_attr_queue_depth_rw =
472 __ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth,
473 sdev_store_queue_depth_rw);
475 static ssize_t sdev_store_queue_type_rw(struct device *dev, const char *buf,
476 size_t count)
478 struct scsi_device *sdev = to_scsi_device(dev);
479 struct scsi_host_template *sht = sdev->host->hostt;
480 int tag_type = 0, retval;
481 int prev_tag_type = scsi_get_tag_type(sdev);
483 if (!sdev->tagged_supported || !sht->change_queue_type)
484 return -EINVAL;
486 if (strncmp(buf, "ordered", 7) == 0)
487 tag_type = MSG_ORDERED_TAG;
488 else if (strncmp(buf, "simple", 6) == 0)
489 tag_type = MSG_SIMPLE_TAG;
490 else if (strncmp(buf, "none", 4) != 0)
491 return -EINVAL;
493 if (tag_type == prev_tag_type)
494 return count;
496 retval = sht->change_queue_type(sdev, tag_type);
497 if (retval < 0)
498 return retval;
500 return count;
503 static struct device_attribute sdev_attr_queue_type_rw =
504 __ATTR(queue_type, S_IRUGO | S_IWUSR, show_queue_type_field,
505 sdev_store_queue_type_rw);
507 static struct device_attribute *attr_changed_internally(
508 struct Scsi_Host *shost,
509 struct device_attribute * attr)
511 if (!strcmp("queue_depth", attr->attr.name)
512 && shost->hostt->change_queue_depth)
513 return &sdev_attr_queue_depth_rw;
514 else if (!strcmp("queue_type", attr->attr.name)
515 && shost->hostt->change_queue_type)
516 return &sdev_attr_queue_type_rw;
517 return attr;
521 static struct device_attribute *attr_overridden(
522 struct device_attribute **attrs,
523 struct device_attribute *attr)
525 int i;
527 if (!attrs)
528 return NULL;
529 for (i = 0; attrs[i]; i++)
530 if (!strcmp(attrs[i]->attr.name, attr->attr.name))
531 return attrs[i];
532 return NULL;
535 static int attr_add(struct device *dev, struct device_attribute *attr)
537 struct device_attribute *base_attr;
540 * Spare the caller from having to copy things it's not interested in.
542 base_attr = attr_overridden(scsi_sysfs_sdev_attrs, attr);
543 if (base_attr) {
544 /* extend permissions */
545 attr->attr.mode |= base_attr->attr.mode;
547 /* override null show/store with default */
548 if (!attr->show)
549 attr->show = base_attr->show;
550 if (!attr->store)
551 attr->store = base_attr->store;
554 return device_create_file(dev, attr);
558 * scsi_sysfs_add_sdev - add scsi device to sysfs
559 * @sdev: scsi_device to add
561 * Return value:
562 * 0 on Success / non-zero on Failure
564 int scsi_sysfs_add_sdev(struct scsi_device *sdev)
566 int error, i;
568 if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
569 return error;
571 error = device_add(&sdev->sdev_gendev);
572 if (error) {
573 put_device(sdev->sdev_gendev.parent);
574 printk(KERN_INFO "error 1\n");
575 return error;
577 error = class_device_add(&sdev->sdev_classdev);
578 if (error) {
579 printk(KERN_INFO "error 2\n");
580 goto clean_device;
583 /* take a reference for the sdev_classdev; this is
584 * released by the sdev_class .release */
585 get_device(&sdev->sdev_gendev);
586 if (sdev->host->hostt->sdev_attrs) {
587 for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) {
588 error = attr_add(&sdev->sdev_gendev,
589 sdev->host->hostt->sdev_attrs[i]);
590 if (error) {
591 scsi_remove_device(sdev);
592 goto out;
597 for (i = 0; scsi_sysfs_sdev_attrs[i]; i++) {
598 if (!attr_overridden(sdev->host->hostt->sdev_attrs,
599 scsi_sysfs_sdev_attrs[i])) {
600 struct device_attribute * attr =
601 attr_changed_internally(sdev->host,
602 scsi_sysfs_sdev_attrs[i]);
603 error = device_create_file(&sdev->sdev_gendev, attr);
604 if (error) {
605 scsi_remove_device(sdev);
606 goto out;
611 transport_add_device(&sdev->sdev_gendev);
612 out:
613 return error;
615 clean_device:
616 scsi_device_set_state(sdev, SDEV_CANCEL);
618 device_del(&sdev->sdev_gendev);
619 transport_destroy_device(&sdev->sdev_gendev);
620 put_device(&sdev->sdev_gendev);
622 return error;
626 * scsi_remove_device - unregister a device from the scsi bus
627 * @sdev: scsi_device to unregister
629 void scsi_remove_device(struct scsi_device *sdev)
631 struct Scsi_Host *shost = sdev->host;
633 down(&shost->scan_mutex);
634 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
635 goto out;
637 class_device_unregister(&sdev->sdev_classdev);
638 device_del(&sdev->sdev_gendev);
639 scsi_device_set_state(sdev, SDEV_DEL);
640 if (sdev->host->hostt->slave_destroy)
641 sdev->host->hostt->slave_destroy(sdev);
642 transport_unregister_device(&sdev->sdev_gendev);
643 put_device(&sdev->sdev_gendev);
644 out:
645 up(&shost->scan_mutex);
647 EXPORT_SYMBOL(scsi_remove_device);
649 void __scsi_remove_target(struct scsi_target *starget)
651 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
652 unsigned long flags;
653 struct scsi_device *sdev, *tmp;
655 spin_lock_irqsave(shost->host_lock, flags);
656 starget->reap_ref++;
657 list_for_each_entry_safe(sdev, tmp, &shost->__devices, siblings) {
658 if (sdev->channel != starget->channel ||
659 sdev->id != starget->id)
660 continue;
661 spin_unlock_irqrestore(shost->host_lock, flags);
662 scsi_remove_device(sdev);
663 spin_lock_irqsave(shost->host_lock, flags);
665 spin_unlock_irqrestore(shost->host_lock, flags);
666 scsi_target_reap(starget);
670 * scsi_remove_target - try to remove a target and all its devices
671 * @dev: generic starget or parent of generic stargets to be removed
673 * Note: This is slightly racy. It is possible that if the user
674 * requests the addition of another device then the target won't be
675 * removed.
677 void scsi_remove_target(struct device *dev)
679 struct device *rdev, *idev, *next;
681 if (scsi_is_target_device(dev)) {
682 __scsi_remove_target(to_scsi_target(dev));
683 return;
686 rdev = get_device(dev);
687 list_for_each_entry_safe(idev, next, &dev->children, node) {
688 if (scsi_is_target_device(idev))
689 __scsi_remove_target(to_scsi_target(idev));
691 put_device(rdev);
693 EXPORT_SYMBOL(scsi_remove_target);
695 int scsi_register_driver(struct device_driver *drv)
697 drv->bus = &scsi_bus_type;
699 return driver_register(drv);
701 EXPORT_SYMBOL(scsi_register_driver);
703 int scsi_register_interface(struct class_interface *intf)
705 intf->class = &sdev_class;
707 return class_interface_register(intf);
709 EXPORT_SYMBOL(scsi_register_interface);
712 static struct class_device_attribute *class_attr_overridden(
713 struct class_device_attribute **attrs,
714 struct class_device_attribute *attr)
716 int i;
718 if (!attrs)
719 return NULL;
720 for (i = 0; attrs[i]; i++)
721 if (!strcmp(attrs[i]->attr.name, attr->attr.name))
722 return attrs[i];
723 return NULL;
726 static int class_attr_add(struct class_device *classdev,
727 struct class_device_attribute *attr)
729 struct class_device_attribute *base_attr;
732 * Spare the caller from having to copy things it's not interested in.
734 base_attr = class_attr_overridden(scsi_sysfs_shost_attrs, attr);
735 if (base_attr) {
736 /* extend permissions */
737 attr->attr.mode |= base_attr->attr.mode;
739 /* override null show/store with default */
740 if (!attr->show)
741 attr->show = base_attr->show;
742 if (!attr->store)
743 attr->store = base_attr->store;
746 return class_device_create_file(classdev, attr);
750 * scsi_sysfs_add_host - add scsi host to subsystem
751 * @shost: scsi host struct to add to subsystem
752 * @dev: parent struct device pointer
754 int scsi_sysfs_add_host(struct Scsi_Host *shost)
756 int error, i;
758 if (shost->hostt->shost_attrs) {
759 for (i = 0; shost->hostt->shost_attrs[i]; i++) {
760 error = class_attr_add(&shost->shost_classdev,
761 shost->hostt->shost_attrs[i]);
762 if (error)
763 return error;
767 for (i = 0; scsi_sysfs_shost_attrs[i]; i++) {
768 if (!class_attr_overridden(shost->hostt->shost_attrs,
769 scsi_sysfs_shost_attrs[i])) {
770 error = class_device_create_file(&shost->shost_classdev,
771 scsi_sysfs_shost_attrs[i]);
772 if (error)
773 return error;
777 transport_register_device(&shost->shost_gendev);
778 return 0;
781 void scsi_sysfs_device_initialize(struct scsi_device *sdev)
783 unsigned long flags;
784 struct Scsi_Host *shost = sdev->host;
785 struct scsi_target *starget = sdev->sdev_target;
787 device_initialize(&sdev->sdev_gendev);
788 sdev->sdev_gendev.bus = &scsi_bus_type;
789 sdev->sdev_gendev.release = scsi_device_dev_release;
790 sprintf(sdev->sdev_gendev.bus_id,"%d:%d:%d:%d",
791 sdev->host->host_no, sdev->channel, sdev->id,
792 sdev->lun);
794 class_device_initialize(&sdev->sdev_classdev);
795 sdev->sdev_classdev.dev = &sdev->sdev_gendev;
796 sdev->sdev_classdev.class = &sdev_class;
797 snprintf(sdev->sdev_classdev.class_id, BUS_ID_SIZE,
798 "%d:%d:%d:%d", sdev->host->host_no,
799 sdev->channel, sdev->id, sdev->lun);
800 sdev->scsi_level = SCSI_2;
801 transport_setup_device(&sdev->sdev_gendev);
802 spin_lock_irqsave(shost->host_lock, flags);
803 list_add_tail(&sdev->same_target_siblings, &starget->devices);
804 list_add_tail(&sdev->siblings, &shost->__devices);
805 spin_unlock_irqrestore(shost->host_lock, flags);
808 int scsi_is_sdev_device(const struct device *dev)
810 return dev->release == scsi_device_dev_release;
812 EXPORT_SYMBOL(scsi_is_sdev_device);
814 /* A blank transport template that is used in drivers that don't
815 * yet implement Transport Attributes */
816 struct scsi_transport_template blank_transport_template = { { { {NULL, }, }, }, };