mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
libata: clear dev->ering in smarter way
dev->ering used to be cleared together with the rest of ata_device in ata_dev_init() which is called whenever a probing event occurs. dev->ering is about to be used to track probing failures so it needs to remain persistent over multiple porbing events. This patch achieves this by doing the following. * Instead of CLEAR_OFFSET, define CLEAR_BEGIN and CLEAR_END and only clear between BEGIN and END. ering is moved after END. The split of persistent area is to allow hotter items remain at the head. * ering is explicitly cleared on ata_dev_disable() and when device attach succeeds. So, ering is persistent throug a device's life time (unless explicitly cleared of course) and also through periods inbetween disablement of an attached device and successful detection of the next one. Signed-off-by: Tejun Heo <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
This commit is contained in:
parent
9913ff8abf
commit
99cf610aa4
3 changed files with 19 additions and 10 deletions
|
|
@ -5404,8 +5404,8 @@ void ata_dev_init(struct ata_device *dev)
|
|||
dev->horkage = 0;
|
||||
spin_unlock_irqrestore(ap->lock, flags);
|
||||
|
||||
memset((void *)dev + ATA_DEVICE_CLEAR_OFFSET, 0,
|
||||
sizeof(*dev) - ATA_DEVICE_CLEAR_OFFSET);
|
||||
memset((void *)dev + ATA_DEVICE_CLEAR_BEGIN, 0,
|
||||
ATA_DEVICE_CLEAR_END - ATA_DEVICE_CLEAR_BEGIN);
|
||||
dev->pio_mask = UINT_MAX;
|
||||
dev->mwdma_mask = UINT_MAX;
|
||||
dev->udma_mask = UINT_MAX;
|
||||
|
|
|
|||
|
|
@ -1194,6 +1194,11 @@ void ata_dev_disable(struct ata_device *dev)
|
|||
ata_acpi_on_disable(dev);
|
||||
ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET);
|
||||
dev->class++;
|
||||
|
||||
/* From now till the next successful probe, ering is used to
|
||||
* track probe failures. Clear accumulated device error info.
|
||||
*/
|
||||
ata_ering_clear(&dev->ering);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2765,6 +2770,8 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
|
|||
readid_flags, dev->id);
|
||||
switch (rc) {
|
||||
case 0:
|
||||
/* clear error info accumulated during probe */
|
||||
ata_ering_clear(&dev->ering);
|
||||
new_mask |= 1 << dev->devno;
|
||||
break;
|
||||
case -ENOENT:
|
||||
|
|
|
|||
Loading…
Reference in a new issue