linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cleanup switch in scsi_adjust_queue_depth()
@ 2014-06-24 23:23 Douglas Gilbert
  2014-06-26  2:14 ` Martin K. Petersen
  2014-07-01 20:40 ` Elliott, Robert (Server Storage)
  0 siblings, 2 replies; 3+ messages in thread
From: Douglas Gilbert @ 2014-06-24 23:23 UTC (permalink / raw)
  To: SCSI development list, Christoph Hellwig, James Bottomley

[-- Attachment #1: Type: text/plain, Size: 276 bytes --]

While checking what scsi_adjust_queue_depth() did I
thought its switch statement could be clearer.

ChangeLog:
   - remove redundant assignment (to sdev->queue_depth)
   - re-order cases (thus removing the fall-through)

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>

[-- Attachment #2: scsi_adjust_queue_depth1.patch --]
[-- Type: text/x-patch, Size: 873 bytes --]

--- linux-3.15/drivers/scsi/scsi.c3151	2014-06-08 21:36:43.815551129 -0400
+++ linux-3.15/drivers/scsi/scsi.c	2014-06-24 19:17:02.474464807 -0400
@@ -850,6 +850,10 @@ void scsi_adjust_queue_depth(struct scsi
 
 	sdev->queue_depth = tags;
 	switch (tagged) {
+		case 0:
+			sdev->ordered_tags = 0;
+			sdev->simple_tags = 0;
+			break;
 		case MSG_ORDERED_TAG:
 			sdev->ordered_tags = 1;
 			sdev->simple_tags = 1;
@@ -859,13 +863,11 @@ void scsi_adjust_queue_depth(struct scsi
 			sdev->simple_tags = 1;
 			break;
 		default:
+			sdev->ordered_tags = 0;
+			sdev->simple_tags = 0;
 			sdev_printk(KERN_WARNING, sdev,
 				    "scsi_adjust_queue_depth, bad queue type, "
 				    "disabled\n");
-		case 0:
-			sdev->ordered_tags = sdev->simple_tags = 0;
-			sdev->queue_depth = tags;
-			break;
 	}
  out:
 	spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-01 20:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-24 23:23 [PATCH] cleanup switch in scsi_adjust_queue_depth() Douglas Gilbert
2014-06-26  2:14 ` Martin K. Petersen
2014-07-01 20:40 ` Elliott, Robert (Server Storage)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).