Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75879
b: refs/heads/master
c: 9c77010
h: refs/heads/master
i:
  75877: a97e4bf
  75875: eb4767e
  75871: d78c6aa
v: v3
  • Loading branch information
Dave Young authored and Greg Kroah-Hartman committed Jan 25, 2008
1 parent 0c772d6 commit c8cf23a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 71da890509fec13d54329485bf5e4ac16b992bb6
refs/heads/master: 9c7701088a61cc0cf8a6e1c68d1e74e3cc2ee0b7
24 changes: 13 additions & 11 deletions trunk/drivers/scsi/hosts.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,15 @@ void scsi_unregister(struct Scsi_Host *shost)
}
EXPORT_SYMBOL(scsi_unregister);

static int __scsi_host_match(struct class_device *cdev, void *data)
{
struct Scsi_Host *p;
unsigned short *hostnum = (unsigned short *)data;

p = class_to_shost(cdev);
return p->host_no == *hostnum;
}

/**
* scsi_host_lookup - get a reference to a Scsi_Host by host no
*
Expand All @@ -439,19 +448,12 @@ EXPORT_SYMBOL(scsi_unregister);
**/
struct Scsi_Host *scsi_host_lookup(unsigned short hostnum)
{
struct class *class = &shost_class;
struct class_device *cdev;
struct Scsi_Host *shost = ERR_PTR(-ENXIO), *p;
struct Scsi_Host *shost = ERR_PTR(-ENXIO);

down(&class->sem);
list_for_each_entry(cdev, &class->children, node) {
p = class_to_shost(cdev);
if (p->host_no == hostnum) {
shost = scsi_host_get(p);
break;
}
}
up(&class->sem);
cdev = class_find_child(&shost_class, &hostnum, __scsi_host_match);
if (cdev)
shost = scsi_host_get(class_to_shost(cdev));

return shost;
}
Expand Down

0 comments on commit c8cf23a

Please sign in to comment.