diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index dc6b2d4a9aa1..8939fbf102fc 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -111,6 +111,8 @@ static int sys_tbl_len; | |||
111 | static adpt_hba* hba_chain = NULL; | 111 | static adpt_hba* hba_chain = NULL; |
112 | static int hba_count = 0; | 112 | static int hba_count = 0; |
113 | 113 | ||
114 | static struct class *adpt_sysfs_class; | ||
115 | |||
114 | #ifdef CONFIG_COMPAT | 116 | #ifdef CONFIG_COMPAT |
115 | static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long); | 117 | static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long); |
116 | #endif | 118 | #endif |
@@ -254,6 +256,12 @@ rebuild_sys_tab: | |||
254 | adpt_inquiry(pHba); | 256 | adpt_inquiry(pHba); |
255 | } | 257 | } |
256 | 258 | ||
259 | adpt_sysfs_class = class_create(THIS_MODULE, "dpt_i2o"); | ||
260 | if (IS_ERR(adpt_sysfs_class)) { | ||
261 | printk(KERN_WARNING"dpti: unable to create dpt_i2o class\n"); | ||
262 | adpt_sysfs_class = NULL; | ||
263 | } | ||
264 | |||
257 | for (pHba = hba_chain; pHba; pHba = pHba->next) { | 265 | for (pHba = hba_chain; pHba; pHba = pHba->next) { |
258 | if (adpt_scsi_host_alloc(pHba, sht) < 0){ | 266 | if (adpt_scsi_host_alloc(pHba, sht) < 0){ |
259 | adpt_i2o_delete_hba(pHba); | 267 | adpt_i2o_delete_hba(pHba); |
@@ -261,6 +269,16 @@ rebuild_sys_tab: | |||
261 | } | 269 | } |
262 | pHba->initialized = TRUE; | 270 | pHba->initialized = TRUE; |
263 | pHba->state &= ~DPTI_STATE_RESET; | 271 | pHba->state &= ~DPTI_STATE_RESET; |
272 | if (adpt_sysfs_class) { | ||
273 | struct device *dev = device_create(adpt_sysfs_class, | ||
274 | NULL, MKDEV(DPTI_I2O_MAJOR, pHba->unit), | ||
275 | "dpti%d", pHba->unit); | ||
276 | if (IS_ERR(dev)) { | ||
277 | printk(KERN_WARNING"dpti%d: unable to " | ||
278 | "create device in dpt_i2o class\n", | ||
279 | pHba->unit); | ||
280 | } | ||
281 | } | ||
264 | } | 282 | } |
265 | 283 | ||
266 | // Register our control device node | 284 | // Register our control device node |
@@ -1212,8 +1230,16 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) | |||
1212 | pci_dev_put(pHba->pDev); | 1230 | pci_dev_put(pHba->pDev); |
1213 | kfree(pHba); | 1231 | kfree(pHba); |
1214 | 1232 | ||
1233 | if (adpt_sysfs_class) | ||
1234 | device_destroy(adpt_sysfs_class, | ||
1235 | MKDEV(DPTI_I2O_MAJOR, pHba->unit)); | ||
1236 | |||
1215 | if(hba_count <= 0){ | 1237 | if(hba_count <= 0){ |
1216 | unregister_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER); | 1238 | unregister_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER); |
1239 | if (adpt_sysfs_class) { | ||
1240 | class_destroy(adpt_sysfs_class); | ||
1241 | adpt_sysfs_class = NULL; | ||
1242 | } | ||
1217 | } | 1243 | } |
1218 | } | 1244 | } |
1219 | 1245 | ||