Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95832
b: refs/heads/master
c: 1ed4391
h: refs/heads/master
v: v3
  • Loading branch information
Miquel van Smoorenburg authored and James Bottomley committed May 2, 2008
1 parent 25a5f79 commit ef1287a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 62ac5aedc51485d672a5d91c262a001acecbe447
refs/heads/master: 1ed43910956f5faec690ea3214451779e93bbb52
26 changes: 26 additions & 0 deletions trunk/drivers/scsi/dpt_i2o.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ static int sys_tbl_len;
static adpt_hba* hba_chain = NULL;
static int hba_count = 0;

static struct class *adpt_sysfs_class;

#ifdef CONFIG_COMPAT
static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long);
#endif
Expand Down Expand Up @@ -254,13 +256,29 @@ static int adpt_detect(struct scsi_host_template* sht)
adpt_inquiry(pHba);
}

adpt_sysfs_class = class_create(THIS_MODULE, "dpt_i2o");
if (IS_ERR(adpt_sysfs_class)) {
printk(KERN_WARNING"dpti: unable to create dpt_i2o class\n");
adpt_sysfs_class = NULL;
}

for (pHba = hba_chain; pHba; pHba = pHba->next) {
if (adpt_scsi_host_alloc(pHba, sht) < 0){
adpt_i2o_delete_hba(pHba);
continue;
}
pHba->initialized = TRUE;
pHba->state &= ~DPTI_STATE_RESET;
if (adpt_sysfs_class) {
struct device *dev = device_create(adpt_sysfs_class,
NULL, MKDEV(DPTI_I2O_MAJOR, pHba->unit),
"dpti%d", pHba->unit);
if (IS_ERR(dev)) {
printk(KERN_WARNING"dpti%d: unable to "
"create device in dpt_i2o class\n",
pHba->unit);
}
}
}

// Register our control device node
Expand Down Expand Up @@ -1212,8 +1230,16 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
pci_dev_put(pHba->pDev);
kfree(pHba);

if (adpt_sysfs_class)
device_destroy(adpt_sysfs_class,
MKDEV(DPTI_I2O_MAJOR, pHba->unit));

if(hba_count <= 0){
unregister_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER);
if (adpt_sysfs_class) {
class_destroy(adpt_sysfs_class);
adpt_sysfs_class = NULL;
}
}
}

Expand Down

0 comments on commit ef1287a

Please sign in to comment.