The following commit has been merged in the master branch: commit 5a75fbd8729e98d5aefece4eb2702a29f5acbd02 Merge: a237bc6aa237eacdab9abf78bda0bca8cd4ed26d 716040e0ae01794c440307874e3e4a53315b6b06 Author: Stephen Rothwell sfr@canb.auug.org.au Date: Tue Nov 9 11:01:04 2021 +1100
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git
# Conflicts: # drivers/staging/r8188eu/core/rtw_mp.c
diff --combined arch/m68k/kernel/traps.c index 9718ce94cc84,74045d164ddb..99058a6da956 --- a/arch/m68k/kernel/traps.c +++ b/arch/m68k/kernel/traps.c @@@ -181,8 -181,9 +181,8 @@@ static inline void access_error060 (str static inline unsigned long probe040(int iswrite, unsigned long addr, int wbs) { unsigned long mmusr; - mm_segment_t old_fs = get_fs();
- set_fs(MAKE_MM_SEG(wbs)); + set_fc(wbs);
if (iswrite) asm volatile (".chip 68040; ptestw (%0); .chip 68k" : : "a" (addr)); @@@ -191,7 -192,7 +191,7 @@@
asm volatile (".chip 68040; movec %%mmusr,%0; .chip 68k" : "=r" (mmusr));
- set_fs(old_fs); + set_fc(USER_DATA);
return mmusr; } @@@ -200,8 -201,10 +200,8 @@@ static inline int do_040writeback1(unsi unsigned long wbd) { int res = 0; - mm_segment_t old_fs = get_fs();
- /* set_fs can not be moved, otherwise put_user() may oops */ - set_fs(MAKE_MM_SEG(wbs)); + set_fc(wbs);
switch (wbs & WBSIZ_040) { case BA_SIZE_BYTE: @@@ -215,7 -218,9 +215,7 @@@ break; }
- /* set_fs can not be moved, otherwise put_user() may oops */ - set_fs(old_fs); - + set_fc(USER_DATA);
pr_debug("do_040writeback1, res=%d\n", res);
@@@ -1145,7 -1150,7 +1145,7 @@@ asmlinkage void set_esp0(unsigned long */ asmlinkage void fpsp040_die(void) { - force_sigsegv(SIGSEGV); + force_fatal_sig(SIGSEGV); }
#ifdef CONFIG_M68KFPU_EMU diff --combined arch/powerpc/kernel/signal_32.c index 38c3eae40c14,933ab95805a6..00a9c9cd6d42 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c @@@ -1048,7 -1048,7 +1048,7 @@@ SYSCALL_DEFINE3(swapcontext, struct uco if (new_ctx == NULL) return 0; if (!access_ok(new_ctx, ctx_size) || - fault_in_pages_readable((u8 __user *)new_ctx, ctx_size)) + fault_in_readable((char __user *)new_ctx, ctx_size)) return -EFAULT;
/* @@@ -1062,8 -1062,10 +1062,10 @@@ * or if another thread unmaps the region containing the context. * We kill the task with a SIGSEGV in this situation. */ - if (do_setcontext(new_ctx, regs, 0)) - do_exit(SIGSEGV); + if (do_setcontext(new_ctx, regs, 0)) { + force_fatal_sig(SIGSEGV); + return -EFAULT; + }
set_thread_flag(TIF_RESTOREALL); return 0; @@@ -1237,7 -1239,7 +1239,7 @@@ SYSCALL_DEFINE3(debug_setcontext, struc #endif
if (!access_ok(ctx, sizeof(*ctx)) || - fault_in_pages_readable((u8 __user *)ctx, sizeof(*ctx))) + fault_in_readable((char __user *)ctx, sizeof(*ctx))) return -EFAULT;
/* diff --combined arch/powerpc/kernel/signal_64.c index 9f471b4a11e3,8ead9b3f47c6..ef518535d436 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c @@@ -688,7 -688,7 +688,7 @@@ SYSCALL_DEFINE3(swapcontext, struct uco if (new_ctx == NULL) return 0; if (!access_ok(new_ctx, ctx_size) || - fault_in_pages_readable((u8 __user *)new_ctx, ctx_size)) + fault_in_readable((char __user *)new_ctx, ctx_size)) return -EFAULT;
/* @@@ -703,15 -703,18 +703,18 @@@ * We kill the task with a SIGSEGV in this situation. */
- if (__get_user_sigset(&set, &new_ctx->uc_sigmask)) - do_exit(SIGSEGV); + if (__get_user_sigset(&set, &new_ctx->uc_sigmask)) { + force_fatal_sig(SIGSEGV); + return -EFAULT; + } set_current_blocked(&set);
if (!user_read_access_begin(new_ctx, ctx_size)) return -EFAULT; if (__unsafe_restore_sigcontext(current, NULL, 0, &new_ctx->uc_mcontext)) { user_read_access_end(); - do_exit(SIGSEGV); + force_fatal_sig(SIGSEGV); + return -EFAULT; } user_read_access_end();
diff --combined arch/s390/kernel/dumpstack.c index 85f326e258df,f45e66b8bed6..0681c55e831d --- a/arch/s390/kernel/dumpstack.c +++ b/arch/s390/kernel/dumpstack.c @@@ -152,7 -152,7 +152,7 @@@ void show_stack(struct task_struct *tas static void show_last_breaking_event(struct pt_regs *regs) { printk("Last Breaking-Event-Address:\n"); - printk(" [<%016lx>] %pSR\n", regs->args[0], (void *)regs->args[0]); + printk(" [<%016lx>] %pSR\n", regs->last_break, (void *)regs->last_break); }
void show_registers(struct pt_regs *regs) @@@ -192,7 -192,7 +192,7 @@@ void show_regs(struct pt_regs *regs
static DEFINE_SPINLOCK(die_lock);
- void die(struct pt_regs *regs, const char *str) + void __noreturn die(struct pt_regs *regs, const char *str) { static int die_counter;
diff --combined arch/s390/kernel/traps.c index 6c6f7dcce1a5,01a7c68dcfb6..035705c9f23e --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c @@@ -84,7 -84,7 +84,7 @@@ static void default_trap_handler(struc { if (user_mode(regs)) { report_user_fault(regs, SIGSEGV, 0); - do_exit(SIGSEGV); + force_fatal_sig(SIGSEGV); } else die(regs, "Unknown program exception"); } @@@ -300,6 -300,7 +300,6 @@@ static void (*pgm_check_table[128])(str
void noinstr __do_pgm_check(struct pt_regs *regs) { - unsigned long last_break = S390_lowcore.breaking_event_addr; unsigned int trapnr; irqentry_state_t state;
@@@ -310,11 -311,10 +310,11 @@@
if (user_mode(regs)) { update_timer_sys(); - if (last_break < 4096) - last_break = 1; - current->thread.last_break = last_break; - regs->args[0] = last_break; + if (!static_branch_likely(&cpu_has_bear)) { + if (regs->last_break < 4096) + regs->last_break = 1; + } + current->thread.last_break = regs->last_break; }
if (S390_lowcore.pgm_code & 0x0200) { diff --combined arch/xtensa/kernel/traps.c index 35a7d47f28cf,fb056a191339..4b4dbeb2d612 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c @@@ -97,9 -97,7 +97,9 @@@ static dispatch_init_table_t __initdat /* EXCCAUSE_INSTRUCTION_FETCH unhandled */ /* EXCCAUSE_LOAD_STORE_ERROR unhandled*/ { EXCCAUSE_LEVEL1_INTERRUPT, 0, do_interrupt }, +#ifdef SUPPORT_WINDOWED { EXCCAUSE_ALLOCA, USER|KRNL, fast_alloca }, +#endif /* EXCCAUSE_INTEGER_DIVIDE_BY_ZERO unhandled */ /* EXCCAUSE_PRIVILEGED unhandled */ #if XCHAL_UNALIGNED_LOAD_EXCEPTION || XCHAL_UNALIGNED_STORE_EXCEPTION @@@ -464,10 -462,12 +464,10 @@@ void secondary_trap_init(void
void show_regs(struct pt_regs * regs) { - int i, wmask; + int i;
show_regs_print_info(KERN_DEFAULT);
- wmask = regs->wmask & ~1; - for (i = 0; i < 16; i++) { if ((i % 8) == 0) pr_info("a%02d:", i); @@@ -527,7 -527,7 +527,7 @@@ void show_stack(struct task_struct *tas
DEFINE_SPINLOCK(die_lock);
- void die(const char * str, struct pt_regs * regs, long err) + void __noreturn die(const char * str, struct pt_regs * regs, long err) { static int die_counter; const char *pr = ""; diff --combined drivers/staging/r8188eu/core/rtw_cmd.c index 5d5f25364b2f,d37c9463eecc..48869a7056fd --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@@ -9,8 -9,6 +9,8 @@@ #include "../include/mlme_osdep.h" #include "../include/rtw_br_ext.h" #include "../include/rtw_mlme_ext.h" +#include "../include/rtl8188e_dm.h" +#include "../include/rtl8188e_sreset.h"
/* Caller and the rtw_cmd_thread can protect cmd_q by spin_lock. @@@ -21,12 -19,11 +21,12 @@@ static int _rtw_init_cmd_priv(struct cm { int res = _SUCCESS;
- sema_init(&pcmdpriv->cmd_queue_sema, 0); + init_completion(&pcmdpriv->enqueue_cmd); /* sema_init(&(pcmdpriv->cmd_done_sema), 0); */ - sema_init(&pcmdpriv->terminate_cmdthread_sema, 0); + init_completion(&pcmdpriv->start_cmd_thread); + init_completion(&pcmdpriv->stop_cmd_thread);
- _rtw_init_queue(&pcmdpriv->cmd_queue); + rtw_init_queue(&pcmdpriv->cmd_queue);
/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
@@@ -170,6 -167,16 +170,6 @@@ static int rtw_cmd_filter(struct cmd_pr { u8 bAllow = false; /* set to true to allow enqueuing cmd when hw_init_completed is false */
- /* To decide allow or not */ - if ((pcmdpriv->padapter->pwrctrlpriv.bHWPwrPindetect) && - (!pcmdpriv->padapter->registrypriv.usbss_enable)) { - if (cmd_obj->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra)) { - struct drvextra_cmd_parm *pdrvextra_cmd_parm = (struct drvextra_cmd_parm *)cmd_obj->parmbuf; - if (pdrvextra_cmd_parm->ec_id == POWER_SAVING_CTRL_WK_CID) - bAllow = true; - } - } - if (cmd_obj->cmdcode == GEN_CMD_CODE(_SetChannelPlan)) bAllow = true;
@@@ -198,7 -205,7 +198,7 @@@ u32 rtw_enqueue_cmd(struct cmd_priv *pc res = _rtw_enqueue_cmd(&pcmdpriv->cmd_queue, cmd_obj);
if (res == _SUCCESS) - up(&pcmdpriv->cmd_queue_sema); + complete(&pcmdpriv->enqueue_cmd);
exit:
@@@ -214,6 -221,14 +214,6 @@@ struct cmd_obj *rtw_dequeue_cmd(struct return cmd_obj; }
-void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv) -{ - - pcmdpriv->cmd_done_cnt++; - /* up(&(pcmdpriv->cmd_done_sema)); */ - -} - void rtw_free_cmd_obj(struct cmd_obj *pcmd) {
@@@ -244,14 -259,23 +244,14 @@@ int rtw_cmd_thread(void *context struct adapter *padapter = (struct adapter *)context; struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
- thread_enter("RTW_CMD_THREAD"); - pcmdbuf = pcmdpriv->cmd_buf;
pcmdpriv->cmdthd_running = true; - up(&pcmdpriv->terminate_cmdthread_sema); + complete(&pcmdpriv->start_cmd_thread);
while (1) { - if (_rtw_down_sema(&pcmdpriv->cmd_queue_sema) == _FAIL) - break; + wait_for_completion(&pcmdpriv->enqueue_cmd);
- if (padapter->bDriverStopped || - padapter->bSurpriseRemoved) { - DBG_88E("%s: DriverStopped(%d) SurpriseRemoved(%d) break at line %d\n", - __func__, padapter->bDriverStopped, padapter->bSurpriseRemoved, __LINE__); - break; - } _next: if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { @@@ -321,11 -345,43 +321,11 @@@ post_process rtw_free_cmd_obj(pcmd); } while (1);
- up(&pcmdpriv->terminate_cmdthread_sema); + complete(&pcmdpriv->stop_cmd_thread);
- thread_exit(); + return 0; }
-u8 rtw_setstandby_cmd(struct adapter *padapter, uint action) -{ - struct cmd_obj *ph2c; - struct usb_suspend_parm *psetusbsuspend; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - - u8 ret = _SUCCESS; - - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!ph2c) { - ret = _FAIL; - goto exit; - } - - psetusbsuspend = kzalloc(sizeof(struct usb_suspend_parm), GFP_ATOMIC); - if (!psetusbsuspend) { - kfree(ph2c); - ret = _FAIL; - goto exit; - } - - psetusbsuspend->action = action; - - init_h2fwcmd_w_parm_no_rsp(ph2c, psetusbsuspend, GEN_CMD_CODE(_SetUsbSuspend)); - - ret = rtw_enqueue_cmd(pcmdpriv, ph2c); - -exit: - - return ret; -} - /* rtw_sitesurvey_cmd(~) ### NOTE:#### (!!!!) @@@ -435,12 -491,228 +435,12 @@@ exit return res; }
-u8 rtw_setbasicrate_cmd(struct adapter *padapter, u8 *rateset) -{ - struct cmd_obj *ph2c; - struct setbasicrate_parm *pssetbasicratepara; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!ph2c) { - res = _FAIL; - goto exit; - } - pssetbasicratepara = kzalloc(sizeof(struct setbasicrate_parm), GFP_ATOMIC); - - if (!pssetbasicratepara) { - kfree(ph2c); - res = _FAIL; - goto exit; - } - - init_h2fwcmd_w_parm_no_rsp(ph2c, pssetbasicratepara, _SetBasicRate_CMD_); - - memcpy(pssetbasicratepara->basicrates, rateset, NumRates); - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); -exit: - - return res; -} - -/* -unsigned char rtw_setphy_cmd(unsigned char *adapter) - -1. be called only after rtw_update_registrypriv_dev_network(~) or mp testing program -2. for AdHoc/Ap mode or mp mode? - -*/ -u8 rtw_setphy_cmd(struct adapter *padapter, u8 modem, u8 ch) -{ - struct cmd_obj *ph2c; - struct setphy_parm *psetphypara; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!ph2c) { - res = _FAIL; - goto exit; - } - psetphypara = kzalloc(sizeof(struct setphy_parm), GFP_ATOMIC); - - if (!psetphypara) { - kfree(ph2c); - res = _FAIL; - goto exit; - } - - init_h2fwcmd_w_parm_no_rsp(ph2c, psetphypara, _SetPhy_CMD_); - - psetphypara->modem = modem; - psetphypara->rfchannel = ch; - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); -exit: - - return res; -} - -u8 rtw_setbbreg_cmd(struct adapter *padapter, u8 offset, u8 val) -{ - struct cmd_obj *ph2c; - struct writeBB_parm *pwritebbparm; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!ph2c) { - res = _FAIL; - goto exit; - } - pwritebbparm = kzalloc(sizeof(struct writeBB_parm), GFP_ATOMIC); - - if (!pwritebbparm) { - kfree(ph2c); - res = _FAIL; - goto exit; - } - - init_h2fwcmd_w_parm_no_rsp(ph2c, pwritebbparm, GEN_CMD_CODE(_SetBBReg)); - - pwritebbparm->offset = offset; - pwritebbparm->value = val; - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); -exit: - - return res; -} - -u8 rtw_getbbreg_cmd(struct adapter *padapter, u8 offset, u8 *pval) -{ - struct cmd_obj *ph2c; - struct readBB_parm *prdbbparm; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!ph2c) { - res = _FAIL; - goto exit; - } - prdbbparm = kzalloc(sizeof(struct readBB_parm), GFP_ATOMIC); - - if (!prdbbparm) { - kfree(ph2c); - return _FAIL; - } - - INIT_LIST_HEAD(&ph2c->list); - ph2c->cmdcode = GEN_CMD_CODE(_GetBBReg); - ph2c->parmbuf = (unsigned char *)prdbbparm; - ph2c->cmdsz = sizeof(struct readBB_parm); - ph2c->rsp = pval; - ph2c->rspsz = sizeof(struct readBB_rsp); - - prdbbparm->offset = offset; - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); -exit: - - return res; -} - -u8 rtw_setrfreg_cmd(struct adapter *padapter, u8 offset, u32 val) -{ - struct cmd_obj *ph2c; - struct writeRF_parm *pwriterfparm; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!ph2c) { - res = _FAIL; - goto exit; - } - pwriterfparm = kzalloc(sizeof(struct writeRF_parm), GFP_ATOMIC); - - if (!pwriterfparm) { - kfree(ph2c); - res = _FAIL; - goto exit; - } - - init_h2fwcmd_w_parm_no_rsp(ph2c, pwriterfparm, GEN_CMD_CODE(_SetRFReg)); - - pwriterfparm->offset = offset; - pwriterfparm->value = val; - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); -exit: - - return res; -} - -u8 rtw_getrfreg_cmd(struct adapter *padapter, u8 offset, u8 *pval) -{ - struct cmd_obj *ph2c; - struct readRF_parm *prdrfparm; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!ph2c) { - res = _FAIL; - goto exit; - } - - prdrfparm = kzalloc(sizeof(struct readRF_parm), GFP_ATOMIC); - if (!prdrfparm) { - kfree(ph2c); - res = _FAIL; - goto exit; - } - - INIT_LIST_HEAD(&ph2c->list); - ph2c->cmdcode = GEN_CMD_CODE(_GetRFReg); - ph2c->parmbuf = (unsigned char *)prdrfparm; - ph2c->cmdsz = sizeof(struct readRF_parm); - ph2c->rsp = pval; - ph2c->rspsz = sizeof(struct readRF_rsp); - - prdrfparm->offset = offset; - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); - -exit: - - return res; -} - void rtw_getbbrfreg_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) {
kfree(pcmd->parmbuf); kfree(pcmd); - - if (padapter->registrypriv.mp_mode == 1) - padapter->mppriv.workparam.bcompleted = true; - -} - -void rtw_readtssi_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) -{ - - - kfree(pcmd->parmbuf); - kfree(pcmd); - - if (padapter->registrypriv.mp_mode == 1) - padapter->mppriv.workparam.bcompleted = true; - }
u8 rtw_createbss_cmd(struct adapter *padapter) @@@ -471,6 -743,32 +471,6 @@@ exit return res; }
-u8 rtw_createbss_cmd_ex(struct adapter *padapter, unsigned char *pbss, unsigned int sz) -{ - struct cmd_obj *pcmd; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - - pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!pcmd) { - res = _FAIL; - goto exit; - } - - INIT_LIST_HEAD(&pcmd->list); - pcmd->cmdcode = GEN_CMD_CODE(_CreateBss); - pcmd->parmbuf = pbss; - pcmd->cmdsz = sz; - pcmd->rsp = NULL; - pcmd->rspsz = 0; - - res = rtw_enqueue_cmd(pcmdpriv, pcmd); - -exit: - - return res; -} - u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork) { u8 res = _SUCCESS; @@@ -775,6 -1073,115 +775,6 @@@ exit return res; }
-u8 rtw_setrttbl_cmd(struct adapter *padapter, struct setratable_parm *prate_table) -{ - struct cmd_obj *ph2c; - struct setratable_parm *psetrttblparm; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); - if (!ph2c) { - res = _FAIL; - goto exit; - } - psetrttblparm = kzalloc(sizeof(struct setratable_parm), GFP_KERNEL); - - if (!psetrttblparm) { - kfree(ph2c); - res = _FAIL; - goto exit; - } - - init_h2fwcmd_w_parm_no_rsp(ph2c, psetrttblparm, GEN_CMD_CODE(_SetRaTable)); - - memcpy(psetrttblparm, prate_table, sizeof(struct setratable_parm)); - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); -exit: - - return res; -} - -u8 rtw_getrttbl_cmd(struct adapter *padapter, struct getratable_rsp *pval) -{ - struct cmd_obj *ph2c; - struct getratable_parm *pgetrttblparm; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - u8 res = _SUCCESS; - - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL); - if (!ph2c) { - res = _FAIL; - goto exit; - } - pgetrttblparm = kzalloc(sizeof(struct getratable_parm), GFP_KERNEL); - - if (!pgetrttblparm) { - kfree(ph2c); - res = _FAIL; - goto exit; - } - -/* init_h2fwcmd_w_parm_no_rsp(ph2c, psetrttblparm, GEN_CMD_CODE(_SetRaTable)); */ - - INIT_LIST_HEAD(&ph2c->list); - ph2c->cmdcode = GEN_CMD_CODE(_GetRaTable); - ph2c->parmbuf = (unsigned char *)pgetrttblparm; - ph2c->cmdsz = sizeof(struct getratable_parm); - ph2c->rsp = (u8 *)pval; - ph2c->rspsz = sizeof(struct getratable_rsp); - - pgetrttblparm->rsvd = 0x0; - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); -exit: - - return res; -} - -u8 rtw_setassocsta_cmd(struct adapter *padapter, u8 *mac_addr) -{ - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - struct cmd_obj *ph2c; - struct set_assocsta_parm *psetassocsta_para; - struct set_stakey_rsp *psetassocsta_rsp = NULL; - - u8 res = _SUCCESS; - - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!ph2c) { - res = _FAIL; - goto exit; - } - - psetassocsta_para = kzalloc(sizeof(struct set_assocsta_parm), GFP_ATOMIC); - if (!psetassocsta_para) { - kfree(ph2c); - res = _FAIL; - goto exit; - } - - psetassocsta_rsp = kzalloc(sizeof(struct set_assocsta_rsp), GFP_ATOMIC); - if (!psetassocsta_rsp) { - kfree(ph2c); - kfree(psetassocsta_para); - return _FAIL; - } - - init_h2fwcmd_w_parm_no_rsp(ph2c, psetassocsta_para, _SetAssocSta_CMD_); - ph2c->rsp = (u8 *)psetassocsta_rsp; - ph2c->rspsz = sizeof(struct set_assocsta_rsp); - - memcpy(psetassocsta_para->addr, mac_addr, ETH_ALEN); - - res = rtw_enqueue_cmd(pcmdpriv, ph2c); - -exit: - - return res; - } - u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr) { struct cmd_priv *pcmdpriv = &padapter->cmdpriv; @@@ -843,6 -1250,57 +843,6 @@@ exit return res; }
-u8 rtw_set_ch_cmd(struct adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueue) -{ - struct cmd_obj *pcmdobj; - struct set_ch_parm *set_ch_parm; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - - u8 res = _SUCCESS; - - DBG_88E(FUNC_NDEV_FMT" ch:%u, bw:%u, ch_offset:%u\n", - FUNC_NDEV_ARG(padapter->pnetdev), ch, bw, ch_offset); - - /* check input parameter */ - - /* prepare cmd parameter */ - set_ch_parm = kzalloc(sizeof(*set_ch_parm), GFP_ATOMIC); - if (!set_ch_parm) { - res = _FAIL; - goto exit; - } - set_ch_parm->ch = ch; - set_ch_parm->bw = bw; - set_ch_parm->ch_offset = ch_offset; - - if (enqueue) { - /* need enqueue, prepare cmd_obj and enqueue */ - pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!pcmdobj) { - kfree(set_ch_parm); - res = _FAIL; - goto exit; - } - - init_h2fwcmd_w_parm_no_rsp(pcmdobj, set_ch_parm, GEN_CMD_CODE(_SetChannel)); - res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); - } else { - /* no need to enqueue, do the cmd hdl directly and free cmd parameter */ - if (H2C_SUCCESS != set_ch_hdl(padapter, (u8 *)set_ch_parm)) - res = _FAIL; - - kfree(set_ch_parm); - } - - /* do something based on res... */ - -exit: - - DBG_88E(FUNC_NDEV_FMT" res:%u\n", FUNC_NDEV_ARG(padapter->pnetdev), res); - - return res; -} - u8 rtw_set_chplan_cmd(struct adapter *padapter, u8 chplan, u8 enqueue) { struct cmd_obj *pcmdobj; @@@ -894,6 -1352,74 +894,6 @@@ exit return res; }
-u8 rtw_led_blink_cmd(struct adapter *padapter, struct LED_871x *pLed) -{ - struct cmd_obj *pcmdobj; - struct LedBlink_param *ledBlink_param; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - - u8 res = _SUCCESS; - - pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!pcmdobj) { - res = _FAIL; - goto exit; - } - - ledBlink_param = kzalloc(sizeof(struct LedBlink_param), GFP_ATOMIC); - if (!ledBlink_param) { - kfree(pcmdobj); - res = _FAIL; - goto exit; - } - - ledBlink_param->pLed = pLed; - - init_h2fwcmd_w_parm_no_rsp(pcmdobj, ledBlink_param, GEN_CMD_CODE(_LedBlink)); - res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); - -exit: - - return res; -} - -u8 rtw_set_csa_cmd(struct adapter *padapter, u8 new_ch_no) -{ - struct cmd_obj *pcmdobj; - struct SetChannelSwitch_param *setChannelSwitch_param; - struct cmd_priv *pcmdpriv = &padapter->cmdpriv; - - u8 res = _SUCCESS; - - pcmdobj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC); - if (!pcmdobj) { - res = _FAIL; - goto exit; - } - - setChannelSwitch_param = kzalloc(sizeof(struct SetChannelSwitch_param), - GFP_ATOMIC); - if (!setChannelSwitch_param) { - kfree(pcmdobj); - res = _FAIL; - goto exit; - } - - setChannelSwitch_param->new_ch_no = new_ch_no; - - init_h2fwcmd_w_parm_no_rsp(pcmdobj, setChannelSwitch_param, GEN_CMD_CODE(_SetChannelSwitch)); - res = rtw_enqueue_cmd(pcmdpriv, pcmdobj); - -exit: - - return res; -} - -u8 rtw_tdls_cmd(struct adapter *padapter, u8 *addr, u8 option) -{ - return _SUCCESS; -} - static void traffic_status_watchdog(struct adapter *padapter) { u8 bEnterPS; @@@ -960,15 -1486,17 +960,15 @@@ static void dynamic_chk_wk_hdl(struct a padapter = (struct adapter *)pbuf; pmlmepriv = &padapter->mlmepriv;
-#ifdef CONFIG_88EU_AP_MODE if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) expire_timeout_chk(padapter); -#endif
- rtw_hal_sreset_xmit_status_check(padapter); + rtl8188e_sreset_xmit_status_check(padapter);
linked_status_chk(padapter); traffic_status_watchdog(padapter);
- rtw_hal_dm_watchdog(padapter); + rtl8188e_HalDmWatchDog(padapter); }
static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type) @@@ -995,12 -1523,12 +995,12 @@@ mstatus = 1;/* connect */ /* Reset LPS Setting */ padapter->pwrctrlpriv.LpsIdleCount = 0; - rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus)); + SetHwReg8188EU(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus)); break; case LPS_CTRL_DISCONNECT: mstatus = 0;/* disconnect */ LPS_Leave(padapter); - rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus)); + SetHwReg8188EU(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus)); break; case LPS_CTRL_SPECIAL_PACKET: /* DBG_88E("LPS_CTRL_SPECIAL_PACKET\n"); */ @@@ -1060,7 -1588,7 +1060,7 @@@ exit
static void rpt_timer_setting_wk_hdl(struct adapter *padapter, u16 min_time) { - rtw_hal_set_hwreg(padapter, HW_VAR_RPT_TIMER_SETTING, (u8 *)(&min_time)); + SetHwReg8188EU(padapter, HW_VAR_RPT_TIMER_SETTING, (u8 *)(&min_time)); }
u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time) @@@ -1097,7 -1625,7 +1097,7 @@@ exit
static void antenna_select_wk_hdl(struct adapter *padapter, u8 antenna) { - rtw_hal_set_hwreg(padapter, HW_VAR_ANTENNA_DIVERSITY_SELECT, (u8 *)(&antenna)); + SetHwReg8188EU(padapter, HW_VAR_ANTENNA_DIVERSITY_SELECT, (u8 *)(&antenna)); }
u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue) @@@ -1108,7 -1636,7 +1108,7 @@@ u8 support_ant_div; u8 res = _SUCCESS;
- rtw_hal_get_def_var(padapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &support_ant_div); + GetHalDefVar8188EUsb(padapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &support_ant_div); if (!support_ant_div) return res;
@@@ -1141,6 -1669,12 +1141,6 @@@ exit return res; }
-static void power_saving_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz) -{ - rtw_ps_processor(padapter); -} - -#ifdef CONFIG_88EU_P2P u8 p2p_protocol_wk_cmd(struct adapter *padapter, int intCmdType) { struct cmd_obj *ph2c; @@@ -1177,6 -1711,7 +1177,6 @@@ exit
return res; } -#endif /* CONFIG_88EU_P2P */
u8 rtw_ps_cmd(struct adapter *padapter) { @@@ -1210,6 -1745,8 +1210,6 @@@ exit return res; }
-#ifdef CONFIG_88EU_AP_MODE - static void rtw_chk_hi_queue_hdl(struct adapter *padapter) { int cnt = 0; @@@ -1226,7 -1763,7 +1226,7 @@@ /* while ((rtw_read32(padapter, 0x414)&0x00ffff00)!= 0) */ /* while ((rtw_read32(padapter, 0x414)&0x0000ff00)!= 0) */
- rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val); + GetHwReg8188EU(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val);
while (!val) { msleep(100); @@@ -1236,7 -1773,7 +1236,7 @@@ if (cnt > 10) break;
- rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val); + GetHwReg8188EU(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &val); }
if (cnt <= 10) { @@@ -1280,6 -1817,7 +1280,6 @@@ u8 rtw_chk_hi_queue_cmd(struct adapter exit: return res; } -#endif
u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt) { @@@ -1314,12 -1852,29 +1314,12 @@@ exit return res; }
-static s32 c2h_evt_hdl(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt, c2h_id_filter filter) +static void c2h_evt_hdl(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt, c2h_id_filter filter) { - s32 ret = _FAIL; u8 buf[16];
- if (!c2h_evt) { - /* No c2h event in cmd_obj, read c2h event before handling*/ - if (c2h_evt_read(adapter, buf) == _SUCCESS) { - c2h_evt = (struct c2h_evt_hdr *)buf; - - if (filter && !filter(c2h_evt->id)) - goto exit; - - ret = rtw_hal_c2h_handler(adapter, c2h_evt); - } - } else { - if (filter && !filter(c2h_evt->id)) - goto exit; - - ret = rtw_hal_c2h_handler(adapter, c2h_evt); - } -exit: - return ret; + if (!c2h_evt) + c2h_evt_read(adapter, buf); }
static void c2h_wk_callback(struct work_struct *work) @@@ -1327,6 -1882,7 +1327,6 @@@ struct evt_priv *evtpriv = container_of(work, struct evt_priv, c2h_wk); struct adapter *adapter = container_of(evtpriv, struct adapter, evtpriv); struct c2h_evt_hdr *c2h_evt; - c2h_id_filter ccx_id_filter = rtw_hal_c2h_id_filter_ccx(adapter);
evtpriv->c2h_wk_alive = true;
@@@ -1356,8 -1912,16 +1356,8 @@@ continue; }
- if (ccx_id_filter(c2h_evt->id)) { - /* Handle CCX report here */ - rtw_hal_c2h_handler(adapter, c2h_evt); - kfree(c2h_evt); - } else { -#ifdef CONFIG_88EU_P2P - /* Enqueue into cmd_thread for others */ - rtw_c2h_wk_cmd(adapter, (u8 *)c2h_evt); -#endif - } + /* Enqueue into cmd_thread for others */ + rtw_c2h_wk_cmd(adapter, (u8 *)c2h_evt); }
evtpriv->c2h_wk_alive = false; @@@ -1377,7 -1941,7 +1377,7 @@@ u8 rtw_drvextra_cmd_hdl(struct adapter dynamic_chk_wk_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size); break; case POWER_SAVING_CTRL_WK_CID: - power_saving_wk_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size); + rtw_ps_processor(padapter); break; case LPS_CTRL_WK_CID: lps_ctrl_wk_hdl(padapter, (u8)pdrvextra_cmd->type_size); @@@ -1388,6 -1952,7 +1388,6 @@@ case ANT_SELECT_WK_CID: antenna_select_wk_hdl(padapter, pdrvextra_cmd->type_size); break; -#ifdef CONFIG_88EU_P2P case P2P_PS_WK_CID: p2p_ps_wk_hdl(padapter, pdrvextra_cmd->type_size); break; @@@ -1396,9 -1961,12 +1396,9 @@@ /* I used the type_size as the type command */ p2p_protocol_wk_hdl(padapter, pdrvextra_cmd->type_size); break; -#endif -#ifdef CONFIG_88EU_AP_MODE case CHECK_HIQ_WK_CID: rtw_chk_hi_queue_hdl(padapter); break; -#endif /* CONFIG_88EU_AP_MODE */ case C2H_WK_CID: c2h_evt_hdl(padapter, (struct c2h_evt_hdr *)pdrvextra_cmd->pbuf, NULL); break; diff --combined drivers/staging/r8188eu/include/osdep_service.h index efab3a97eb46,afbffb551f9b..f6f5e4581212 --- a/drivers/staging/r8188eu/include/osdep_service.h +++ b/drivers/staging/r8188eu/include/osdep_service.h @@@ -49,13 -49,24 +49,11 @@@ struct __queue spinlock_t lock; };
- #define thread_exit() complete_and_exit(NULL, 0) - static inline struct list_head *get_list_head(struct __queue *queue) { return (&(queue->queue)); }
-static inline int _enter_critical_mutex(struct mutex *pmutex, unsigned long *pirqL) -{ - int ret; - - ret = mutex_lock_interruptible(pmutex); - return ret; -} - -static inline void _exit_critical_mutex(struct mutex *pmutex, unsigned long *pirqL) -{ - mutex_unlock(pmutex); -} - static inline void rtw_list_delete(struct list_head *plist) { list_del_init(plist); @@@ -141,11 -152,11 +139,11 @@@ extern unsigned char RSN_TKIP_CIPHER[4]
void *rtw_malloc2d(int h, int w, int size);
-u32 _rtw_down_sema(struct semaphore *sema); -void _rtw_mutex_init(struct mutex *pmutex); -void _rtw_mutex_free(struct mutex *pmutex); - -void _rtw_init_queue(struct __queue *pqueue); +#define rtw_init_queue(q) \ + do { \ + INIT_LIST_HEAD(&((q)->queue)); \ + spin_lock_init(&((q)->lock)); \ + } while (0)
u32 rtw_systime_to_ms(u32 systime); u32 rtw_ms_to_systime(u32 ms); @@@ -153,17 -164,32 +151,17 @@@ s32 rtw_get_passing_time_ms(u32 start)
void rtw_usleep_os(int us);
-u32 rtw_atoi(u8 *s); - static inline unsigned char _cancel_timer_ex(struct timer_list *ptimer) { return del_timer_sync(ptimer); }
-static __inline void thread_enter(char *name) -{ -#ifdef daemonize - daemonize("%s", name); -#endif - allow_signal(SIGTERM); -} - static inline void flush_signals_thread(void) { if (signal_pending (current)) flush_signals(current); }
-static inline int res_to_status(int res) -{ - return res; -} - #define _RND(sz, r) ((((sz)+((r)-1))/(r))*(r)) #define RND4(x) (((x >> 2) + (((x & 3) == 0) ? 0: 1)) << 2)
@@@ -274,10 -300,12 +272,10 @@@ struct rtw_cbuf u32 write; u32 read; u32 size; - void *bufs[0]; + void *bufs[]; };
-bool rtw_cbuf_full(struct rtw_cbuf *cbuf); bool rtw_cbuf_empty(struct rtw_cbuf *cbuf); -bool rtw_cbuf_push(struct rtw_cbuf *cbuf, void *buf); void *rtw_cbuf_pop(struct rtw_cbuf *cbuf); struct rtw_cbuf *rtw_cbuf_alloc(u32 size); int wifirate2_ratetbl_inx(unsigned char rate); diff --combined drivers/staging/rtl8723bs/core/rtw_cmd.c index 639459d52261,8e69f9c10f5c..bd24d913b464 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@@ -166,8 -166,7 +166,8 @@@ int rtw_init_cmd_priv(struct cmd_priv * init_completion(&pcmdpriv->cmd_queue_comp); init_completion(&pcmdpriv->terminate_cmdthread_comp);
- _rtw_init_queue(&(pcmdpriv->cmd_queue)); + INIT_LIST_HEAD(&pcmdpriv->cmd_queue.queue); + spin_lock_init(&pcmdpriv->cmd_queue.lock);
/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
@@@ -256,7 -255,7 +256,7 @@@ int _rtw_enqueue_cmd(struct __queue *qu { unsigned long irqL;
- if (obj == NULL) + if (!obj) goto exit;
/* spin_lock_bh(&queue->lock); */ @@@ -278,10 -277,10 +278,10 @@@ struct cmd_obj *_rtw_dequeue_cmd(struc
/* spin_lock_bh(&(queue->lock)); */ spin_lock_irqsave(&queue->lock, irqL); - if (list_empty(&(queue->queue))) + if (list_empty(&queue->queue)) obj = NULL; else { - obj = container_of(get_next(&(queue->queue)), struct cmd_obj, list); + obj = container_of(get_next(&queue->queue), struct cmd_obj, list); list_del_init(&obj->list); }
@@@ -309,19 -308,22 +309,19 @@@ int rtw_cmd_filter(struct cmd_priv *pcm if (cmd_obj->cmdcode == GEN_CMD_CODE(_SetChannelPlan)) bAllow = true;
- if ((pcmdpriv->padapter->hw_init_completed == false && bAllow == false) - || atomic_read(&(pcmdpriv->cmdthd_running)) == false /* com_thread not running */ - ) + if ((!pcmdpriv->padapter->hw_init_completed && !bAllow) || + !atomic_read(&pcmdpriv->cmdthd_running)) /* com_thread not running */ return _FAIL;
return _SUCCESS; }
- - int rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) { int res = _FAIL; struct adapter *padapter = pcmdpriv->padapter;
- if (cmd_obj == NULL) + if (!cmd_obj) goto exit;
cmd_obj->padapter = padapter; @@@ -365,10 -367,11 +365,10 @@@ void rtw_free_cmd_obj(struct cmd_obj *p kfree(pcmd); }
- void rtw_stop_cmd_thread(struct adapter *adapter) { if (adapter->cmdThread && - atomic_read(&(adapter->cmdpriv.cmdthd_running)) == true && + atomic_read(&adapter->cmdpriv.cmdthd_running) && adapter->cmdpriv.stop_req == 0) { adapter->cmdpriv.stop_req = 1; complete(&adapter->cmdpriv.cmd_queue_comp); @@@ -384,7 -387,7 +384,7 @@@ int rtw_cmd_thread(void *context u8 (*cmd_hdl)(struct adapter *padapter, u8 *pbuf); void (*pcmd_callback)(struct adapter *dev, struct cmd_obj *pcmd); struct adapter *padapter = context; - struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); + struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct drvextra_cmd_parm *extra_parm = NULL;
thread_enter("RTW_CMD_THREAD"); @@@ -392,7 -395,7 +392,7 @@@ pcmdbuf = pcmdpriv->cmd_buf;
pcmdpriv->stop_req = 0; - atomic_set(&(pcmdpriv->cmdthd_running), true); + atomic_set(&pcmdpriv->cmdthd_running, true); complete(&pcmdpriv->terminate_cmdthread_comp);
while (1) { @@@ -403,7 -406,7 +403,7 @@@ break; }
- if ((padapter->bDriverStopped == true) || (padapter->bSurpriseRemoved == true)) { + if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { netdev_dbg(padapter->pnetdev, "%s: DriverStopped(%d) SurpriseRemoved(%d) break at line %d\n", __func__, padapter->bDriverStopped, @@@ -426,7 -429,7 +426,7 @@@ continue;
_next: - if ((padapter->bDriverStopped == true) || (padapter->bSurpriseRemoved == true)) { + if (padapter->bDriverStopped || padapter->bSurpriseRemoved) { netdev_dbg(padapter->pnetdev, "%s: DriverStopped(%d) SurpriseRemoved(%d) break at line %d\n", __func__, padapter->bDriverStopped, @@@ -468,7 -471,7 +468,7 @@@
post_process:
- if (mutex_lock_interruptible(&(pcmd->padapter->cmdpriv.sctx_mutex)) == 0) { + if (mutex_lock_interruptible(&pcmd->padapter->cmdpriv.sctx_mutex) == 0) { if (pcmd->sctx) { netdev_dbg(padapter->pnetdev, FUNC_ADPT_FMT " pcmd->sctx\n", @@@ -479,13 -482,13 +479,13 @@@ else rtw_sctx_done_err(&pcmd->sctx, RTW_SCTX_DONE_CMD_ERROR); } - mutex_unlock(&(pcmd->padapter->cmdpriv.sctx_mutex)); + mutex_unlock(&pcmd->padapter->cmdpriv.sctx_mutex); }
/* call callback function for post-processed */ if (pcmd->cmdcode < ARRAY_SIZE(rtw_cmd_callback)) { pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback; - if (pcmd_callback == NULL) { + if (!pcmd_callback) { rtw_free_cmd_obj(pcmd); } else { /* todo: !!! fill rsp_buf to pcmd->rsp if (pcmd->rsp!= NULL) */ @@@ -494,14 -497,17 +494,14 @@@ } else { rtw_free_cmd_obj(pcmd); } - flush_signals_thread(); - goto _next; - }
/* free all cmd_obj resources */ do { pcmd = rtw_dequeue_cmd(pcmdpriv); - if (pcmd == NULL) { + if (!pcmd) { rtw_unregister_cmd_alive(padapter); break; } @@@ -516,9 -522,9 +516,9 @@@ } while (1);
complete(&pcmdpriv->terminate_cmdthread_comp); - atomic_set(&(pcmdpriv->cmdthd_running), false); + atomic_set(&pcmdpriv->cmdthd_running, false);
- thread_exit(); + return 0; }
/* @@@ -536,15 -542,15 +536,15 @@@ u8 rtw_sitesurvey_cmd(struct adapter * struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
- if (check_fwstate(pmlmepriv, _FW_LINKED) == true) + if (check_fwstate(pmlmepriv, _FW_LINKED)) rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1);
ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) + if (!ph2c) return _FAIL;
psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm)); - if (psurveyPara == NULL) { + if (!psurveyPara) { kfree(ph2c); return _FAIL; } @@@ -585,6 -591,7 +585,6 @@@ res = rtw_enqueue_cmd(pcmdpriv, ph2c);
if (res == _SUCCESS) { - pmlmepriv->scan_start_time = jiffies; _set_timer(&pmlmepriv->scan_to_timer, SCANNING_TIMEOUT); } else { @@@ -601,13 -608,13 +601,13 @@@ u8 rtw_setdatarate_cmd(struct adapter * u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
pbsetdataratepara = rtw_zmalloc(sizeof(struct setdatarate_parm)); - if (pbsetdataratepara == NULL) { + if (!pbsetdataratepara) { kfree(ph2c); res = _FAIL; goto exit; @@@ -637,7 -644,7 +637,7 @@@ u8 rtw_createbss_cmd(struct adapter *p u8 res = _SUCCESS;
pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); - if (pcmd == NULL) { + if (!pcmd) { res = _FAIL; goto exit; } @@@ -670,7 -677,7 +670,7 @@@ int rtw_startbss_cmd(struct adapter *p } else { /* need enqueue, prepare cmd_obj and enqueue */ pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); - if (pcmd == NULL) { + if (!pcmd) { res = _FAIL; goto exit; } @@@ -717,12 -724,12 +717,12 @@@ u8 rtw_joinbss_cmd(struct adapter *pad struct ht_priv *phtpriv = &pmlmepriv->htpriv; enum ndis_802_11_network_infrastructure ndis_network_mode = pnetwork->network.infrastructure_mode; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; u32 tmp_len; u8 *ptmp = NULL;
pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); - if (pcmd == NULL) { + if (!pcmd) { res = _FAIL; goto exit; } @@@ -745,6 -752,7 +745,6 @@@ case Ndis802_11AutoUnknown: case Ndis802_11InfrastructureMax: break; - } }
@@@ -767,7 -775,7 +767,7 @@@ /* If not, we have to copy the connecting AP's MAC address to it so that */ /* the driver just has the bssid information for PMKIDList searching. */
- if (pmlmepriv->assoc_by_bssid == false) + if (!pmlmepriv->assoc_by_bssid) memcpy(&pmlmepriv->assoc_bssid[0], &pnetwork->network.mac_address[0], ETH_ALEN);
psecnetwork->ie_length = rtw_restruct_sec_ie(padapter, &pnetwork->network.ies[0], &psecnetwork->ies[0], pnetwork->network.ie_length); @@@ -833,7 -841,7 +833,7 @@@ u8 rtw_disassoc_cmd(struct adapter *pad
/* prepare cmd parameter */ param = rtw_zmalloc(sizeof(*param)); - if (param == NULL) { + if (!param) { res = _FAIL; goto exit; } @@@ -842,7 -850,7 +842,7 @@@ if (enqueue) { /* need enqueue, prepare cmd_obj and enqueue */ cmdobj = rtw_zmalloc(sizeof(*cmdobj)); - if (cmdobj == NULL) { + if (!cmdobj) { res = _FAIL; kfree(param); goto exit; @@@ -870,7 -878,7 +870,7 @@@ u8 rtw_setopmode_cmd(struct adapter *p
psetop = rtw_zmalloc(sizeof(struct setopmode_parm));
- if (psetop == NULL) { + if (!psetop) { res = _FAIL; goto exit; } @@@ -878,7 -886,7 +878,7 @@@
if (enqueue) { ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { kfree(psetop); res = _FAIL; goto exit; @@@ -906,7 -914,7 +906,7 @@@ u8 rtw_setstakey_cmd(struct adapter *pa u8 res = _SUCCESS;
psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm)); - if (psetstakey_para == NULL) { + if (!psetstakey_para) { res = _FAIL; goto exit; } @@@ -914,11 -922,11 +914,11 @@@ memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) - psetstakey_para->algorithm = (unsigned char) psecuritypriv->dot11PrivacyAlgrthm; + psetstakey_para->algorithm = (unsigned char)psecuritypriv->dot11PrivacyAlgrthm; else GET_ENCRY_ALGO(psecuritypriv, sta, psetstakey_para->algorithm, false);
- if (unicast_key == true) + if (unicast_key) memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16); else memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, 16); @@@ -928,14 -936,14 +928,14 @@@
if (enqueue) { ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { kfree(psetstakey_para); res = _FAIL; goto exit; }
psetstakey_rsp = rtw_zmalloc(sizeof(struct set_stakey_rsp)); - if (psetstakey_rsp == NULL) { + if (!psetstakey_rsp) { kfree(ph2c); kfree(psetstakey_para); res = _FAIL; @@@ -943,7 -951,7 +943,7 @@@ }
init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_); - ph2c->rsp = (u8 *) psetstakey_rsp; + ph2c->rsp = (u8 *)psetstakey_rsp; ph2c->rspsz = sizeof(struct set_stakey_rsp); res = rtw_enqueue_cmd(pcmdpriv, ph2c); } else { @@@ -973,20 -981,20 +973,20 @@@ u8 rtw_clearstakey_cmd(struct adapter * } } else { ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm)); - if (psetstakey_para == NULL) { + if (!psetstakey_para) { kfree(ph2c); res = _FAIL; goto exit; }
psetstakey_rsp = rtw_zmalloc(sizeof(struct set_stakey_rsp)); - if (psetstakey_rsp == NULL) { + if (!psetstakey_rsp) { kfree(ph2c); kfree(psetstakey_para); res = _FAIL; @@@ -994,7 -1002,7 +994,7 @@@ }
init_h2fwcmd_w_parm_no_rsp(ph2c, psetstakey_para, _SetStaKey_CMD_); - ph2c->rsp = (u8 *) psetstakey_rsp; + ph2c->rsp = (u8 *)psetstakey_rsp; ph2c->rspsz = sizeof(struct set_stakey_rsp);
memcpy(psetstakey_para->addr, sta->hwaddr, ETH_ALEN); @@@ -1002,7 -1010,9 +1002,7 @@@ psetstakey_para->algorithm = _NO_PRIVACY_;
res = rtw_enqueue_cmd(pcmdpriv, ph2c); - } - exit: return res; } @@@ -1016,13 -1026,13 +1016,13 @@@ u8 rtw_addbareq_cmd(struct adapter *pad u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
paddbareq_parm = rtw_zmalloc(sizeof(struct addBaReq_parm)); - if (paddbareq_parm == NULL) { + if (!paddbareq_parm) { kfree(ph2c); res = _FAIL; goto exit; @@@ -1048,13 -1058,13 +1048,13 @@@ u8 rtw_reset_securitypriv_cmd(struct ad u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if (pdrvextra_cmd_parm == NULL) { + if (!pdrvextra_cmd_parm) { kfree(ph2c); res = _FAIL; goto exit; @@@ -1070,6 -1080,7 +1070,6 @@@
/* rtw_enqueue_cmd(pcmdpriv, ph2c); */ res = rtw_enqueue_cmd(pcmdpriv, ph2c); - exit: return res; } @@@ -1082,13 -1093,13 +1082,13 @@@ u8 rtw_free_assoc_resources_cmd(struct u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if (pdrvextra_cmd_parm == NULL) { + if (!pdrvextra_cmd_parm) { kfree(ph2c); res = _FAIL; goto exit; @@@ -1101,8 -1112,10 +1101,8 @@@
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
- /* rtw_enqueue_cmd(pcmdpriv, ph2c); */ res = rtw_enqueue_cmd(pcmdpriv, ph2c); - exit: return res; } @@@ -1116,13 -1129,13 +1116,13 @@@ u8 rtw_dynamic_chk_wk_cmd(struct adapte
/* only primary padapter does this cmd */ ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if (pdrvextra_cmd_parm == NULL) { + if (!pdrvextra_cmd_parm) { kfree(ph2c); res = _FAIL; goto exit; @@@ -1137,6 -1150,7 +1137,6 @@@
/* rtw_enqueue_cmd(pcmdpriv, ph2c); */ res = rtw_enqueue_cmd(pcmdpriv, ph2c); - exit: return res; } @@@ -1150,7 -1164,7 +1150,7 @@@ u8 rtw_set_chplan_cmd(struct adapter *p u8 res = _SUCCESS;
/* check if allow software config */ - if (swconfig && rtw_hal_is_disable_sw_channel_plan(padapter) == true) { + if (swconfig && rtw_hal_is_disable_sw_channel_plan(padapter)) { res = _FAIL; goto exit; } @@@ -1163,7 -1177,7 +1163,7 @@@
/* prepare cmd parameter */ setChannelPlan_param = rtw_zmalloc(sizeof(struct SetChannelPlan_param)); - if (setChannelPlan_param == NULL) { + if (!setChannelPlan_param) { res = _FAIL; goto exit; } @@@ -1172,7 -1186,7 +1172,7 @@@ if (enqueue) { /* need enqueue, prepare cmd_obj and enqueue */ pcmdobj = rtw_zmalloc(sizeof(struct cmd_obj)); - if (pcmdobj == NULL) { + if (!pcmdobj) { kfree(setChannelPlan_param); res = _FAIL; goto exit; @@@ -1229,14 -1243,14 +1229,14 @@@ u8 traffic_status_watchdog(struct adapt u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false; u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
collect_traffic_statistics(padapter);
/* */ /* Determine if our traffic is busy now */ /* */ - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) + if ((check_fwstate(pmlmepriv, _FW_LINKED)) /*&& !MgntInitAdapterInProgress(pMgntInfo)*/) { /* if we raise bBusyTraffic in last watchdog, using lower threshold. */ if (pmlmepriv->LinkDetectInfo.bBusyTraffic) @@@ -1268,7 -1282,7 +1268,7 @@@ (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) { bEnterPS = false;
- if (bBusyTraffic == true) { + if (bBusyTraffic) { if (pmlmepriv->LinkDetectInfo.TrafficTransitionCount <= 4) pmlmepriv->LinkDetectInfo.TrafficTransitionCount = 4;
@@@ -1301,7 -1315,7 +1301,7 @@@ struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); int n_assoc_iface = 0;
- if (check_fwstate(&(dvobj->padapters->mlmepriv), WIFI_ASOC_STATE)) + if (check_fwstate(&dvobj->padapters->mlmepriv, WIFI_ASOC_STATE)) n_assoc_iface++;
if (!from_timer && n_assoc_iface == 0) @@@ -1326,18 -1340,21 +1326,18 @@@ static void dynamic_chk_wk_hdl(struct a { struct mlme_priv *pmlmepriv;
- pmlmepriv = &(padapter->mlmepriv); + pmlmepriv = &padapter->mlmepriv;
- if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) expire_timeout_chk(padapter);
/* for debug purpose */ _linked_info_dump(padapter); - - /* if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING|_FW_UNDER_SURVEY) ==false) */ { linked_status_chk(padapter); traffic_status_watchdog(padapter, 0); } - rtw_hal_dm_watchdog(padapter);
/* check_hw_pbc(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type); */ @@@ -1357,11 -1374,11 +1357,11 @@@ void lps_ctrl_wk_hdl(struct adapter *pa void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; u8 mstatus;
- if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) - || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) || + check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { return; }
@@@ -1369,7 -1386,7 +1369,7 @@@ case LPS_CTRL_SCAN: hal_btcoex_ScanNotify(padapter, true);
- if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { /* connect */ LPS_Leave(padapter, "LPS_CTRL_SCAN"); } @@@ -1419,13 -1436,13 +1419,13 @@@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *
if (enqueue) { ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if (pdrvextra_cmd_parm == NULL) { + if (!pdrvextra_cmd_parm) { kfree(ph2c); res = _FAIL; goto exit; @@@ -1461,13 -1478,13 +1461,13 @@@ u8 rtw_dm_in_lps_wk_cmd(struct adapter
ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if (pdrvextra_cmd_parm == NULL) { + if (!pdrvextra_cmd_parm) { kfree(ph2c); res = _FAIL; goto exit; @@@ -1483,7 -1500,9 +1483,7 @@@ res = rtw_enqueue_cmd(pcmdpriv, ph2c);
exit: - return res; - }
static void rtw_lps_change_dtim_hdl(struct adapter *padapter, u8 dtim) @@@ -1493,7 -1512,7 +1493,7 @@@ if (dtim <= 0 || dtim > 16) return;
- if (hal_btcoex_IsBtControlLps(padapter) == true) + if (hal_btcoex_IsBtControlLps(padapter)) return;
mutex_lock(&pwrpriv->lock); @@@ -1523,14 -1542,15 +1523,14 @@@ u8 rtw_dm_ra_mask_wk_cmd(struct adapte struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS;
- ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if (pdrvextra_cmd_parm == NULL) { + if (!pdrvextra_cmd_parm) { kfree(ph2c); res = _FAIL; goto exit; @@@ -1557,14 -1577,15 +1557,14 @@@ u8 rtw_ps_cmd(struct adapter *padapter struct drvextra_cmd_parm *pdrvextra_cmd_parm; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; u8 res = _SUCCESS; - ppscmd = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ppscmd == NULL) { + if (!ppscmd) { res = _FAIL; goto exit; }
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if (pdrvextra_cmd_parm == NULL) { + if (!pdrvextra_cmd_parm) { kfree(ppscmd); res = _FAIL; goto exit; @@@ -1597,7 -1618,7 +1597,7 @@@ static void rtw_chk_hi_queue_hdl(struc
rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty);
- while (false == empty && jiffies_to_msecs(jiffies - start) < g_wait_hiq_empty) { + while (!empty && jiffies_to_msecs(jiffies - start) < g_wait_hiq_empty) { msleep(100); rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty); } @@@ -1630,13 -1651,13 +1630,13 @@@ u8 rtw_chk_hi_queue_cmd(struct adapter u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if (pdrvextra_cmd_parm == NULL) { + if (!pdrvextra_cmd_parm) { kfree(ph2c); res = _FAIL; goto exit; @@@ -1652,7 -1673,9 +1652,7 @@@ res = rtw_enqueue_cmd(pcmdpriv, ph2c);
exit: - return res; - }
struct btinfo { @@@ -1722,13 -1745,13 +1722,13 @@@ u8 rtw_c2h_packet_wk_cmd(struct adapte u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if (pdrvextra_cmd_parm == NULL) { + if (!pdrvextra_cmd_parm) { kfree(ph2c); res = _FAIL; goto exit; @@@ -1757,13 -1780,13 +1757,13 @@@ u8 rtw_c2h_wk_cmd(struct adapter *padap u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); - if (ph2c == NULL) { + if (!ph2c) { res = _FAIL; goto exit; }
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); - if (pdrvextra_cmd_parm == NULL) { + if (!pdrvextra_cmd_parm) { kfree(ph2c); res = _FAIL; goto exit; @@@ -1817,7 -1840,7 +1817,7 @@@ static void c2h_wk_callback(struct work continue; }
- if (ccx_id_filter(c2h_evt) == true) { + if (ccx_id_filter(c2h_evt)) { /* Handle CCX report here */ rtw_hal_c2h_handler(adapter, c2h_evt); kfree(c2h_evt); @@@ -1936,9 -1959,9 +1936,9 @@@ void rtw_createbss_cmd_callback(struct struct wlan_network *pwlan = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)pcmd->parmbuf; - struct wlan_network *tgt_network = &(pmlmepriv->cur_network); + struct wlan_network *tgt_network = &pmlmepriv->cur_network;
- if (pcmd->parmbuf == NULL) + if (!pcmd->parmbuf) goto exit;
if (pcmd->res != H2C_SUCCESS) @@@ -1960,20 -1983,20 +1960,20 @@@ rtw_indicate_connect(padapter); } else { pwlan = rtw_alloc_network(pmlmepriv); - spin_lock_bh(&(pmlmepriv->scanned_queue.lock)); - if (pwlan == NULL) { + spin_lock_bh(&pmlmepriv->scanned_queue.lock); + if (!pwlan) { pwlan = rtw_get_oldest_wlan_network(&pmlmepriv->scanned_queue); - if (pwlan == NULL) { - spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); + if (!pwlan) { + spin_unlock_bh(&pmlmepriv->scanned_queue.lock); goto createbss_cmd_fail; } pwlan->last_scanned = jiffies; } else { - list_add_tail(&(pwlan->list), &pmlmepriv->scanned_queue.queue); + list_add_tail(&pwlan->list, &pmlmepriv->scanned_queue.queue); }
pnetwork->length = get_wlan_bssid_ex_sz(pnetwork); - memcpy(&(pwlan->network), pnetwork, pnetwork->length); + memcpy(&pwlan->network, pnetwork, pnetwork->length); /* pwlan->fixed = true; */
/* list_add_tail(&(pwlan->list), &pmlmepriv->scanned_queue.queue); */ @@@ -1986,7 -2009,7 +1986,7 @@@
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
- spin_unlock_bh(&(pmlmepriv->scanned_queue.lock)); + spin_unlock_bh(&pmlmepriv->scanned_queue.lock); /* we will set _FW_LINKED when there is one more sat to join us (rtw_stassoc_event_callback) */
} @@@ -1998,10 -2021,13 +1998,10 @@@ exit rtw_free_cmd_obj(pcmd); }
- - void rtw_setstaKey_cmdrsp_callback(struct adapter *padapter, struct cmd_obj *pcmd) { - struct sta_priv *pstapriv = &padapter->stapriv; - struct set_stakey_rsp *psetstakey_rsp = (struct set_stakey_rsp *) (pcmd->rsp); + struct set_stakey_rsp *psetstakey_rsp = (struct set_stakey_rsp *)(pcmd->rsp); struct sta_info *psta = rtw_get_stainfo(pstapriv, psetstakey_rsp->addr);
if (!psta) @@@ -2016,7 -2042,7 +2016,7 @@@ void rtw_setassocsta_cmdrsp_callback(st struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct set_assocsta_parm *passocsta_parm = (struct set_assocsta_parm *)(pcmd->parmbuf); - struct set_assocsta_rsp *passocsta_rsp = (struct set_assocsta_rsp *) (pcmd->rsp); + struct set_assocsta_rsp *passocsta_rsp = (struct set_assocsta_rsp *)(pcmd->rsp); struct sta_info *psta = rtw_get_stainfo(pstapriv, passocsta_parm->addr);
if (!psta) @@@ -2027,7 -2053,7 +2027,7 @@@
spin_lock_bh(&pmlmepriv->lock);
- if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)) + if (check_fwstate(pmlmepriv, WIFI_MP_STATE) && check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
set_fwstate(pmlmepriv, _FW_LINKED); diff --combined drivers/staging/rtl8723bs/core/rtw_xmit.c index 46054d6a1fb5,0c357bc2478c..13b8bd5ffabc --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c @@@ -13,8 -13,7 +13,8 @@@ static u8 RFC1042_OUI[P80211_OUI_LEN] static void _init_txservq(struct tx_servq *ptxservq) { INIT_LIST_HEAD(&ptxservq->tx_pending); - _rtw_init_queue(&ptxservq->sta_pending); + INIT_LIST_HEAD(&ptxservq->sta_pending.queue); + spin_lock_init(&ptxservq->sta_pending.lock); ptxservq->qcnt = 0; }
@@@ -50,19 -49,13 +50,19 @@@ s32 _rtw_init_xmit_priv(struct xmit_pri
pxmitpriv->adapter = padapter;
- _rtw_init_queue(&pxmitpriv->be_pending); - _rtw_init_queue(&pxmitpriv->bk_pending); - _rtw_init_queue(&pxmitpriv->vi_pending); - _rtw_init_queue(&pxmitpriv->vo_pending); - _rtw_init_queue(&pxmitpriv->bm_pending); + INIT_LIST_HEAD(&pxmitpriv->be_pending.queue); + spin_lock_init(&pxmitpriv->be_pending.lock); + INIT_LIST_HEAD(&pxmitpriv->bk_pending.queue); + spin_lock_init(&pxmitpriv->bk_pending.lock); + INIT_LIST_HEAD(&pxmitpriv->vi_pending.queue); + spin_lock_init(&pxmitpriv->vi_pending.lock); + INIT_LIST_HEAD(&pxmitpriv->vo_pending.queue); + spin_lock_init(&pxmitpriv->vo_pending.lock); + INIT_LIST_HEAD(&pxmitpriv->bm_pending.queue); + spin_lock_init(&pxmitpriv->bm_pending.lock);
- _rtw_init_queue(&pxmitpriv->free_xmit_queue); + INIT_LIST_HEAD(&pxmitpriv->free_xmit_queue.queue); + spin_lock_init(&pxmitpriv->free_xmit_queue.lock);
/* * Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME, @@@ -103,10 -96,8 +103,10 @@@ pxmitpriv->frag_len = MAX_FRAG_THRESHOLD;
/* init xmit_buf */ - _rtw_init_queue(&pxmitpriv->free_xmitbuf_queue); - _rtw_init_queue(&pxmitpriv->pending_xmitbuf_queue); + INIT_LIST_HEAD(&pxmitpriv->free_xmitbuf_queue.queue); + spin_lock_init(&pxmitpriv->free_xmitbuf_queue.lock); + INIT_LIST_HEAD(&pxmitpriv->pending_xmitbuf_queue.queue); + spin_lock_init(&pxmitpriv->pending_xmitbuf_queue.lock);
pxmitpriv->pallocated_xmitbuf = vzalloc(NR_XMITBUFF * sizeof(struct xmit_buf) + 4);
@@@ -154,8 -145,7 +154,8 @@@ pxmitpriv->free_xmitbuf_cnt = NR_XMITBUFF;
/* init xframe_ext queue, the same count as extbuf */ - _rtw_init_queue(&pxmitpriv->free_xframe_ext_queue); + INIT_LIST_HEAD(&pxmitpriv->free_xframe_ext_queue.queue); + spin_lock_init(&pxmitpriv->free_xframe_ext_queue.lock);
pxmitpriv->xframe_ext_alloc_addr = vzalloc(NR_XMIT_EXTBUFF * sizeof(struct xmit_frame) + 4);
@@@ -188,8 -178,7 +188,8 @@@ pxmitpriv->free_xframe_ext_cnt = NR_XMIT_EXTBUFF;
/* Init xmit extension buff */ - _rtw_init_queue(&pxmitpriv->free_xmit_extbuf_queue); + INIT_LIST_HEAD(&pxmitpriv->free_xmit_extbuf_queue.queue); + spin_lock_init(&pxmitpriv->free_xmit_extbuf_queue.lock);
pxmitpriv->pallocated_xmit_extbuf = vzalloc(NR_XMIT_EXTBUFF * sizeof(struct xmit_buf) + 4);
@@@ -1734,12 -1723,15 +1734,12 @@@ void rtw_free_xmitframe_queue(struct xm struct list_head *plist, *phead, *tmp; struct xmit_frame *pxmitframe;
- spin_lock_bh(&pframequeue->lock); - phead = get_list_head(pframequeue); list_for_each_safe(plist, tmp, phead) { pxmitframe = list_entry(plist, struct xmit_frame, list);
rtw_free_xmitframe(pxmitpriv, pxmitframe); } - spin_unlock_bh(&pframequeue->lock); }
s32 rtw_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe) @@@ -1794,7 -1786,6 +1794,7 @@@ s32 rtw_xmit_classifier(struct adapter struct sta_info *psta; struct tx_servq *ptxservq; struct pkt_attrib *pattrib = &pxmitframe->attrib; + struct xmit_priv *xmit_priv = &padapter->xmitpriv; struct hw_xmit *phwxmits = padapter->xmitpriv.hwxmits; signed int res = _SUCCESS;
@@@ -1812,14 -1803,12 +1812,14 @@@
ptxservq = rtw_get_sta_pending(padapter, psta, pattrib->priority, (u8 *)(&ac_index));
+ spin_lock_bh(&xmit_priv->lock); if (list_empty(&ptxservq->tx_pending)) list_add_tail(&ptxservq->tx_pending, get_list_head(phwxmits[ac_index].sta_queue));
list_add_tail(&pxmitframe->list, get_list_head(&ptxservq->sta_pending)); ptxservq->qcnt++; phwxmits[ac_index].accnt++; + spin_unlock_bh(&xmit_priv->lock);
exit:
@@@ -2202,10 -2191,11 +2202,10 @@@ void wakeup_sta_to_xmit(struct adapter struct list_head *xmitframe_plist, *xmitframe_phead, *tmp; struct xmit_frame *pxmitframe = NULL; struct sta_priv *pstapriv = &padapter->stapriv; - struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
psta_bmc = rtw_get_bcmc_stainfo(padapter);
- spin_lock_bh(&pxmitpriv->lock); + spin_lock_bh(&psta->sleep_q.lock);
xmitframe_phead = get_list_head(&psta->sleep_q); list_for_each_safe(xmitframe_plist, tmp, xmitframe_phead) { @@@ -2306,7 -2296,7 +2306,7 @@@
_exit:
- spin_unlock_bh(&pxmitpriv->lock); + spin_unlock_bh(&psta->sleep_q.lock);
if (update_mask) update_beacon(padapter, WLAN_EID_TIM, NULL, true); @@@ -2318,8 -2308,9 +2318,8 @@@ void xmit_delivery_enabled_frames(struc struct list_head *xmitframe_plist, *xmitframe_phead, *tmp; struct xmit_frame *pxmitframe = NULL; struct sta_priv *pstapriv = &padapter->stapriv; - struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
- spin_lock_bh(&pxmitpriv->lock); + spin_lock_bh(&psta->sleep_q.lock);
xmitframe_phead = get_list_head(&psta->sleep_q); list_for_each_safe(xmitframe_plist, tmp, xmitframe_phead) { @@@ -2372,7 -2363,7 +2372,7 @@@ } }
- spin_unlock_bh(&pxmitpriv->lock); + spin_unlock_bh(&psta->sleep_q.lock); }
void enqueue_pending_xmitbuf(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf) @@@ -2500,7 -2491,7 +2500,7 @@@ int rtw_xmit_thread(void *context
complete(&padapter->xmitpriv.terminate_xmitthread_comp);
- thread_exit(); + return 0; }
void rtw_sctx_init(struct submit_ctx *sctx, int timeout_ms) diff --combined drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c index 5f5c4719b586,2b9a41b12d1f..7fe3df863fe1 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c @@@ -435,7 -435,7 +435,7 @@@ int rtl8723bs_xmit_thread(void *context
complete(&pxmitpriv->SdioXmitTerminate);
- thread_exit(); + return 0; }
s32 rtl8723bs_mgnt_xmit( @@@ -507,7 -507,9 +507,7 @@@ s32 rtl8723bs_hal_xmit rtw_issue_addbareq_cmd(padapter, pxmitframe); }
- spin_lock_bh(&pxmitpriv->lock); err = rtw_xmitframe_enqueue(padapter, pxmitframe); - spin_unlock_bh(&pxmitpriv->lock); if (err != _SUCCESS) { rtw_free_xmitframe(pxmitpriv, pxmitframe);
diff --combined fs/ocfs2/journal.c index b9c339335a53,329986f12db3..dbf9b9e97d74 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@@ -810,34 -810,19 +810,34 @@@ void ocfs2_set_journal_params(struct oc write_unlock(&journal->j_state_lock); }
-int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty) +int ocfs2_journal_init(struct ocfs2_super *osb, int *dirty) { int status = -1; struct inode *inode = NULL; /* the journal inode */ journal_t *j_journal = NULL; + struct ocfs2_journal *journal = NULL; struct ocfs2_dinode *di = NULL; struct buffer_head *bh = NULL; - struct ocfs2_super *osb; int inode_lock = 0;
- BUG_ON(!journal); + /* initialize our journal structure */ + journal = kzalloc(sizeof(struct ocfs2_journal), GFP_KERNEL); + if (!journal) { + mlog(ML_ERROR, "unable to alloc journal\n"); + status = -ENOMEM; + goto done; + } + osb->journal = journal; + journal->j_osb = osb;
- osb = journal->j_osb; + atomic_set(&journal->j_num_trans, 0); + init_rwsem(&journal->j_trans_barrier); + init_waitqueue_head(&journal->j_checkpointed); + spin_lock_init(&journal->j_lock); + journal->j_trans_id = 1UL; + INIT_LIST_HEAD(&journal->j_la_cleanups); + INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery); + journal->j_state = OCFS2_JOURNAL_FREE;
/* already have the inode for our journal */ inode = ocfs2_get_system_file_inode(osb, JOURNAL_SYSTEM_INODE, @@@ -1043,10 -1028,9 +1043,10 @@@ void ocfs2_journal_shutdown(struct ocfs
journal->j_state = OCFS2_JOURNAL_FREE;
-// up_write(&journal->j_trans_barrier); done: iput(inode); + kfree(journal); + osb->journal = NULL; }
static void ocfs2_clear_journal_error(struct super_block *sb, @@@ -1513,10 -1497,7 +1513,7 @@@ bail if (quota_enabled) kfree(rm_quota);
- /* no one is callint kthread_stop() for us so the kthread() api - * requires that we call do_exit(). And it isn't exported, but - * complete_and_exit() seems to be a minimal wrapper around it. */ - complete_and_exit(NULL, status); + return status; }
void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num) diff --combined kernel/kthread.c index 4a4d7092a2d8,33e17beaa682..7113003fab63 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@@ -270,7 -270,6 +270,7 @@@ EXPORT_SYMBOL_GPL(kthread_parkme)
static int kthread(void *_create) { + static const struct sched_param param = { .sched_priority = 0 }; /* Copy data: it's on kthread's stack */ struct kthread_create_info *create = _create; int (*threadfn)(void *data) = create->threadfn; @@@ -301,13 -300,6 +301,13 @@@ init_completion(&self->parked); current->vfork_done = &self->exited;
+ /* + * The new thread inherited kthreadd's priority and CPU mask. Reset + * back to default in case they have been changed. + */ + sched_setscheduler_nocheck(current, SCHED_NORMAL, ¶m); + set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_KTHREAD)); + /* OK, tell user we're spawned, wait for stop or wakeup */ __set_current_state(TASK_UNINTERRUPTIBLE); create->result = current; @@@ -405,6 -397,7 +405,6 @@@ struct task_struct *__kthread_create_on } task = create->result; if (!IS_ERR(task)) { - static const struct sched_param param = { .sched_priority = 0 }; char name[TASK_COMM_LEN];
/* @@@ -413,6 -406,13 +413,6 @@@ */ vsnprintf(name, sizeof(name), namefmt, args); set_task_comm(task, name); - /* - * root may have changed our (kthreadd's) priority or CPU mask. - * The kernel thread should not inherit these properties. - */ - sched_setscheduler_nocheck(task, SCHED_NORMAL, ¶m); - set_cpus_allowed_ptr(task, - housekeeping_cpumask(HK_FLAG_KTHREAD)); } kfree(create); return task; @@@ -433,7 -433,7 +433,7 @@@ * If thread is going to be bound on a particular cpu, give its node * in @node, to get NUMA affinity for kthread stack, or else give NUMA_NO_NODE. * When woken, the thread will run @threadfn() with @data as its - * argument. @threadfn() can either call do_exit() directly if it is a + * argument. @threadfn() can either return directly if it is a * standalone thread for which no one will call kthread_stop(), or * return when 'kthread_should_stop()' is true (which means * kthread_stop() has been called). The return value should be zero diff --combined kernel/reboot.c index efb40d095d1e,d6e0f9fb7f04..6bcc5d6a6572 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@@ -33,7 -33,6 +33,7 @@@ EXPORT_SYMBOL(cad_pid) #define DEFAULT_REBOOT_MODE #endif enum reboot_mode reboot_mode DEFAULT_REBOOT_MODE; +EXPORT_SYMBOL_GPL(reboot_mode); enum reboot_mode panic_reboot_mode = REBOOT_UNDEFINED;
/* @@@ -360,7 -359,6 +360,6 @@@ SYSCALL_DEFINE4(reboot, int, magic1, in case LINUX_REBOOT_CMD_HALT: kernel_halt(); do_exit(0); - panic("cannot halt");
case LINUX_REBOOT_CMD_POWER_OFF: kernel_power_off(); diff --combined kernel/signal.c index 6f3476dc7873,505aa7fbfe43..7c4b7ae714d4 --- a/kernel/signal.c +++ b/kernel/signal.c @@@ -1323,6 -1323,7 +1323,7 @@@ force_sig_info_to_task(struct kernel_si blocked = sigismember(&t->blocked, sig); if (blocked || ignored || sigdfl) { action->sa.sa_handler = SIG_DFL; + action->sa.sa_flags |= SA_IMMUTABLE; if (blocked) { sigdelset(&t->blocked, sig); recalc_sigpending_and_wake(t); @@@ -1649,6 -1650,19 +1650,19 @@@ void force_sig(int sig } EXPORT_SYMBOL(force_sig);
+ void force_fatal_sig(int sig) + { + struct kernel_siginfo info; + + clear_siginfo(&info); + info.si_signo = sig; + info.si_errno = 0; + info.si_code = SI_KERNEL; + info.si_pid = 0; + info.si_uid = 0; + force_sig_info_to_task(&info, current, true); + } + /* * When things go south during signal handling, we * will force a SIGSEGV. And if the signal that caused @@@ -1657,15 -1671,10 +1671,10 @@@ */ void force_sigsegv(int sig) { - struct task_struct *p = current; - - if (sig == SIGSEGV) { - unsigned long flags; - spin_lock_irqsave(&p->sighand->siglock, flags); - p->sighand->action[sig - 1].sa.sa_handler = SIG_DFL; - spin_unlock_irqrestore(&p->sighand->siglock, flags); - } - force_sig(SIGSEGV); + if (sig == SIGSEGV) + force_fatal_sig(SIGSEGV); + else + force_sig(SIGSEGV); }
int force_sig_fault_to_task(int sig, int code, void __user *addr @@@ -2704,7 -2713,8 +2713,8 @@@ relock if (!signr) break; /* will return 0 */
- if (unlikely(current->ptrace) && signr != SIGKILL) { + if (unlikely(current->ptrace) && (signr != SIGKILL) && + !(sighand->action[signr -1].sa.sa_flags & SA_IMMUTABLE)) { signr = ptrace_signal(signr, &ksig->info); if (!signr) continue; @@@ -4054,6 -4064,10 +4064,10 @@@ int do_sigaction(int sig, struct k_siga k = &p->sighand->action[sig-1];
spin_lock_irq(&p->sighand->siglock); + if (k->sa.sa_flags & SA_IMMUTABLE) { + spin_unlock_irq(&p->sighand->siglock); + return -EINVAL; + } if (oact) *oact = *k;
@@@ -4103,29 -4117,11 +4117,29 @@@ return 0; }
+#ifdef CONFIG_DYNAMIC_SIGFRAME +static inline void sigaltstack_lock(void) + __acquires(¤t->sighand->siglock) +{ + spin_lock_irq(¤t->sighand->siglock); +} + +static inline void sigaltstack_unlock(void) + __releases(¤t->sighand->siglock) +{ + spin_unlock_irq(¤t->sighand->siglock); +} +#else +static inline void sigaltstack_lock(void) { } +static inline void sigaltstack_unlock(void) { } +#endif + static int do_sigaltstack (const stack_t *ss, stack_t *oss, unsigned long sp, size_t min_ss_size) { struct task_struct *t = current; + int ret = 0;
if (oss) { memset(oss, 0, sizeof(stack_t)); @@@ -4149,24 -4145,19 +4163,24 @@@ ss_mode != 0)) return -EINVAL;
+ sigaltstack_lock(); if (ss_mode == SS_DISABLE) { ss_size = 0; ss_sp = NULL; } else { if (unlikely(ss_size < min_ss_size)) - return -ENOMEM; + ret = -ENOMEM; + if (!sigaltstack_size_valid(ss_size)) + ret = -ENOMEM; } - - t->sas_ss_sp = (unsigned long) ss_sp; - t->sas_ss_size = ss_size; - t->sas_ss_flags = ss_flags; + if (!ret) { + t->sas_ss_sp = (unsigned long) ss_sp; + t->sas_ss_size = ss_size; + t->sas_ss_flags = ss_flags; + } + sigaltstack_unlock(); } - return 0; + return ret; }
SYSCALL_DEFINE2(sigaltstack,const stack_t __user *,uss, stack_t __user *,uoss) diff --combined net/batman-adv/tp_meter.c index fbcb15c7c29b,1252540cde17..93730d30af54 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@@ -631,9 -631,9 +631,9 @@@ static void batadv_tp_recv_ack(struct b struct batadv_orig_node *orig_node = NULL; const struct batadv_icmp_tp_packet *icmp; struct batadv_tp_vars *tp_vars; + const unsigned char *dev_addr; size_t packet_len, mss; u32 rtt, recv_ack, cwnd; - unsigned char *dev_addr;
packet_len = BATADV_TP_PLEN; mss = BATADV_TP_PLEN; @@@ -890,7 -890,7 +890,7 @@@ out
batadv_tp_vars_put(tp_vars);
- do_exit(0); + return 0; }
/**
linux-merge@lists.open-mesh.org