linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH #upstream-fixes 1/4] libata: fix device iteration bugs
@ 2008-10-26  6:50 Tejun Heo
  2008-10-26 10:47 ` Sergei Shtylyov
  0 siblings, 1 reply; 42+ messages in thread
From: Tejun Heo @ 2008-10-26  6:50 UTC (permalink / raw)
  To: Jeff Garzik, IDE/ATA development list

There were several places where only enabled devices should be
iterated over but device enabledness wasn't checked.

* IDENTIFY data 40 wire check in cable_is_40wire()
* xfer_mode/ncq_enabled saving in ata_scsi_error()
* DUBIOUS_XFER handling in ata_set_mode()

While at it, reformat comment in cable_is_40wire().

Signed-off-by: Tejun Heo <tj@kernel.org>
---
Jeff, this four patch series fixes iteration bugs and improves
iterators and fix ata_port_detach() related bugs.  The iterator change
is a bit big for #upstream-fixes but it's fairly straight forward and
I verified them in most combinations, so it should be pretty safe.

Thanks.

 drivers/ata/libata-core.c |   18 ++++++++----------
 drivers/ata/libata-eh.c   |    9 +++++++++
 2 files changed, 17 insertions(+), 10 deletions(-)

Index: work/drivers/ata/libata-core.c
===================================================================
--- work.orig/drivers/ata/libata-core.c
+++ work/drivers/ata/libata-core.c
@@ -4169,18 +4169,16 @@ static int cable_is_40wire(struct ata_po
 	if (ap->cbl == ATA_CBL_PATA40_SHORT)
 		return 0;
 	/* If the controller doesn't know we scan
-
-	   - Note: We look for all 40 wire detects at this point.
-	     Any 80 wire detect is taken to be 80 wire cable
-	     because
-	     - In many setups only the one drive (slave if present)
-               will give a valid detect
-             - If you have a non detect capable drive you don't
-               want it to colour the choice
-        */
+	 *
+	 * - Note: We look for all 40 wire detects at this point.  Any
+	 *   80 wire detect is taken to be 80 wire cable because - In
+	 *   many setups only the one drive (slave if present) will
+	 *   give a valid detect - If you have a non detect capable
+	 *   drive you don't want it to colour the choice
+	 */
 	ata_port_for_each_link(link, ap) {
 		ata_link_for_each_dev(dev, link) {
-			if (!ata_is_40wire(dev))
+			if (ata_dev_enabled(dev) && !ata_is_40wire(dev))
 				return 0;
 		}
 	}
Index: work/drivers/ata/libata-eh.c
===================================================================
--- work.orig/drivers/ata/libata-eh.c
+++ work/drivers/ata/libata-eh.c
@@ -603,6 +603,9 @@ void ata_scsi_error(struct Scsi_Host *ho
 			ata_link_for_each_dev(dev, link) {
 				int devno = dev->devno;
 
+				if (!ata_dev_enabled(dev))
+					continue;
+
 				ehc->saved_xfer_mode[devno] = dev->xfer_mode;
 				if (ata_ncq_enabled(dev))
 					ehc->saved_ncq_enabled |= 1 << devno;
@@ -2790,6 +2793,9 @@ int ata_set_mode(struct ata_link *link,
 
 	/* if data transfer is verified, clear DUBIOUS_XFER on ering top */
 	ata_link_for_each_dev(dev, link) {
+		if (!ata_dev_enabled(dev))
+			continue;
+
 		if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) {
 			struct ata_ering_entry *ent;
 
@@ -2811,6 +2817,9 @@ int ata_set_mode(struct ata_link *link,
 		u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno];
 		u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno));
 
+		if (!ata_dev_enabled(dev))
+			continue;
+
 		if (dev->xfer_mode != saved_xfer_mode ||
 		    ata_ncq_enabled(dev) != saved_ncq)
 			dev->flags |= ATA_DFLAG_DUBIOUS_XFER;

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

end of thread, other threads:[~2008-11-16 11:23 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <6ca8fe89c868f95831328d31c27f9cdb@localhost>
2008-10-27 15:45 ` Fwd: [PATCH #upstream-fixes 1/4] libata: fix device iteration bugs Guntsche Michael
2008-11-10  6:52   ` Tejun Heo
2008-11-10 10:10     ` Michael Guntsche
2008-11-10 10:21       ` Tejun Heo
2008-11-10 15:07         ` Mark Lord
2008-11-11  2:45           ` Tejun Heo
2008-11-11  4:01             ` Mark Lord
2008-11-11  9:19               ` Sergei Shtylyov
2008-11-11 13:34                 ` Michael Guntsche
2008-11-11 14:29                   ` Mark Lord
2008-11-11 15:03                     ` Guntsche Michael
2008-11-12  1:20                       ` Mark Lord
2008-11-12  2:34                         ` Tejun Heo
2008-11-12  7:22                           ` Michael Guntsche
2008-11-12  8:15                             ` Tejun Heo
2008-11-12  9:16                               ` Michael Guntsche
2008-11-12  9:27                                 ` Tejun Heo
2008-11-12  9:43                                   ` Michael Guntsche
2008-11-12  9:48                                     ` Tejun Heo
2008-11-12  9:55                                       ` Michael Guntsche
2008-11-14  2:38                                         ` Mark Lord
2008-11-14  6:59                                           ` Michael Guntsche
2008-11-14 17:21                                             ` Mark Lord
2008-11-14 17:24                                               ` Mark Lord
2008-11-14 22:26                                                 ` Guntsche Michael
2008-11-15  4:13                                                   ` Mark Lord
2008-11-15  4:17                                                     ` Mark Lord
2008-11-15  9:29                                                       ` Guntsche Michael
2008-11-15 10:22                                                       ` Guntsche Michael
2008-11-15 20:43                                                         ` Mark Lord
2008-11-16  5:14                                                           ` Tejun Heo
2008-11-16  5:49                                                             ` Mark Lord
2008-11-16  8:41                                                               ` Michael Guntsche
2008-11-16  9:15                                                               ` Michael Guntsche
2008-11-16 10:48                                                               ` Sergei Shtylyov
2008-11-16 11:23                                                               ` Alan Cox
2008-11-11 14:27                 ` Fwd: " Mark Lord
2008-11-11 14:34                   ` Alan Cox
2008-11-12  1:18                     ` Mark Lord
2008-10-26  6:50 Tejun Heo
2008-10-26 10:47 ` Sergei Shtylyov
2008-10-27  9:07   ` Tejun Heo

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).