From: Miquel van Smoorenburg <miquels@cistron.nl>
To: linux-scsi@vger.kernel.org
Subject: [PATCH 4/4] dpt_i2o: sysfs code
Date: Fri, 2 May 2008 01:08:19 +0200 [thread overview]
Message-ID: <20080501230815.GA19856@xs4all.net> (raw)
In-Reply-To: <20080501230211.GA19796@xs4all.net>
[PATCH 4/4] 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>
diff -ruN linux-2.6.25-03/drivers/scsi/dpt_i2o.c linux-2.6.25-04/drivers/scsi/dpt_i2o.c
--- linux-2.6.25-03/drivers/scsi/dpt_i2o.c 2008-05-02 00:28:55.000000000 +0200
+++ linux-2.6.25-04/drivers/scsi/dpt_i2o.c 2008-05-02 00:27:12.000000000 +0200
@@ -111,6 +111,8 @@
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
@@ -254,6 +256,12 @@
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);
@@ -261,6 +269,16 @@
}
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
@@ -1212,8 +1230,16 @@
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;
+ }
}
}
next prev parent reply other threads:[~2008-05-01 23:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-01 23:02 [PATCH 0/4] dpt_i2o: 64 bit support (take 5) Miquel van Smoorenburg
2008-05-01 23:05 ` [PATCH 1/4] dpt_i2o: use standard __init / __exit code Miquel van Smoorenburg
2008-05-02 13:18 ` Mark Salyzyn
2008-05-01 23:06 ` [PATCH 2/4] dpt_i2o: move from virt_to_bus/bus_to_virt to dma_alloc_coherent Miquel van Smoorenburg
2008-05-02 11:25 ` Rolf Eike Beer
2008-05-02 12:15 ` Miquel van Smoorenburg
2008-05-01 23:07 ` [PATCH 3/4] dpt_i2o: 64 bit support Miquel van Smoorenburg
2008-05-02 11:32 ` Rolf Eike Beer
2008-05-01 23:08 ` Miquel van Smoorenburg [this message]
2008-05-02 13:28 ` [PATCH 4/4] dpt_i2o: sysfs code Mark Salyzyn
2008-05-07 3:10 ` [PATCH 0/4] dpt_i2o: 64 bit support (take 5) Andrew Morton
2008-05-13 5:42 ` Andrew Morton
2008-05-13 16:51 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080501230815.GA19856@xs4all.net \
--to=miquels@cistron.nl \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox