aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/dpt_i2o.c
diff options
context:
space:
mode:
authorMiquel van Smoorenburg <miquels@cistron.nl>2008-05-01 19:08:19 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-05-02 14:17:43 -0400
commit1ed43910956f5faec690ea3214451779e93bbb52 (patch)
treea8e55be28c44624e84c356c6713277cebae38730 /drivers/scsi/dpt_i2o.c
parent62ac5aedc51485d672a5d91c262a001acecbe447 (diff)
[SCSI] dpt_i2o: sysfs code
Create a /sys/class/dpt_i2o directory and populate it with dptiN directories. Each dptiN directory contains a "dev" file that makes udev create /dev/dptiN Signed-off-by: Miquel van Smoorenburg <miquels@cistron.nl> Acked-by: Mark Salyzyn <Mark_Salyzyn@adaptec.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/dpt_i2o.c')
-rw-r--r--drivers/scsi/dpt_i2o.c26
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;
111static adpt_hba* hba_chain = NULL; 111static adpt_hba* hba_chain = NULL;
112static int hba_count = 0; 112static int hba_count = 0;
113 113
114static struct class *adpt_sysfs_class;
115
114#ifdef CONFIG_COMPAT 116#ifdef CONFIG_COMPAT
115static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long); 117static 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