diff options
Diffstat (limited to 'drivers/scsi/libata-eh.c')
-rw-r--r-- | drivers/scsi/libata-eh.c | 63 |
1 files changed, 37 insertions, 26 deletions
diff --git a/drivers/scsi/libata-eh.c b/drivers/scsi/libata-eh.c index 823385981a7a..bf5a72aca8a4 100644 --- a/drivers/scsi/libata-eh.c +++ b/drivers/scsi/libata-eh.c | |||
@@ -93,6 +93,38 @@ static int ata_ering_map(struct ata_ering *ering, | |||
93 | return rc; | 93 | return rc; |
94 | } | 94 | } |
95 | 95 | ||
96 | static unsigned int ata_eh_dev_action(struct ata_device *dev) | ||
97 | { | ||
98 | struct ata_eh_context *ehc = &dev->ap->eh_context; | ||
99 | |||
100 | return ehc->i.action | ehc->i.dev_action[dev->devno]; | ||
101 | } | ||
102 | |||
103 | static void ata_eh_clear_action(struct ata_device *dev, | ||
104 | struct ata_eh_info *ehi, unsigned int action) | ||
105 | { | ||
106 | int i; | ||
107 | |||
108 | if (!dev) { | ||
109 | ehi->action &= ~action; | ||
110 | for (i = 0; i < ATA_MAX_DEVICES; i++) | ||
111 | ehi->dev_action[i] &= ~action; | ||
112 | } else { | ||
113 | /* doesn't make sense for port-wide EH actions */ | ||
114 | WARN_ON(!(action & ATA_EH_PERDEV_MASK)); | ||
115 | |||
116 | /* break ehi->action into ehi->dev_action */ | ||
117 | if (ehi->action & action) { | ||
118 | for (i = 0; i < ATA_MAX_DEVICES; i++) | ||
119 | ehi->dev_action[i] |= ehi->action & action; | ||
120 | ehi->action &= ~action; | ||
121 | } | ||
122 | |||
123 | /* turn off the specified per-dev action */ | ||
124 | ehi->dev_action[dev->devno] &= ~action; | ||
125 | } | ||
126 | } | ||
127 | |||
96 | /** | 128 | /** |
97 | * ata_scsi_timed_out - SCSI layer time out callback | 129 | * ata_scsi_timed_out - SCSI layer time out callback |
98 | * @cmd: timed out SCSI command | 130 | * @cmd: timed out SCSI command |
@@ -702,32 +734,11 @@ static void ata_eh_detach_dev(struct ata_device *dev) | |||
702 | ap->flags |= ATA_FLAG_SCSI_HOTPLUG; | 734 | ap->flags |= ATA_FLAG_SCSI_HOTPLUG; |
703 | } | 735 | } |
704 | 736 | ||
705 | spin_unlock_irqrestore(ap->lock, flags); | 737 | /* clear per-dev EH actions */ |
706 | } | 738 | ata_eh_clear_action(dev, &ap->eh_info, ATA_EH_PERDEV_MASK); |
707 | 739 | ata_eh_clear_action(dev, &ap->eh_context.i, ATA_EH_PERDEV_MASK); | |
708 | static void ata_eh_clear_action(struct ata_device *dev, | ||
709 | struct ata_eh_info *ehi, unsigned int action) | ||
710 | { | ||
711 | int i; | ||
712 | 740 | ||
713 | if (!dev) { | 741 | spin_unlock_irqrestore(ap->lock, flags); |
714 | ehi->action &= ~action; | ||
715 | for (i = 0; i < ATA_MAX_DEVICES; i++) | ||
716 | ehi->dev_action[i] &= ~action; | ||
717 | } else { | ||
718 | /* doesn't make sense for port-wide EH actions */ | ||
719 | WARN_ON(!(action & ATA_EH_PERDEV_MASK)); | ||
720 | |||
721 | /* break ehi->action into ehi->dev_action */ | ||
722 | if (ehi->action & action) { | ||
723 | for (i = 0; i < ATA_MAX_DEVICES; i++) | ||
724 | ehi->dev_action[i] |= ehi->action & action; | ||
725 | ehi->action &= ~action; | ||
726 | } | ||
727 | |||
728 | /* turn off the specified per-dev action */ | ||
729 | ehi->dev_action[dev->devno] &= ~action; | ||
730 | } | ||
731 | } | 742 | } |
732 | 743 | ||
733 | /** | 744 | /** |
@@ -1592,7 +1603,7 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
1592 | unsigned int action; | 1603 | unsigned int action; |
1593 | 1604 | ||
1594 | dev = &ap->device[i]; | 1605 | dev = &ap->device[i]; |
1595 | action = ehc->i.action | ehc->i.dev_action[dev->devno]; | 1606 | action = ata_eh_dev_action(dev); |
1596 | 1607 | ||
1597 | if (action & ATA_EH_REVALIDATE && ata_dev_enabled(dev)) { | 1608 | if (action & ATA_EH_REVALIDATE && ata_dev_enabled(dev)) { |
1598 | if (ata_port_offline(ap)) { | 1609 | if (ata_port_offline(ap)) { |