Commit 39485066 authored by Binoy Jayan's avatar Binoy Jayan Committed by Greg Kroah-Hartman

staging: r8723au: 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.
Signed-off-by: default avatarBinoy Jayan <binoy.jayan@linaro.org>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1335a951
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
******************************************************************************/ ******************************************************************************/
#define _RTW_PWRCTRL_C_ #define _RTW_PWRCTRL_C_
#include <linux/mutex.h>
#include <osdep_service.h> #include <osdep_service.h>
#include <drv_types.h> #include <drv_types.h>
#include <osdep_intf.h> #include <osdep_intf.h>
...@@ -27,7 +28,7 @@ void ips_enter23a(struct rtw_adapter *padapter) ...@@ -27,7 +28,7 @@ void ips_enter23a(struct rtw_adapter *padapter)
{ {
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
down(&pwrpriv->lock); mutex_lock(&pwrpriv->mutex_lock);
pwrpriv->bips_processing = true; pwrpriv->bips_processing = true;
...@@ -50,7 +51,7 @@ void ips_enter23a(struct rtw_adapter *padapter) ...@@ -50,7 +51,7 @@ void ips_enter23a(struct rtw_adapter *padapter)
} }
pwrpriv->bips_processing = false; pwrpriv->bips_processing = false;
up(&pwrpriv->lock); mutex_unlock(&pwrpriv->mutex_lock);
} }
int ips_leave23a(struct rtw_adapter *padapter) int ips_leave23a(struct rtw_adapter *padapter)
...@@ -61,7 +62,7 @@ int ips_leave23a(struct rtw_adapter *padapter) ...@@ -61,7 +62,7 @@ int ips_leave23a(struct rtw_adapter *padapter)
int result = _SUCCESS; int result = _SUCCESS;
int keyid; int keyid;
down(&pwrpriv->lock); mutex_lock(&pwrpriv->mutex_lock);
if (pwrpriv->rf_pwrstate == rf_off && !pwrpriv->bips_processing) { if (pwrpriv->rf_pwrstate == rf_off && !pwrpriv->bips_processing) {
pwrpriv->bips_processing = true; pwrpriv->bips_processing = true;
...@@ -106,7 +107,7 @@ int ips_leave23a(struct rtw_adapter *padapter) ...@@ -106,7 +107,7 @@ int ips_leave23a(struct rtw_adapter *padapter)
pwrpriv->bpower_saving = false; pwrpriv->bpower_saving = false;
} }
up(&pwrpriv->lock); mutex_unlock(&pwrpriv->mutex_lock);
return result; return result;
} }
...@@ -423,7 +424,7 @@ void rtw_init_pwrctrl_priv23a(struct rtw_adapter *padapter) ...@@ -423,7 +424,7 @@ void rtw_init_pwrctrl_priv23a(struct rtw_adapter *padapter)
{ {
struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv;
sema_init(&pwrctrlpriv->lock, 1); mutex_init(&pwrctrlpriv->mutex_lock);
pwrctrlpriv->rf_pwrstate = rf_on; pwrctrlpriv->rf_pwrstate = rf_on;
pwrctrlpriv->ips_enter23a_cnts = 0; pwrctrlpriv->ips_enter23a_cnts = 0;
pwrctrlpriv->ips_leave23a_cnts = 0; pwrctrlpriv->ips_leave23a_cnts = 0;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#ifndef __RTW_PWRCTRL_H_ #ifndef __RTW_PWRCTRL_H_
#define __RTW_PWRCTRL_H_ #define __RTW_PWRCTRL_H_
#include <linux/mutex.h>
#include <osdep_service.h> #include <osdep_service.h>
#include <drv_types.h> #include <drv_types.h>
...@@ -149,7 +150,7 @@ enum { /* for ips_mode */ ...@@ -149,7 +150,7 @@ enum { /* for ips_mode */
}; };
struct pwrctrl_priv { struct pwrctrl_priv {
struct semaphore lock; struct mutex mutex_lock;
volatile u8 rpwm; /* requested power state for fw */ volatile u8 rpwm; /* requested power state for fw */
volatile u8 cpwm; /* fw current power state. updated when 1. volatile u8 cpwm; /* fw current power state. updated when 1.
* read from HCPWM 2. driver lowers power level * read from HCPWM 2. driver lowers power level
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
******************************************************************************/ ******************************************************************************/
#define _HCI_INTF_C_ #define _HCI_INTF_C_
#include <linux/mutex.h>
#include <osdep_service.h> #include <osdep_service.h>
#include <drv_types.h> #include <drv_types.h>
#include <recv_osdep.h> #include <recv_osdep.h>
...@@ -291,7 +292,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) ...@@ -291,7 +292,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
rtw_cancel_all_timer23a(padapter); rtw_cancel_all_timer23a(padapter);
LeaveAllPowerSaveMode23a(padapter); LeaveAllPowerSaveMode23a(padapter);
down(&pwrpriv->lock); mutex_lock(&pwrpriv->mutex_lock);
/* padapter->net_closed = true; */ /* padapter->net_closed = true; */
/* s1. */ /* s1. */
if (pnetdev) { if (pnetdev) {
...@@ -321,7 +322,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message) ...@@ -321,7 +322,7 @@ static int rtw_suspend(struct usb_interface *pusb_intf, pm_message_t message)
rtw_free_network_queue23a(padapter); rtw_free_network_queue23a(padapter);
rtw_dev_unload(padapter); rtw_dev_unload(padapter);
up(&pwrpriv->lock); mutex_unlock(&pwrpriv->mutex_lock);
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
rtw_cfg80211_indicate_scan_done( rtw_cfg80211_indicate_scan_done(
...@@ -353,20 +354,20 @@ static int rtw_resume(struct usb_interface *pusb_intf) ...@@ -353,20 +354,20 @@ static int rtw_resume(struct usb_interface *pusb_intf)
pnetdev = padapter->pnetdev; pnetdev = padapter->pnetdev;
pwrpriv = &padapter->pwrctrlpriv; pwrpriv = &padapter->pwrctrlpriv;
down(&pwrpriv->lock); mutex_lock(&pwrpriv->mutex_lock);
rtw_reset_drv_sw23a(padapter); rtw_reset_drv_sw23a(padapter);
pwrpriv->bkeepfwalive = false; pwrpriv->bkeepfwalive = false;
DBG_8723A("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive); DBG_8723A("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive);
if (pm_netdev_open23a(pnetdev, true) != 0) { if (pm_netdev_open23a(pnetdev, true) != 0) {
up(&pwrpriv->lock); mutex_unlock(&pwrpriv->mutex_lock);
goto exit; goto exit;
} }
netif_device_attach(pnetdev); netif_device_attach(pnetdev);
netif_carrier_on(pnetdev); netif_carrier_on(pnetdev);
up(&pwrpriv->lock); mutex_unlock(&pwrpriv->mutex_lock);
if (padapter->pid[1] != 0) { if (padapter->pid[1] != 0) {
DBG_8723A("pid[1]:%d\n", padapter->pid[1]); DBG_8723A("pid[1]:%d\n", padapter->pid[1]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment