diff options
author | Binoy Jayan <binoy.jayan@linaro.org> | 2016-06-06 04:38:06 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-21 16:14:51 (GMT) |
commit | f18c566e4e1b9c95367d4f997c3c2d51a3559395 (patch) | |
tree | 4b06b5d270f85272233e6a8c6ce083f8f641152a /drivers/staging/rtl8188eu/include | |
parent | 16677cca770d659434aaa860f12d418b68adac31 (diff) | |
download | linux-f18c566e4e1b9c95367d4f997c3c2d51a3559395.tar.xz |
rtl8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex
The semaphore 'lock' in pwrctrl_priv is a simple mutex, so it should
be written as one. Semaphores are going away in the future.
_enter_pwrlock was using down_interruptible(), so the lock could be broken
by sending a signal. This could be a bug, because nothing checks the return
code here. Hence, using mutex_lock instead of the interruptible version.
Also, remove the now unused wrappers _init_pwrlock, _enter_pwrlock,
_exit_pwrlock and _rtw_down_sema.
Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8188eu/include')
-rw-r--r-- | drivers/staging/rtl8188eu/include/osdep_service.h | 3 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/include/rtw_event.h | 1 | ||||
-rw-r--r-- | drivers/staging/rtl8188eu/include/rtw_pwrctrl.h | 17 |
3 files changed, 3 insertions, 18 deletions
diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h index 5475956..c53c9ea 100644 --- a/drivers/staging/rtl8188eu/include/osdep_service.h +++ b/drivers/staging/rtl8188eu/include/osdep_service.h @@ -36,6 +36,7 @@ #include <linux/atomic.h> #include <linux/io.h> #include <linux/semaphore.h> +#include <linux/mutex.h> #include <linux/sem.h> #include <linux/sched.h> #include <linux/etherdevice.h> @@ -78,8 +79,6 @@ u8 *_rtw_malloc(u32 sz); void *rtw_malloc2d(int h, int w, int size); -u32 _rtw_down_sema(struct semaphore *sema); - void _rtw_init_queue(struct __queue *pqueue); struct rtw_netdev_priv_indicator { diff --git a/drivers/staging/rtl8188eu/include/rtw_event.h b/drivers/staging/rtl8188eu/include/rtw_event.h index 5c34e56..0dc63f2 100644 --- a/drivers/staging/rtl8188eu/include/rtw_event.h +++ b/drivers/staging/rtl8188eu/include/rtw_event.h @@ -19,6 +19,7 @@ #include <wlan_bssdef.h> #include <linux/semaphore.h> +#include <linux/mutex.h> #include <linux/sem.h> /* diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h index 9680e2e..18a9e74 100644 --- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h @@ -92,21 +92,6 @@ struct reportpwrstate_parm { unsigned short rsvd; }; -static inline void _init_pwrlock(struct semaphore *plock) -{ - sema_init(plock, 1); -} - -static inline void _enter_pwrlock(struct semaphore *plock) -{ - _rtw_down_sema(plock); -} - -static inline void _exit_pwrlock(struct semaphore *plock) -{ - up(plock); -} - #define LPS_DELAY_TIME 1*HZ /* 1 sec */ #define EXE_PWR_NONE 0x01 @@ -157,7 +142,7 @@ enum { /* for ips_mode */ }; struct pwrctrl_priv { - struct semaphore lock; + struct mutex mutex_lock; volatile u8 rpwm; /* requested power state for fw */ volatile u8 cpwm; /* fw current power state. updated when * 1. read from HCPWM 2. driver lowers power level */ |