All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Warren Togami <wtogami@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Merge I2O patches from -mm
Date: Tue, 17 Aug 2004 17:56:24 +0100	[thread overview]
Message-ID: <20040817175624.A24038@infradead.org> (raw)
In-Reply-To: <412208A6.7020104@shadowconnect.com>; from Markus.Lidel@shadowconnect.com on Tue, Aug 17, 2004 at 03:31:18PM +0200


The patch below adds a __scsi_add_device that can "preload" sdev->hostdata.


--- 1.127/drivers/scsi/scsi_scan.c	2004-06-25 13:56:28 +02:00
+++ edited/drivers/scsi/scsi_scan.c	2004-08-17 20:41:07 +02:00
@@ -200,7 +200,7 @@
  *     scsi_Device pointer, or NULL on failure.
  **/
 static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
-	       	uint channel, uint id, uint lun)
+	       	uint channel, uint id, uint lun, void *hostdata)
 {
 	struct scsi_device *sdev, *device;
 	unsigned long flags;
@@ -224,6 +224,8 @@
 	INIT_LIST_HEAD(&sdev->starved_entry);
 	spin_lock_init(&sdev->list_lock);
 
+	/* usually NULL and set by ->slave_alloc instead */
+	sdev->hostdata = hostdata;
 
 	/* if the device needs this changing, it may do so in the
 	 * slave_configure function */
@@ -697,7 +699,7 @@
  **/
 static int scsi_probe_and_add_lun(struct Scsi_Host *host,
 		uint channel, uint id, uint lun, int *bflagsp,
-		struct scsi_device **sdevp, int rescan)
+		struct scsi_device **sdevp, int rescan, void *hostdata)
 {
 	struct scsi_device *sdev;
 	struct scsi_request *sreq;
@@ -726,7 +728,7 @@
 		}
 	}
 
-	sdev = scsi_alloc_sdev(host, channel, id, lun);
+	sdev = scsi_alloc_sdev(host, channel, id, lun, hostdata);
 	if (!sdev)
 		goto out;
 	sreq = scsi_allocate_request(sdev, GFP_ATOMIC);
@@ -874,7 +876,7 @@
 	 */
 	for (lun = 1; lun < max_dev_lun; ++lun)
 		if ((scsi_probe_and_add_lun(shost, channel, id, lun,
-		      NULL, NULL, rescan) != SCSI_SCAN_LUN_PRESENT) &&
+		      NULL, NULL, rescan, NULL) != SCSI_SCAN_LUN_PRESENT) &&
 		    !sparse_lun)
 			return;
 }
@@ -1085,7 +1087,7 @@
 			int res;
 
 			res = scsi_probe_and_add_lun(sdev->host, sdev->channel,
-				sdev->id, lun, NULL, NULL, rescan);
+				sdev->id, lun, NULL, NULL, rescan, NULL);
 			if (res == SCSI_SCAN_NO_RESPONSE) {
 				/*
 				 * Got some results, but now none, abort.
@@ -1111,14 +1113,15 @@
 	return 0;
 }
 
-struct scsi_device *scsi_add_device(struct Scsi_Host *shost,
-				    uint channel, uint id, uint lun)
+struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
+		uint id, uint lun, void *hostdata)
 {
 	struct scsi_device *sdev;
 	int res;
 
 	down(&shost->scan_mutex);
-	res = scsi_probe_and_add_lun(shost, channel, id, lun, NULL, &sdev, 1);
+	res = scsi_probe_and_add_lun(shost, channel, id, lun, NULL,
+				     &sdev, 1, hostdata);
 	if (res != SCSI_SCAN_LUN_PRESENT)
 		sdev = ERR_PTR(-ENODEV);
 	up(&shost->scan_mutex);
@@ -1178,7 +1181,7 @@
 		 * Scan for a specific host/chan/id/lun.
 		 */
 		scsi_probe_and_add_lun(shost, channel, id, lun, NULL, NULL,
-				       rescan);
+				       rescan, NULL);
 		return;
 	}
 
@@ -1187,7 +1190,7 @@
 	 * would not configure LUN 0 until all LUNs are scanned.
 	 */
 	res = scsi_probe_and_add_lun(shost, channel, id, 0, &bflags, &sdev,
-				     rescan);
+				     rescan, NULL);
 	if (res == SCSI_SCAN_LUN_PRESENT) {
 		if (scsi_report_lun_scan(sdev, bflags, rescan) != 0)
 			/*
@@ -1316,7 +1319,7 @@
 {
 	struct scsi_device *sdev;
 
-	sdev = scsi_alloc_sdev(shost, 0, shost->this_id, 0);
+	sdev = scsi_alloc_sdev(shost, 0, shost->this_id, 0, NULL);
 	if (sdev) {
 		sdev->borken = 0;
 	}
===== drivers/scsi/scsi_syms.c 1.49 vs edited =====
--- 1.49/drivers/scsi/scsi_syms.c	2004-06-27 00:40:24 +02:00
+++ edited/drivers/scsi/scsi_syms.c	2004-08-17 20:50:22 +02:00
@@ -73,7 +73,7 @@
 
 EXPORT_SYMBOL(scsi_io_completion);
 
-EXPORT_SYMBOL(scsi_add_device);
+EXPORT_SYMBOL(__scsi_add_device);
 EXPORT_SYMBOL(scsi_remove_device);
 EXPORT_SYMBOL(scsi_device_cancel);
 
--- 1.19/include/scsi/scsi_device.h	2004-07-07 18:24:13 +02:00
+++ edited/include/scsi/scsi_device.h	2004-08-17 20:42:18 +02:00
@@ -129,8 +129,10 @@
 #define transport_class_to_sdev(class_dev) \
 	container_of(class_dev, struct scsi_device, transport_classdev)
 
-extern struct scsi_device *scsi_add_device(struct Scsi_Host *,
-		uint, uint, uint);
+extern struct scsi_device *__scsi_add_device(struct Scsi_Host *,
+		uint, uint, uint, void *hostdata);
+#define scsi_add_device(host, channel, target, lun) \
+	__scsi_add_device(host, channel, target, lun, NULL)
 extern void scsi_remove_device(struct scsi_device *);
 extern int scsi_device_cancel(struct scsi_device *, int);
 

  parent reply	other threads:[~2004-08-17 16:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-15 10:15 Merge I2O patches from -mm Warren Togami
2004-08-17  2:15 ` Andrew Morton
2004-08-17  8:36   ` Markus Lidel
2004-08-17 11:53 ` Christoph Hellwig
2004-08-17 13:31   ` Markus Lidel
2004-08-17 14:00     ` Alan Cox
2004-08-17 15:06       ` Christoph Hellwig
2004-08-17 14:50         ` Alan Cox
2004-08-17 15:17     ` Christoph Hellwig
2004-08-17 17:05       ` Markus Lidel
2004-08-17 16:56     ` Christoph Hellwig [this message]
2004-08-17 18:37       ` Markus Lidel
  -- strict thread matches above, loose matches on Subject: below --
2004-08-18 23:08 Markus Lidel
2004-08-18 23:24 ` Christoph Hellwig
2004-08-18 23:33   ` Markus Lidel
2004-08-19  9:48     ` Christoph Hellwig
2004-08-19 10:16       ` Markus Lidel
2004-08-19 10:06         ` Christoph Hellwig
2004-08-19 11:54           ` Markus Lidel
2004-08-23 17:55             ` Christoph Hellwig
2004-08-24  8:16               ` Markus Lidel
2004-08-24 12:45                 ` Christoph Hellwig
2004-08-24 16:00                   ` Markus Lidel
2004-08-28 10:13                     ` Warren Togami

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=20040817175624.A24038@infradead.org \
    --to=hch@infradead.org \
    --cc=Markus.Lidel@shadowconnect.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wtogami@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.