diff options
author | wwang <wei_wang@realsil.com.cn> | 2011-08-03 08:00:25 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-08 19:05:34 (GMT) |
commit | f704648281831fbb8a4ca1acbe18cb84bc0267c8 (patch) | |
tree | 72ebfc90791c35e417cec393b225ce68dae5b2d1 /drivers/staging/rts_pstor/rtsx.h | |
parent | f8d73aa362cec89e3379bdcdae54cc46e0a6b34d (diff) | |
download | linux-fsl-qoriq-f704648281831fbb8a4ca1acbe18cb84bc0267c8.tar.xz |
staging:rts_pstor: fix thread synchronization flow
Using different completion variables to synchronize different kernel threads
This patch fix a bug that may cause memory leak when driver
disconnected. This is not a very urgent bug. Because with the default
setting, driver disconnectting routine won't be called except when Linux
is shut down. But if the option auto_delink_en is set, a small number of
memory would leak out after memory card unplugged.
Signed-off-by: wwang <wei_wang@realsil.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rts_pstor/rtsx.h')
-rw-r--r-- | drivers/staging/rts_pstor/rtsx.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/staging/rts_pstor/rtsx.h b/drivers/staging/rts_pstor/rtsx.h index 247615b..86e47c2 100644 --- a/drivers/staging/rts_pstor/rtsx.h +++ b/drivers/staging/rts_pstor/rtsx.h @@ -112,9 +112,16 @@ struct rtsx_dev { /* locks */ spinlock_t reg_lock; + struct task_struct *ctl_thread; /* the control thread */ + struct task_struct *polling_thread; /* the polling thread */ + /* mutual exclusion and synchronization structures */ - struct semaphore sema; /* to sleep thread on */ + struct completion cmnd_ready; /* to sleep thread on */ + struct completion control_exit; /* control thread exit */ + struct completion polling_exit; /* polling thread exit */ struct completion notify; /* thread begin/end */ + struct completion scanning_done; /* wait for scan thread */ + wait_queue_head_t delay_wait; /* wait during scan, reset */ struct mutex dev_mutex; |