From: Mike Christie <michaelc@cs.wisc.edu>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH RFC 1/3] add fc transport events
Date: Thu, 27 May 2004 00:25:41 -0700 [thread overview]
Message-ID: <40B597F5.2030501@cs.wisc.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 247 bytes --]
01-add-host-transport-classdev.patch - adds the transport class_device to
the scsi_host structure.
drivers/scsi/hosts.c | 22 +++++++++++++++++++++-
include/scsi/scsi_host.h | 4 ++++
2 files changed, 25 insertions(+), 1 deletion(-)
[-- Attachment #2: 01-add-host-transport-classdev.patch --]
[-- Type: text/plain, Size: 2698 bytes --]
diff -arup linux-2.6.7-rc1/drivers/scsi/hosts.c linux-2.6.7-rc1-hotplug/drivers/scsi/hosts.c
--- linux-2.6.7-rc1/drivers/scsi/hosts.c 2004-05-26 22:47:18.000000000 -0700
+++ linux-2.6.7-rc1-hotplug/drivers/scsi/hosts.c 2004-05-26 23:17:30.217567849 -0700
@@ -83,6 +83,8 @@ void scsi_remove_host(struct Scsi_Host *
set_bit(SHOST_DEL, &shost->shost_state);
+ if (shost->transportt->class)
+ class_device_unregister(&shost->transport_classdev);
class_device_unregister(&shost->shost_classdev);
device_del(&shost->shost_gendev);
}
@@ -123,15 +125,28 @@ int scsi_add_host(struct Scsi_Host *shos
if (error)
goto out_del_gendev;
+ if (shost->transportt->class) {
+ shost->transport_classdev.class = shost->transportt->class;
+
+ error = class_device_add(&shost->transport_classdev);
+ if (error)
+ goto out_del_classdev;
+ /* take a reference for the transport_classdev; this
+ * is released by the transport_class .release */
+ get_device(&shost->shost_gendev);
+ }
+
get_device(&shost->shost_gendev);
error = scsi_sysfs_add_host(shost);
if (error)
- goto out_del_classdev;
+ goto out_del_transport;
scsi_proc_host_add(shost);
return error;
+ out_del_transport:
+ class_device_del(&shost->transport_classdev);
out_del_classdev:
class_device_del(&shost->shost_classdev);
out_del_gendev:
@@ -280,6 +295,11 @@ struct Scsi_Host *scsi_host_alloc(struct
snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d",
shost->host_no);
+ class_device_initialize(&shost->transport_classdev);
+ shost->transport_classdev.dev = &shost->shost_gendev;
+ snprintf(shost->transport_classdev.class_id, BUS_ID_SIZE, "host%d",
+ shost->host_no);
+
shost->eh_notify = &complete;
rval = kernel_thread(scsi_error_handler, shost, 0);
if (rval < 0)
diff -arup linux-2.6.7-rc1/include/scsi/scsi_host.h linux-2.6.7-rc1-hotplug/include/scsi/scsi_host.h
--- linux-2.6.7-rc1/include/scsi/scsi_host.h 2004-05-26 22:47:18.000000000 -0700
+++ linux-2.6.7-rc1-hotplug/include/scsi/scsi_host.h 2004-05-26 23:17:08.000000000 -0700
@@ -475,6 +475,7 @@ struct Scsi_Host {
/* ldm bits */
struct device shost_gendev;
struct class_device shost_classdev;
+ struct class_device transport_classdev;
/*
* List of hosts per template.
@@ -497,6 +498,9 @@ struct Scsi_Host {
container_of(d, struct Scsi_Host, shost_gendev)
#define class_to_shost(d) \
container_of(d, struct Scsi_Host, shost_classdev)
+#define transport_class_to_shost(_class_dev) \
+ container_of(_class_dev, struct Scsi_Host, transport_classdev)
+
extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
extern int scsi_add_host(struct Scsi_Host *, struct device *);
next reply other threads:[~2004-05-27 7:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-27 7:25 Mike Christie [this message]
2004-06-13 3:41 ` [PATCH RFC 1/3] add fc transport events James Bottomley
2004-06-13 20:44 ` Mike Christie
2004-06-13 21:23 ` Mike Christie
2004-06-13 22:46 ` James Bottomley
2004-06-13 23:17 ` Mike Christie
2004-06-14 2:15 ` Douglas Gilbert
2004-06-14 14:28 ` 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=40B597F5.2030501@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--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