Received: from mail.onstor.com (66.201.51.107) by exch1.onstor.net
 (10.0.0.225) with Microsoft SMTP Server id 8.1.311.2; Thu, 25 Dec 2008
 06:34:01 -0800
Received: from ausesmta2-2.messageone.com ([64.20.241.45]) by mail.onstor.com
 with Microsoft SMTPSVC(6.0.3790.3959);	 Thu, 25 Dec 2008 06:34:00 -0800
Received: from ftp.linux-mips.org (ftp.linux-mips.org [213.58.128.207])	by
 ausesmta2-2.messageone.com (8.13.8/8.13.8) with ESMTP id mBPEXw5U031953	for
 <andy.sharp@onstor.com>; Thu, 25 Dec 2008 08:33:59 -0600
Received: from localhost.localdomain ([127.0.0.1]:6027 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP	id S24132650AbYLYOdZ
 (ORCPT <rfc822;andy.sharp@onstor.com>);	Thu, 25 Dec 2008 14:33:25 +0000
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 25 Dec 2008 14:33:08
 +0000 (GMT)
Received: from mba.ocn.ne.jp ([122.1.235.107]:57583 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S24207579AbYLYOcp (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 25 Dec 2008 14:32:45 +0000
Received: from localhost.localdomain (p5019-ipad204funabasi.chiba.ocn.ne.jp
 [222.146.92.19])	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP	id 641A7A4DC;
 Thu, 25 Dec 2008 23:32:39 +0900 (JST)
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
To: "linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>
CC: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>, "sshtylyov@ru.mvista.com"
	<sshtylyov@ru.mvista.com>, "linux-mips@linux-mips.org"
	<linux-mips@linux-mips.org>, stable <stable@kernel.org>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Thu, 25 Dec 2008 06:32:38 -0800
Subject: [PATCH] tx493[89]ide: Fix length for __ide_flush_dcache_range
Thread-Topic: [PATCH] tx493[89]ide: Fix length for __ide_flush_dcache_range
Thread-Index: AclmndRBYYT3ZF/bRp2adoFiNGby+g==
Message-ID: <1230215558-9197-2-git-send-email-anemo@mba.ocn.ne.jp>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 0b
X-MS-Exchange-Organization-AuthSource: exch1.onstor.net
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-originalarrivaltime: 25 Dec 2008 14:34:00.0600 (UTC)
 FILETIME=[D3CB8980:01C9669D]
errors-to: linux-mips-bounce@linux-mips.org
x-ems-proccessed: 2K3Xl1OQTInXD6xxuA8z3Q==
x-ems-stamp: Q13mCsGo1MJfbz8+7tll6Q==
x-messageone-virus-version: vendor=fsecure
 engine=4.65.7400:2.4.4,1.2.40,4.0.164
 definitions=2008-12-25_02:2008-12-22,2008-12-25,2008-12-24 signatures=0
x-messageone-virus-scanned: Clean
x-messageone-envelope-sender: linux-mips-bounce@linux-mips.org
x-messageone-spam-details: rule=m773emszm_notspam policy=m773emszm score=0
 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam
 adjust=0 reason=mlx engine=3.1.0-0810130000 definitions=main-0812250055
x-messageone-spam-score: 0
x-messageone-spam-bar:
x-list: linux-mips
x-archive-position: 21669
x-ecartis-version: Ecartis v1.0.0
x-original-sender: anemo@mba.ocn.ne.jp
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

This fixes data corruption on PIO mode.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: stable <stable@kernel.org>
---
 drivers/ide/tx4938ide.c |    4 ++--
 drivers/ide/tx4939ide.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index 9120063..13b63e7 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -181,7 +181,7 @@ static void tx4938ide_input_data_swap(ide_drive_t *driv=
e, struct request *rq,
=20
 	while (count--)
 		*ptr++ =3D 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));
 }
=20
 static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request =
*rq,
@@ -195,7 +195,7 @@ static void tx4938ide_output_data_swap(ide_drive_t *dri=
ve, struct request *rq,
 		__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));
 }
=20
 static const struct ide_tp_ops tx4938ide_tp_ops =3D {
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index 30d0d25..97cd9e0 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -564,7 +564,7 @@ static void tx4939ide_input_data_swap(ide_drive_t *driv=
e, struct request *rq,
=20
 	while (count--)
 		*ptr++ =3D 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));
 }
=20
 static void tx4939ide_output_data_swap(ide_drive_t *drive, struct request =
*rq,
@@ -578,7 +578,7 @@ static void tx4939ide_output_data_swap(ide_drive_t *dri=
ve, struct request *rq,
 		__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));
 }
=20
 static const struct ide_tp_ops tx4939ide_tp_ops =3D {
--=20
1.5.6.3


