[NET] Rename open_request to request_sock
[linux-2.6/s3c2410-cpufreq.git] / drivers / scsi / scsi_sysfs.c
blobe75ee4671ee3a0a6dcb608a73d6bd2f4007eff09
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);
174 /* temporary expedient, try to catch use of queue lock
175 * after free of sdev */
176 sdev->request_queue = NULL;
179 scsi_target_reap(scsi_target(sdev));
181 kfree(sdev->inquiry);
182 kfree(sdev);
184 if (parent)
185 put_device(parent);
188 struct class sdev_class = {
189 .name = "scsi_device",
190 .release = scsi_device_cls_release,
193 /* all probing is done in the individual ->probe routines */
194 static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
196 struct scsi_device *sdp = to_scsi_device(dev);
197 if (sdp->no_uld_attach)
198 return 0;
199 return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
202 struct bus_type scsi_bus_type = {
203 .name = "scsi",
204 .match = scsi_bus_match,
207 int scsi_sysfs_register(void)
209 int error;
211 error = bus_register(&scsi_bus_type);
212 if (!error) {
213 error = class_register(&sdev_class);
214 if (error)
215 bus_unregister(&scsi_bus_type);
218 return error;
221 void scsi_sysfs_unregister(void)
223 class_unregister(&sdev_class);
224 bus_unregister(&scsi_bus_type);
228 * sdev_show_function: macro to create an attr function that can be used to
229 * show a non-bit field.
231 #define sdev_show_function(field, format_string) \
232 static ssize_t \
233 sdev_show_##field (struct device *dev, char *buf) \
235 struct scsi_device *sdev; \
236 sdev = to_scsi_device(dev); \
237 return snprintf (buf, 20, format_string, sdev->field); \
241 * sdev_rd_attr: macro to create a function and attribute variable for a
242 * read only field.
244 #define sdev_rd_attr(field, format_string) \
245 sdev_show_function(field, format_string) \
246 static DEVICE_ATTR(field, S_IRUGO, sdev_show_##field, NULL);
250 * sdev_rd_attr: create a function and attribute variable for a
251 * read/write field.
253 #define sdev_rw_attr(field, format_string) \
254 sdev_show_function(field, format_string) \
256 static ssize_t \
257 sdev_store_##field (struct device *dev, const char *buf, size_t count) \
259 struct scsi_device *sdev; \
260 sdev = to_scsi_device(dev); \
261 snscanf (buf, 20, format_string, &sdev->field); \
262 return count; \
264 static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, sdev_show_##field, sdev_store_##field);
266 /* Currently we don't export bit fields, but we might in future,
267 * so leave this code in */
268 #if 0
270 * sdev_rd_attr: create a function and attribute variable for a
271 * read/write bit field.
273 #define sdev_rw_attr_bit(field) \
274 sdev_show_function(field, "%d\n") \
276 static ssize_t \
277 sdev_store_##field (struct device *dev, const char *buf, size_t count) \
279 int ret; \
280 struct scsi_device *sdev; \
281 ret = scsi_sdev_check_buf_bit(buf); \
282 if (ret >= 0) { \
283 sdev = to_scsi_device(dev); \
284 sdev->field = ret; \
285 ret = count; \
287 return ret; \
289 static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, sdev_show_##field, sdev_store_##field);
292 * scsi_sdev_check_buf_bit: return 0 if buf is "0", return 1 if buf is "1",
293 * else return -EINVAL.
295 static int scsi_sdev_check_buf_bit(const char *buf)
297 if ((buf[1] == '\0') || ((buf[1] == '\n') && (buf[2] == '\0'))) {
298 if (buf[0] == '1')
299 return 1;
300 else if (buf[0] == '0')
301 return 0;
302 else
303 return -EINVAL;
304 } else
305 return -EINVAL;
307 #endif
309 * Create the actual show/store functions and data structures.
311 sdev_rd_attr (device_blocked, "%d\n");
312 sdev_rd_attr (queue_depth, "%d\n");
313 sdev_rd_attr (type, "%d\n");
314 sdev_rd_attr (scsi_level, "%d\n");
315 sdev_rd_attr (vendor, "%.8s\n");
316 sdev_rd_attr (model, "%.16s\n");
317 sdev_rd_attr (rev, "%.4s\n");
319 static ssize_t
320 sdev_show_timeout (struct device *dev, char *buf)
322 struct scsi_device *sdev;
323 sdev = to_scsi_device(dev);
324 return snprintf (buf, 20, "%d\n", sdev->timeout / HZ);
327 static ssize_t
328 sdev_store_timeout (struct device *dev, const char *buf, size_t count)
330 struct scsi_device *sdev;
331 int timeout;
332 sdev = to_scsi_device(dev);
333 sscanf (buf, "%d\n", &timeout);
334 sdev->timeout = timeout * HZ;
335 return count;
337 static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout);
339 static ssize_t
340 store_rescan_field (struct device *dev, const char *buf, size_t count)
342 scsi_rescan_device(dev);
343 return count;
345 static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field);
347 static ssize_t sdev_store_delete(struct device *dev, const char *buf,
348 size_t count)
350 scsi_remove_device(to_scsi_device(dev));
351 return count;
353 static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
355 static ssize_t
356 store_state_field(struct device *dev, const char *buf, size_t count)
358 int i;
359 struct scsi_device *sdev = to_scsi_device(dev);
360 enum scsi_device_state state = 0;
362 for (i = 0; i < sizeof(sdev_states)/sizeof(sdev_states[0]); i++) {
363 const int len = strlen(sdev_states[i].name);
364 if (strncmp(sdev_states[i].name, buf, len) == 0 &&
365 buf[len] == '\n') {
366 state = sdev_states[i].value;
367 break;
370 if (!state)
371 return -EINVAL;
373 if (scsi_device_set_state(sdev, state))
374 return -EINVAL;
375 return count;
378 static ssize_t
379 show_state_field(struct device *dev, char *buf)
381 struct scsi_device *sdev = to_scsi_device(dev);
382 const char *name = scsi_device_state_name(sdev->sdev_state);
384 if (!name)
385 return -EINVAL;
387 return snprintf(buf, 20, "%s\n", name);
390 static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field);
392 static ssize_t
393 show_queue_type_field(struct device *dev, char *buf)
395 struct scsi_device *sdev = to_scsi_device(dev);
396 const char *name = "none";
398 if (sdev->ordered_tags)
399 name = "ordered";
400 else if (sdev->simple_tags)
401 name = "simple";
403 return snprintf(buf, 20, "%s\n", name);
406 static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL);
408 static ssize_t
409 show_iostat_counterbits(struct device *dev, char *buf)
411 return snprintf(buf, 20, "%d\n", (int)sizeof(atomic_t) * 8);
414 static DEVICE_ATTR(iocounterbits, S_IRUGO, show_iostat_counterbits, NULL);
416 #define show_sdev_iostat(field) \
417 static ssize_t \
418 show_iostat_##field(struct device *dev, char *buf) \
420 struct scsi_device *sdev = to_scsi_device(dev); \
421 unsigned long long count = atomic_read(&sdev->field); \
422 return snprintf(buf, 20, "0x%llx\n", count); \
424 static DEVICE_ATTR(field, S_IRUGO, show_iostat_##field, NULL)
426 show_sdev_iostat(iorequest_cnt);
427 show_sdev_iostat(iodone_cnt);
428 show_sdev_iostat(ioerr_cnt);
431 /* Default template for device attributes. May NOT be modified */
432 static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
433 &dev_attr_device_blocked,
434 &dev_attr_queue_depth,
435 &dev_attr_queue_type,
436 &dev_attr_type,
437 &dev_attr_scsi_level,
438 &dev_attr_vendor,
439 &dev_attr_model,
440 &dev_attr_rev,
441 &dev_attr_rescan,
442 &dev_attr_delete,
443 &dev_attr_state,
444 &dev_attr_timeout,
445 &dev_attr_iocounterbits,
446 &dev_attr_iorequest_cnt,
447 &dev_attr_iodone_cnt,
448 &dev_attr_ioerr_cnt,
449 NULL
452 static ssize_t sdev_store_queue_depth_rw(struct device *dev, const char *buf,
453 size_t count)
455 int depth, retval;
456 struct scsi_device *sdev = to_scsi_device(dev);
457 struct scsi_host_template *sht = sdev->host->hostt;
459 if (!sht->change_queue_depth)
460 return -EINVAL;
462 depth = simple_strtoul(buf, NULL, 0);
464 if (depth < 1)
465 return -EINVAL;
467 retval = sht->change_queue_depth(sdev, depth);
468 if (retval < 0)
469 return retval;
471 return count;
474 static struct device_attribute sdev_attr_queue_depth_rw =
475 __ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth,
476 sdev_store_queue_depth_rw);
478 static ssize_t sdev_store_queue_type_rw(struct device *dev, const char *buf,
479 size_t count)
481 struct scsi_device *sdev = to_scsi_device(dev);
482 struct scsi_host_template *sht = sdev->host->hostt;
483 int tag_type = 0, retval;
484 int prev_tag_type = scsi_get_tag_type(sdev);
486 if (!sdev->tagged_supported || !sht->change_queue_type)
487 return -EINVAL;
489 if (strncmp(buf, "ordered", 7) == 0)
490 tag_type = MSG_ORDERED_TAG;
491 else if (strncmp(buf, "simple", 6) == 0)
492 tag_type = MSG_SIMPLE_TAG;
493 else if (strncmp(buf, "none", 4) != 0)
494 return -EINVAL;
496 if (tag_type == prev_tag_type)
497 return count;
499 retval = sht->change_queue_type(sdev, tag_type);
500 if (retval < 0)
501 return retval;
503 return count;
506 static struct device_attribute sdev_attr_queue_type_rw =
507 __ATTR(queue_type, S_IRUGO | S_IWUSR, show_queue_type_field,
508 sdev_store_queue_type_rw);
510 static struct device_attribute *attr_changed_internally(
511 struct Scsi_Host *shost,
512 struct device_attribute * attr)
514 if (!strcmp("queue_depth", attr->attr.name)
515 && shost->hostt->change_queue_depth)
516 return &sdev_attr_queue_depth_rw;
517 else if (!strcmp("queue_type", attr->attr.name)
518 && shost->hostt->change_queue_type)
519 return &sdev_attr_queue_type_rw;
520 return attr;
524 static struct device_attribute *attr_overridden(
525 struct device_attribute **attrs,
526 struct device_attribute *attr)
528 int i;
530 if (!attrs)
531 return NULL;
532 for (i = 0; attrs[i]; i++)
533 if (!strcmp(attrs[i]->attr.name, attr->attr.name))
534 return attrs[i];
535 return NULL;
538 static int attr_add(struct device *dev, struct device_attribute *attr)
540 struct device_attribute *base_attr;
543 * Spare the caller from having to copy things it's not interested in.
545 base_attr = attr_overridden(scsi_sysfs_sdev_attrs, attr);
546 if (base_attr) {
547 /* extend permissions */
548 attr->attr.mode |= base_attr->attr.mode;
550 /* override null show/store with default */
551 if (!attr->show)
552 attr->show = base_attr->show;
553 if (!attr->store)
554 attr->store = base_attr->store;
557 return device_create_file(dev, attr);
561 * scsi_sysfs_add_sdev - add scsi device to sysfs
562 * @sdev: scsi_device to add
564 * Return value:
565 * 0 on Success / non-zero on Failure
567 int scsi_sysfs_add_sdev(struct scsi_device *sdev)
569 int error, i;
571 if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
572 return error;
574 error = device_add(&sdev->sdev_gendev);
575 if (error) {
576 put_device(sdev->sdev_gendev.parent);
577 printk(KERN_INFO "error 1\n");
578 return error;
580 error = class_device_add(&sdev->sdev_classdev);
581 if (error) {
582 printk(KERN_INFO "error 2\n");
583 goto clean_device;
586 /* take a reference for the sdev_classdev; this is
587 * released by the sdev_class .release */
588 get_device(&sdev->sdev_gendev);
589 if (sdev->host->hostt->sdev_attrs) {
590 for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) {
591 error = attr_add(&sdev->sdev_gendev,
592 sdev->host->hostt->sdev_attrs[i]);
593 if (error) {
594 scsi_remove_device(sdev);
595 goto out;
600 for (i = 0; scsi_sysfs_sdev_attrs[i]; i++) {
601 if (!attr_overridden(sdev->host->hostt->sdev_attrs,
602 scsi_sysfs_sdev_attrs[i])) {
603 struct device_attribute * attr =
604 attr_changed_internally(sdev->host,
605 scsi_sysfs_sdev_attrs[i]);
606 error = device_create_file(&sdev->sdev_gendev, attr);
607 if (error) {
608 scsi_remove_device(sdev);
609 goto out;
614 transport_add_device(&sdev->sdev_gendev);
615 out:
616 return error;
618 clean_device:
619 scsi_device_set_state(sdev, SDEV_CANCEL);
621 device_del(&sdev->sdev_gendev);
622 transport_destroy_device(&sdev->sdev_gendev);
623 put_device(&sdev->sdev_gendev);
625 return error;
629 * scsi_remove_device - unregister a device from the scsi bus
630 * @sdev: scsi_device to unregister
632 void scsi_remove_device(struct scsi_device *sdev)
634 struct Scsi_Host *shost = sdev->host;
636 down(&shost->scan_mutex);
637 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
638 goto out;
640 class_device_unregister(&sdev->sdev_classdev);
641 device_del(&sdev->sdev_gendev);
642 scsi_device_set_state(sdev, SDEV_DEL);
643 if (sdev->host->hostt->slave_destroy)
644 sdev->host->hostt->slave_destroy(sdev);
645 transport_unregister_device(&sdev->sdev_gendev);
646 put_device(&sdev->sdev_gendev);
647 out:
648 up(&shost->scan_mutex);
650 EXPORT_SYMBOL(scsi_remove_device);
652 void __scsi_remove_target(struct scsi_target *starget)
654 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
655 unsigned long flags;
656 struct scsi_device *sdev, *tmp;
658 spin_lock_irqsave(shost->host_lock, flags);
659 starget->reap_ref++;
660 list_for_each_entry_safe(sdev, tmp, &shost->__devices, siblings) {
661 if (sdev->channel != starget->channel ||
662 sdev->id != starget->id)
663 continue;
664 spin_unlock_irqrestore(shost->host_lock, flags);
665 scsi_remove_device(sdev);
666 spin_lock_irqsave(shost->host_lock, flags);
668 spin_unlock_irqrestore(shost->host_lock, flags);
669 scsi_target_reap(starget);
673 * scsi_remove_target - try to remove a target and all its devices
674 * @dev: generic starget or parent of generic stargets to be removed
676 * Note: This is slightly racy. It is possible that if the user
677 * requests the addition of another device then the target won't be
678 * removed.
680 void scsi_remove_target(struct device *dev)
682 struct device *rdev, *idev, *next;
684 if (scsi_is_target_device(dev)) {
685 __scsi_remove_target(to_scsi_target(dev));
686 return;
689 rdev = get_device(dev);
690 list_for_each_entry_safe(idev, next, &dev->children, node) {
691 if (scsi_is_target_device(idev))
692 __scsi_remove_target(to_scsi_target(idev));
694 put_device(rdev);
696 EXPORT_SYMBOL(scsi_remove_target);
698 int scsi_register_driver(struct device_driver *drv)
700 drv->bus = &scsi_bus_type;
702 return driver_register(drv);
704 EXPORT_SYMBOL(scsi_register_driver);
706 int scsi_register_interface(struct class_interface *intf)
708 intf->class = &sdev_class;
710 return class_interface_register(intf);
712 EXPORT_SYMBOL(scsi_register_interface);
715 static struct class_device_attribute *class_attr_overridden(
716 struct class_device_attribute **attrs,
717 struct class_device_attribute *attr)
719 int i;
721 if (!attrs)
722 return NULL;
723 for (i = 0; attrs[i]; i++)
724 if (!strcmp(attrs[i]->attr.name, attr->attr.name))
725 return attrs[i];
726 return NULL;
729 static int class_attr_add(struct class_device *classdev,
730 struct class_device_attribute *attr)
732 struct class_device_attribute *base_attr;
735 * Spare the caller from having to copy things it's not interested in.
737 base_attr = class_attr_overridden(scsi_sysfs_shost_attrs, attr);
738 if (base_attr) {
739 /* extend permissions */
740 attr->attr.mode |= base_attr->attr.mode;
742 /* override null show/store with default */
743 if (!attr->show)
744 attr->show = base_attr->show;
745 if (!attr->store)
746 attr->store = base_attr->store;
749 return class_device_create_file(classdev, attr);
753 * scsi_sysfs_add_host - add scsi host to subsystem
754 * @shost: scsi host struct to add to subsystem
755 * @dev: parent struct device pointer
757 int scsi_sysfs_add_host(struct Scsi_Host *shost)
759 int error, i;
761 if (shost->hostt->shost_attrs) {
762 for (i = 0; shost->hostt->shost_attrs[i]; i++) {
763 error = class_attr_add(&shost->shost_classdev,
764 shost->hostt->shost_attrs[i]);
765 if (error)
766 return error;
770 for (i = 0; scsi_sysfs_shost_attrs[i]; i++) {
771 if (!class_attr_overridden(shost->hostt->shost_attrs,
772 scsi_sysfs_shost_attrs[i])) {
773 error = class_device_create_file(&shost->shost_classdev,
774 scsi_sysfs_shost_attrs[i]);
775 if (error)
776 return error;
780 transport_register_device(&shost->shost_gendev);
781 return 0;
784 void scsi_sysfs_device_initialize(struct scsi_device *sdev)
786 unsigned long flags;
787 struct Scsi_Host *shost = sdev->host;
788 struct scsi_target *starget = sdev->sdev_target;
790 device_initialize(&sdev->sdev_gendev);
791 sdev->sdev_gendev.bus = &scsi_bus_type;
792 sdev->sdev_gendev.release = scsi_device_dev_release;
793 sprintf(sdev->sdev_gendev.bus_id,"%d:%d:%d:%d",
794 sdev->host->host_no, sdev->channel, sdev->id,
795 sdev->lun);
797 class_device_initialize(&sdev->sdev_classdev);
798 sdev->sdev_classdev.dev = &sdev->sdev_gendev;
799 sdev->sdev_classdev.class = &sdev_class;
800 snprintf(sdev->sdev_classdev.class_id, BUS_ID_SIZE,
801 "%d:%d:%d:%d", sdev->host->host_no,
802 sdev->channel, sdev->id, sdev->lun);
803 sdev->scsi_level = SCSI_2;
804 transport_setup_device(&sdev->sdev_gendev);
805 spin_lock_irqsave(shost->host_lock, flags);
806 list_add_tail(&sdev->same_target_siblings, &starget->devices);
807 list_add_tail(&sdev->siblings, &shost->__devices);
808 spin_unlock_irqrestore(shost->host_lock, flags);
811 int scsi_is_sdev_device(const struct device *dev)
813 return dev->release == scsi_device_dev_release;
815 EXPORT_SYMBOL(scsi_is_sdev_device);
817 /* A blank transport template that is used in drivers that don't
818 * yet implement Transport Attributes */
819 struct scsi_transport_template blank_transport_template = { { { {NULL, }, }, }, };