summaryrefslogtreecommitdiff
path: root/firmware/drivers/ata.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/ata.c')
-rw-r--r--firmware/drivers/ata.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 00a7c3e19a..e3fa3e8958 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -71,7 +71,7 @@
71#endif 71#endif
72 72
73#ifdef ATA_DRIVER_CLOSE 73#ifdef ATA_DRIVER_CLOSE
74static struct thread_entry *ata_thread_p = NULL; 74static unsigned int ata_thread_id = 0;
75#endif 75#endif
76 76
77#if defined(MAX_PHYS_SECTOR_SIZE) && MEM == 64 77#if defined(MAX_PHYS_SECTOR_SIZE) && MEM == 64
@@ -94,7 +94,8 @@ static void ata_lock_init(struct ata_lock *l)
94 94
95static void ata_lock_lock(struct ata_lock *l) 95static void ata_lock_lock(struct ata_lock *l)
96{ 96{
97 struct thread_entry * const current = thread_get_current(); 97 struct thread_entry * const current =
98 thread_id_entry(THREAD_ID_CURRENT);
98 99
99 if (current == l->thread) 100 if (current == l->thread)
100 { 101 {
@@ -1350,7 +1351,7 @@ int ata_init(void)
1350 1351
1351 last_disk_activity = current_tick; 1352 last_disk_activity = current_tick;
1352#ifdef ATA_DRIVER_CLOSE 1353#ifdef ATA_DRIVER_CLOSE
1353 ata_thread_p = 1354 ata_thread_id =
1354#endif 1355#endif
1355 create_thread(ata_thread, ata_stack, 1356 create_thread(ata_thread, ata_stack,
1356 sizeof(ata_stack), 0, ata_thread_name 1357 sizeof(ata_stack), 0, ata_thread_name
@@ -1370,15 +1371,15 @@ int ata_init(void)
1370#ifdef ATA_DRIVER_CLOSE 1371#ifdef ATA_DRIVER_CLOSE
1371void ata_close(void) 1372void ata_close(void)
1372{ 1373{
1373 struct thread_entry *thread = ata_thread_p; 1374 unsigned int thread_id = ata_thread_id;
1374 1375
1375 if (thread == NULL) 1376 if (thread_id == 0)
1376 return; 1377 return;
1377 1378
1378 ata_thread_p = NULL; 1379 ata_thread_id = 0;
1379 1380
1380 queue_post(&ata_queue, Q_CLOSE, 0); 1381 queue_post(&ata_queue, Q_CLOSE, 0);
1381 thread_wait(thread); 1382 thread_wait(thread_id);
1382} 1383}
1383#endif /* ATA_DRIVER_CLOSE */ 1384#endif /* ATA_DRIVER_CLOSE */
1384 1385