forked from len0rd/rockbox
Fixed a race condition between sleep thread and spinup code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2958 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
30df1a38e7
commit
bd0da0e822
1 changed files with 9 additions and 13 deletions
|
@ -186,8 +186,6 @@ int ata_read_sectors(unsigned long start,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sleeping = false;
|
|
||||||
poweroff = false;
|
|
||||||
spinup = true;
|
spinup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,16 +224,18 @@ int ata_read_sectors(unsigned long start,
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spinup) {
|
|
||||||
ata_spinup_time = current_tick - last_disk_activity;
|
|
||||||
spinup = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ATA_ALT_STATUS & (STATUS_ERR | STATUS_DF) ) {
|
if ( ATA_ALT_STATUS & (STATUS_ERR | STATUS_DF) ) {
|
||||||
ret = -5;
|
ret = -5;
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (spinup) {
|
||||||
|
ata_spinup_time = current_tick - last_disk_activity;
|
||||||
|
spinup = false;
|
||||||
|
sleeping = false;
|
||||||
|
poweroff = false;
|
||||||
|
}
|
||||||
|
|
||||||
/* if destination address is odd, use byte copying,
|
/* if destination address is odd, use byte copying,
|
||||||
otherwise use word copying */
|
otherwise use word copying */
|
||||||
|
|
||||||
|
@ -314,8 +314,6 @@ int ata_write_sectors(unsigned long start,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sleeping = false;
|
|
||||||
poweroff = false;
|
|
||||||
spinup = true;
|
spinup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,6 +347,8 @@ int ata_write_sectors(unsigned long start,
|
||||||
if (spinup) {
|
if (spinup) {
|
||||||
ata_spinup_time = current_tick - last_disk_activity;
|
ata_spinup_time = current_tick - last_disk_activity;
|
||||||
spinup = false;
|
spinup = false;
|
||||||
|
sleeping = false;
|
||||||
|
poweroff = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j=0; j<SECTOR_SIZE/2; j++)
|
for (j=0; j<SECTOR_SIZE/2; j++)
|
||||||
|
@ -563,7 +563,6 @@ int ata_hard_reset(void)
|
||||||
/* Massage the return code so it is 0 on success and -1 on failure */
|
/* Massage the return code so it is 0 on success and -1 on failure */
|
||||||
ret = ret?0:-1;
|
ret = ret?0:-1;
|
||||||
|
|
||||||
sleeping = false;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,7 +588,6 @@ static int perform_soft_reset(void)
|
||||||
/* Massage the return code so it is 0 on success and -1 on failure */
|
/* Massage the return code so it is 0 on success and -1 on failure */
|
||||||
ret = ret?0:-1;
|
ret = ret?0:-1;
|
||||||
|
|
||||||
sleeping = false;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,8 +615,6 @@ static int ata_power_on(void)
|
||||||
if (freeze_lock())
|
if (freeze_lock())
|
||||||
return -3;
|
return -3;
|
||||||
|
|
||||||
sleeping = false;
|
|
||||||
poweroff = false;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue