summaryrefslogtreecommitdiff
path: root/drivers/staging/rts_pstor/rtsx.h
diff options
context:
space:
mode:
authorwwang <wei_wang@realsil.com.cn>2011-08-03 08:00:25 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-08 19:05:34 (GMT)
commitf704648281831fbb8a4ca1acbe18cb84bc0267c8 (patch)
tree72ebfc90791c35e417cec393b225ce68dae5b2d1 /drivers/staging/rts_pstor/rtsx.h
parentf8d73aa362cec89e3379bdcdae54cc46e0a6b34d (diff)
downloadlinux-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.h9
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;