From 8cfbd3604fac14f629244e521ad24ffa9938c790 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 10 Dec 2008 08:57:10 +0000 Subject: Use cookies for thread identification instead of pointers directly which gives a buffer against wrongly identifying a thread when the slot is recycled (which has been nagging me for awhile). A slot gets 255 uses before it repeats. Everything gets incompatible so a full update is required. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19377 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'firmware/target') diff --git a/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c b/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c index c185994bfc..81849d0852 100644 --- a/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c @@ -69,7 +69,7 @@ static const unsigned char pmic_ints_regs[2] = #ifdef PMIC_DRIVER_CLOSE static bool pmic_close = false; -static struct thread_entry *mc13783_thread_p = NULL; +static unsigned int mc13783_thread_id = 0; #endif static void mc13783_interrupt_thread(void) @@ -149,7 +149,7 @@ void mc13783_init(void) MC13783_GPIO_ISR = (1ul << MC13783_GPIO_LINE); #ifdef PMIC_DRIVER_CLOSE - mc13783_thread_p = + mc13783_thread_id = #endif create_thread(mc13783_interrupt_thread, mc13783_thread_stack, sizeof(mc13783_thread_stack), 0, @@ -159,16 +159,16 @@ void mc13783_init(void) #ifdef PMIC_DRIVER_CLOSE void mc13783_close(void) { - struct thread_entry *thread = mc13783_thread_p; + unsigned int thread_id = mc13783_thread_p; - if (thread == NULL) + if (thread_id == 0) return; - mc13783_thread_p = NULL; + mc13783_thread_id = 0; pmic_close = true; wakeup_signal(&mc13783_wake); - thread_wait(thread); + thread_wait(thread_id); } #endif /* PMIC_DRIVER_CLOSE */ -- cgit v1.2.3