* [PATCH] pata_jmicron: fix disabled port handling in jmicron_pre_reset()
@ 2007-11-19 9:06 Tejun Heo
2007-11-22 5:06 ` Tejun Heo
2007-11-24 0:24 ` Jeff Garzik
0 siblings, 2 replies; 3+ messages in thread
From: Tejun Heo @ 2007-11-19 9:06 UTC (permalink / raw)
To: Jeff Garzik, linux-ide, Alan Cox
There are two bugs in disabled port handling.
* test in PORT_PATA0 is reversed
* ->prereset should return -ENOENT for disabled ports not 0
The first bug makes the PATA channel considered disabled but the
second bug saves the day by returning 0. The net result is that cable
is always left at ATA_CBL_UNKNOWN. This results in false 80c
configuration and thus transfer errors.
This patch fixes both bugs.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
applied to #tj-upstream-fixes.
drivers/ata/pata_jmicron.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 225a722..5b8174d 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -80,11 +80,10 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
* actually do our cable checking etc. Thankfully we don't need
* to do the plumbing for other cases.
*/
- switch (port_map[port])
- {
+ switch (port_map[port]) {
case PORT_PATA0:
- if (control & (1 << 5))
- return 0;
+ if ((control & (1 << 5)) == 0)
+ return -ENOENT;
if (control & (1 << 3)) /* 40/80 pin primary */
ap->cbl = ATA_CBL_PATA40;
else
@@ -93,7 +92,7 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline)
case PORT_PATA1:
/* Bit 21 is set if the port is enabled */
if ((control5 & (1 << 21)) == 0)
- return 0;
+ return -ENOENT;
if (control5 & (1 << 19)) /* 40/80 pin secondary */
ap->cbl = ATA_CBL_PATA40;
else
--
1.5.2.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] pata_jmicron: fix disabled port handling in jmicron_pre_reset()
2007-11-19 9:06 [PATCH] pata_jmicron: fix disabled port handling in jmicron_pre_reset() Tejun Heo
@ 2007-11-22 5:06 ` Tejun Heo
2007-11-24 0:24 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2007-11-22 5:06 UTC (permalink / raw)
To: Jeff Garzik, linux-ide, Alan Cox
Tejun Heo wrote:
> There are two bugs in disabled port handling.
>
> * test in PORT_PATA0 is reversed
> * ->prereset should return -ENOENT for disabled ports not 0
>
> The first bug makes the PATA channel considered disabled but the
> second bug saves the day by returning 0. The net result is that cable
> is always left at ATA_CBL_UNKNOWN. This results in false 80c
> configuration and thus transfer errors.
>
> This patch fixes both bugs.
>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
Jeff, this wasn't pushed to Linus. Can you please put this into
#upstream-fixes?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pata_jmicron: fix disabled port handling in jmicron_pre_reset()
2007-11-19 9:06 [PATCH] pata_jmicron: fix disabled port handling in jmicron_pre_reset() Tejun Heo
2007-11-22 5:06 ` Tejun Heo
@ 2007-11-24 0:24 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2007-11-24 0:24 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-ide, Alan Cox
Tejun Heo wrote:
> There are two bugs in disabled port handling.
>
> * test in PORT_PATA0 is reversed
> * ->prereset should return -ENOENT for disabled ports not 0
>
> The first bug makes the PATA channel considered disabled but the
> second bug saves the day by returning 0. The net result is that cable
> is always left at ATA_CBL_UNKNOWN. This results in false 80c
> configuration and thus transfer errors.
>
> This patch fixes both bugs.
>
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
> applied to #tj-upstream-fixes.
>
> drivers/ata/pata_jmicron.c | 9 ++++-----
> 1 files changed, 4 insertions(+), 5 deletions(-)
applied
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-11-24 0:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-19 9:06 [PATCH] pata_jmicron: fix disabled port handling in jmicron_pre_reset() Tejun Heo
2007-11-22 5:06 ` Tejun Heo
2007-11-24 0:24 ` Jeff Garzik
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).