[patch 11/94] tx493[89]ide: Fix length for __ide_flush_dcache_range

From: Greg KH
Date: Thu Jan 15 2009 - 15:06:46 EST


2.6.28-stable review patch. If anyone has any objections, please let us know.

------------------

From: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>

commit f26f6ceacaaf017a677138cbca7ab076b565ca87 upstream.

This fixes data corruption on PIO mode.

Signed-off-by: Atsushi Nemoto <anemo@xxxxxxxxxxxxx>
Cc: sshtylyov@xxxxxxxxxxxxx
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/ide/tx4938ide.c | 4 ++--
drivers/ide/tx4939ide.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -181,7 +181,7 @@ static void tx4938ide_input_data_swap(id

while (count--)
*ptr++ = cpu_to_le16(__raw_readw((void __iomem *)port));
- __ide_flush_dcache_range((unsigned long)buf, count * 2);
+ __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2));
}

static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq,
@@ -195,7 +195,7 @@ static void tx4938ide_output_data_swap(i
__raw_writew(le16_to_cpu(*ptr), (void __iomem *)port);
ptr++;
}
- __ide_flush_dcache_range((unsigned long)buf, count * 2);
+ __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2));
}

static const struct ide_tp_ops tx4938ide_tp_ops = {
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -558,7 +558,7 @@ static void tx4939ide_input_data_swap(id

while (count--)
*ptr++ = cpu_to_le16(__raw_readw((void __iomem *)port));
- __ide_flush_dcache_range((unsigned long)buf, count * 2);
+ __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2));
}

static void tx4939ide_output_data_swap(ide_drive_t *drive, struct request *rq,
@@ -572,7 +572,7 @@ static void tx4939ide_output_data_swap(i
__raw_writew(le16_to_cpu(*ptr), (void __iomem *)port);
ptr++;
}
- __ide_flush_dcache_range((unsigned long)buf, count * 2);
+ __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2));
}

static const struct ide_tp_ops tx4939ide_tp_ops = {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/