2010-08-20 15:15:30 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* rtl8712_led.c
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
|
|
|
|
* Linux device driver for RTL8192SU
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
* Modifications for inclusion into the Linux staging tree are
|
|
|
|
* Copyright(c) 2010 Larry Finger. All rights reserved.
|
|
|
|
*
|
|
|
|
* Contact information:
|
|
|
|
* WLAN FAE <wlanfae@realtek.com>
|
|
|
|
* Larry Finger <Larry.Finger@lwfinger.net>
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#include "drv_types.h"
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
* Constant.
|
|
|
|
*===========================================================================
|
|
|
|
|
|
|
|
*
|
|
|
|
* Default LED behavior.
|
|
|
|
*/
|
|
|
|
#define LED_BLINK_NORMAL_INTERVAL 100
|
|
|
|
#define LED_BLINK_SLOWLY_INTERVAL 200
|
|
|
|
#define LED_BLINK_LONG_INTERVAL 400
|
|
|
|
|
|
|
|
#define LED_BLINK_NO_LINK_INTERVAL_ALPHA 1000
|
|
|
|
#define LED_BLINK_LINK_INTERVAL_ALPHA 500
|
|
|
|
#define LED_BLINK_SCAN_INTERVAL_ALPHA 180
|
|
|
|
#define LED_BLINK_FASTER_INTERVAL_ALPHA 50
|
2016-09-16 21:05:21 +00:00
|
|
|
#define LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA 5000
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
* LED object.
|
|
|
|
*===========================================================================
|
|
|
|
*/
|
2011-04-02 01:02:12 +00:00
|
|
|
enum _LED_STATE_871x {
|
2010-08-20 15:15:30 +00:00
|
|
|
LED_UNKNOWN = 0,
|
2016-09-27 21:51:49 +00:00
|
|
|
LED_STATE_ON = 1,
|
|
|
|
LED_STATE_OFF = 2,
|
2010-08-20 15:15:30 +00:00
|
|
|
LED_BLINK_NORMAL = 3,
|
|
|
|
LED_BLINK_SLOWLY = 4,
|
|
|
|
LED_POWER_ON_BLINK = 5,
|
|
|
|
LED_SCAN_BLINK = 6, /* LED is blinking during scanning period,
|
|
|
|
* the # of times to blink is depend on time
|
2016-09-09 15:31:45 +00:00
|
|
|
* for scanning.
|
|
|
|
*/
|
2010-08-20 15:15:30 +00:00
|
|
|
LED_NO_LINK_BLINK = 7, /* LED is blinking during no link state. */
|
2012-05-07 14:38:22 +00:00
|
|
|
LED_BLINK_StartToBlink = 8,/* Customized for Sercomm Printer
|
2016-09-09 15:31:45 +00:00
|
|
|
* Server case
|
|
|
|
*/
|
2010-08-20 15:15:30 +00:00
|
|
|
LED_BLINK_WPS = 9, /* LED is blinkg during WPS communication */
|
|
|
|
LED_TXRX_BLINK = 10,
|
|
|
|
LED_BLINK_WPS_STOP = 11, /*for ALPHA */
|
|
|
|
LED_BLINK_WPS_STOP_OVERLAP = 12, /*for BELKIN */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
* Prototype of protected function.
|
|
|
|
*===========================================================================
|
|
|
|
*/
|
treewide: setup_timer() -> timer_setup()
This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.
Casting from unsigned long:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);
and forced object casts:
void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
become:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
Direct function assignments:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;
have a temporary cast added, along with converting the args:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
And finally, callbacks without a data assignment:
void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);
have their argument renamed to verify they're unused during conversion:
void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
The conversion is done with the following Coccinelle script:
spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci
@fix_address_of@
expression e;
@@
setup_timer(
-&(e)
+&e
, ...)
// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@
(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)
@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@
(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)
// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}
// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}
// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@
void _callback(struct timer_list *t)
{ ... }
// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@
void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}
// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@
void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}
// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@
(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)
// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@
(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)
// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@
_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)
// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@
(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)
@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@
void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-16 21:43:17 +00:00
|
|
|
static void BlinkTimerCallback(struct timer_list *t);
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
static void BlinkWorkItemCallback(struct work_struct *work);
|
|
|
|
/*===========================================================================
|
|
|
|
* LED_819xUsb routines.
|
|
|
|
*===========================================================================
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initialize an LED_871x object.
|
|
|
|
*/
|
|
|
|
static void InitLed871x(struct _adapter *padapter, struct LED_871x *pLed,
|
|
|
|
enum LED_PIN_871x LedPin)
|
|
|
|
{
|
|
|
|
struct net_device *nic;
|
|
|
|
|
|
|
|
nic = padapter->pnetdev;
|
|
|
|
pLed->padapter = padapter;
|
|
|
|
pLed->LedPin = LedPin;
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedOn = false;
|
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
pLed->BlinkTimes = 0;
|
|
|
|
pLed->BlinkingLedState = LED_UNKNOWN;
|
treewide: setup_timer() -> timer_setup()
This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.
Casting from unsigned long:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);
and forced object casts:
void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
become:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
Direct function assignments:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;
have a temporary cast added, along with converting the args:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
And finally, callbacks without a data assignment:
void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);
have their argument renamed to verify they're unused during conversion:
void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
The conversion is done with the following Coccinelle script:
spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci
@fix_address_of@
expression e;
@@
setup_timer(
-&(e)
+&e
, ...)
// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@
(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)
@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@
(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)
// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}
// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}
// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@
void _callback(struct timer_list *t)
{ ... }
// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@
void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}
// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@
void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}
// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@
(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)
// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@
(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)
// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@
_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)
// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@
(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)
@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@
void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-16 21:43:17 +00:00
|
|
|
timer_setup(&pLed->BlinkTimer, BlinkTimerCallback, 0);
|
2014-07-09 19:10:45 +00:00
|
|
|
INIT_WORK(&pLed->BlinkWorkItem, BlinkWorkItemCallback);
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description:
|
|
|
|
* DeInitialize an LED_871x object.
|
|
|
|
*/
|
|
|
|
static void DeInitLed871x(struct LED_871x *pLed)
|
|
|
|
{
|
2015-03-06 10:53:35 +00:00
|
|
|
del_timer_sync(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
/* We should reset bLedBlinkInProgress if we cancel
|
2016-09-09 15:31:45 +00:00
|
|
|
* the LedControlTimer,
|
|
|
|
*/
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description:
|
|
|
|
* Turn on LED according to LedPin specified.
|
|
|
|
*/
|
|
|
|
static void SwLedOn(struct _adapter *padapter, struct LED_871x *pLed)
|
|
|
|
{
|
|
|
|
u8 LedCfg;
|
|
|
|
|
2015-10-19 17:14:29 +00:00
|
|
|
if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
|
2010-08-20 15:15:30 +00:00
|
|
|
return;
|
|
|
|
LedCfg = r8712_read8(padapter, LEDCFG);
|
|
|
|
switch (pLed->LedPin) {
|
|
|
|
case LED_PIN_GPIO0:
|
|
|
|
break;
|
|
|
|
case LED_PIN_LED0:
|
|
|
|
/* SW control led0 on.*/
|
2015-10-19 17:16:01 +00:00
|
|
|
r8712_write8(padapter, LEDCFG, LedCfg & 0xf0);
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_PIN_LED1:
|
|
|
|
/* SW control led1 on.*/
|
2015-10-19 17:16:01 +00:00
|
|
|
r8712_write8(padapter, LEDCFG, LedCfg & 0x0f);
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pLed->bLedOn = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description:
|
|
|
|
* Turn off LED according to LedPin specified.
|
|
|
|
*/
|
|
|
|
static void SwLedOff(struct _adapter *padapter, struct LED_871x *pLed)
|
|
|
|
{
|
|
|
|
u8 LedCfg;
|
|
|
|
|
2015-10-19 17:14:29 +00:00
|
|
|
if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
|
2010-08-20 15:15:30 +00:00
|
|
|
return;
|
|
|
|
LedCfg = r8712_read8(padapter, LEDCFG);
|
|
|
|
switch (pLed->LedPin) {
|
|
|
|
case LED_PIN_GPIO0:
|
|
|
|
break;
|
|
|
|
case LED_PIN_LED0:
|
|
|
|
LedCfg &= 0xf0; /* Set to software control.*/
|
2015-10-19 17:16:01 +00:00
|
|
|
r8712_write8(padapter, LEDCFG, (LedCfg | BIT(3)));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_PIN_LED1:
|
|
|
|
LedCfg &= 0x0f; /* Set to software control.*/
|
2015-10-19 17:16:01 +00:00
|
|
|
r8712_write8(padapter, LEDCFG, (LedCfg | BIT(7)));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pLed->bLedOn = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
* Interface to manipulate LED objects.
|
|
|
|
*===========================================================================
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initialize all LED_871x objects.
|
|
|
|
*/
|
|
|
|
void r8712_InitSwLeds(struct _adapter *padapter)
|
|
|
|
{
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *pledpriv = &padapter->ledpriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
pledpriv->LedControlHandler = LedControl871x;
|
2018-03-03 05:32:36 +00:00
|
|
|
InitLed871x(padapter, &pledpriv->SwLed0, LED_PIN_LED0);
|
|
|
|
InitLed871x(padapter, &pledpriv->SwLed1, LED_PIN_LED1);
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Description:
|
|
|
|
* DeInitialize all LED_819xUsb objects.
|
|
|
|
*/
|
|
|
|
void r8712_DeInitSwLeds(struct _adapter *padapter)
|
|
|
|
{
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
2018-03-03 05:32:36 +00:00
|
|
|
DeInitLed871x(&ledpriv->SwLed0);
|
|
|
|
DeInitLed871x(&ledpriv->SwLed1);
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Description:
|
|
|
|
* Implementation of LED blinking behavior.
|
|
|
|
* It toggle off LED and schedule corresponding timer if necessary.
|
|
|
|
*/
|
|
|
|
static void SwLedBlink(struct LED_871x *pLed)
|
|
|
|
{
|
|
|
|
struct _adapter *padapter = pLed->padapter;
|
2018-03-03 05:32:36 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
u8 bStopBlinking = false;
|
|
|
|
|
|
|
|
/* Change LED according to BlinkingLedState specified. */
|
2016-09-27 21:51:49 +00:00
|
|
|
if (pLed->BlinkingLedState == LED_STATE_ON)
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
else
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
/* Determine if we shall change LED state again. */
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
switch (pLed->CurrLedState) {
|
|
|
|
case LED_BLINK_NORMAL:
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
break;
|
|
|
|
case LED_BLINK_StartToBlink:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED) &&
|
2010-08-20 15:15:30 +00:00
|
|
|
(pmlmepriv->fw_state & WIFI_STATION_STATE))
|
|
|
|
bStopBlinking = true;
|
2015-10-19 17:14:29 +00:00
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED) &&
|
|
|
|
((pmlmepriv->fw_state & WIFI_ADHOC_STATE) ||
|
2010-08-20 15:15:30 +00:00
|
|
|
(pmlmepriv->fw_state & WIFI_ADHOC_MASTER_STATE)))
|
|
|
|
bStopBlinking = true;
|
|
|
|
else if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS:
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bStopBlinking = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (bStopBlinking) {
|
2015-10-19 17:14:29 +00:00
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED) &&
|
|
|
|
!pLed->bLedOn)
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
2015-10-19 17:14:29 +00:00
|
|
|
else if (check_fwstate(pmlmepriv, _FW_LINKED) && pLed->bLedOn)
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
pLed->BlinkTimes = 0;
|
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
} else {
|
|
|
|
/* Assign LED state to toggle. */
|
2016-09-27 21:51:49 +00:00
|
|
|
if (pLed->BlinkingLedState == LED_STATE_ON)
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
/* Schedule a timer to toggle LED state. */
|
|
|
|
switch (pLed->CurrLedState) {
|
|
|
|
case LED_BLINK_NORMAL:
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_BLINK_SLOWLY:
|
|
|
|
case LED_BLINK_StartToBlink:
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS:
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_LONG_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SwLedBlink1(struct LED_871x *pLed)
|
|
|
|
{
|
|
|
|
struct _adapter *padapter = pLed->padapter;
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
struct eeprom_priv *peeprompriv = &padapter->eeprompriv;
|
|
|
|
struct LED_871x *pLed1 = &ledpriv->SwLed1;
|
2010-08-20 15:15:30 +00:00
|
|
|
u8 bStopBlinking = false;
|
|
|
|
|
|
|
|
if (peeprompriv->CustomerID == RT_CID_819x_CAMEO)
|
2018-03-03 05:32:36 +00:00
|
|
|
pLed = &ledpriv->SwLed1;
|
2010-08-20 15:15:30 +00:00
|
|
|
/* Change LED according to BlinkingLedState specified. */
|
2016-09-27 21:51:49 +00:00
|
|
|
if (pLed->BlinkingLedState == LED_STATE_ON)
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
else
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
if (peeprompriv->CustomerID == RT_CID_DEFAULT) {
|
2015-10-19 17:14:29 +00:00
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (!pLed1->bSWLedCtrl) {
|
|
|
|
SwLedOn(padapter, pLed1);
|
|
|
|
pLed1->bSWLedCtrl = true;
|
2015-10-19 17:15:29 +00:00
|
|
|
} else if (!pLed1->bLedOn) {
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed1);
|
2015-10-19 17:15:29 +00:00
|
|
|
}
|
2010-08-20 15:15:30 +00:00
|
|
|
} else {
|
|
|
|
if (!pLed1->bSWLedCtrl) {
|
|
|
|
SwLedOff(padapter, pLed1);
|
|
|
|
pLed1->bSWLedCtrl = true;
|
2015-10-19 17:15:29 +00:00
|
|
|
} else if (pLed1->bLedOn) {
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOff(padapter, pLed1);
|
2015-10-19 17:15:29 +00:00
|
|
|
}
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
switch (pLed->CurrLedState) {
|
|
|
|
case LED_BLINK_SLOWLY:
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_BLINK_NORMAL:
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_SCAN_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
2015-10-19 17:14:29 +00:00
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_NORMAL;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
} else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
} else {
|
2016-11-17 09:16:42 +00:00
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_TXRX_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
2015-10-19 17:14:29 +00:00
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_NORMAL;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
} else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
pLed->BlinkTimes = 0;
|
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
} else {
|
2016-11-17 09:16:42 +00:00
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS:
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS_STOP: /* WPS success */
|
2016-09-27 21:51:49 +00:00
|
|
|
if (pLed->BlinkingLedState == LED_STATE_ON) {
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
2016-09-16 21:05:21 +00:00
|
|
|
msecs_to_jiffies(LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
bStopBlinking = false;
|
2015-10-19 17:15:29 +00:00
|
|
|
} else {
|
2010-08-20 15:15:30 +00:00
|
|
|
bStopBlinking = true;
|
2015-10-19 17:15:29 +00:00
|
|
|
}
|
2010-08-20 15:15:30 +00:00
|
|
|
if (bStopBlinking) {
|
|
|
|
pLed->bLedLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_NORMAL;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SwLedBlink2(struct LED_871x *pLed)
|
|
|
|
{
|
|
|
|
struct _adapter *padapter = pLed->padapter;
|
|
|
|
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
|
|
|
u8 bStopBlinking = false;
|
|
|
|
|
|
|
|
/* Change LED according to BlinkingLedState specified. */
|
2016-09-27 21:51:49 +00:00
|
|
|
if (pLed->BlinkingLedState == LED_STATE_ON)
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
else
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
switch (pLed->CurrLedState) {
|
|
|
|
case LED_SCAN_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
2015-10-19 17:14:29 +00:00
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
} else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
}
|
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
} else {
|
2016-11-17 09:16:42 +00:00
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_TXRX_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
2015-10-19 17:14:29 +00:00
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
} else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
}
|
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
} else {
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SwLedBlink3(struct LED_871x *pLed)
|
|
|
|
{
|
|
|
|
struct _adapter *padapter = pLed->padapter;
|
2018-03-03 05:32:36 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
u8 bStopBlinking = false;
|
|
|
|
|
|
|
|
/* Change LED according to BlinkingLedState specified. */
|
2016-09-27 21:51:49 +00:00
|
|
|
if (pLed->BlinkingLedState == LED_STATE_ON)
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
else
|
|
|
|
if (pLed->CurrLedState != LED_BLINK_WPS_STOP)
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
switch (pLed->CurrLedState) {
|
|
|
|
case LED_SCAN_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
2015-10-19 17:14:29 +00:00
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (!pLed->bLedOn)
|
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
} else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->bLedOn)
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
}
|
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
} else {
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_TXRX_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
2015-10-19 17:14:29 +00:00
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (!pLed->bLedOn)
|
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
} else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->bLedOn)
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
}
|
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
} else {
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS:
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS_STOP: /*WPS success*/
|
2016-09-27 21:51:49 +00:00
|
|
|
if (pLed->BlinkingLedState == LED_STATE_ON) {
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
2016-09-16 21:05:21 +00:00
|
|
|
msecs_to_jiffies(LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
bStopBlinking = false;
|
2015-10-19 17:15:29 +00:00
|
|
|
} else {
|
2010-08-20 15:15:30 +00:00
|
|
|
bStopBlinking = true;
|
2015-10-19 17:15:29 +00:00
|
|
|
}
|
2010-08-20 15:15:30 +00:00
|
|
|
if (bStopBlinking) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SwLedBlink4(struct LED_871x *pLed)
|
|
|
|
{
|
|
|
|
struct _adapter *padapter = pLed->padapter;
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
|
|
|
struct LED_871x *pLed1 = &ledpriv->SwLed1;
|
2010-08-20 15:15:30 +00:00
|
|
|
u8 bStopBlinking = false;
|
|
|
|
|
|
|
|
/* Change LED according to BlinkingLedState specified. */
|
2016-09-27 21:51:49 +00:00
|
|
|
if (pLed->BlinkingLedState == LED_STATE_ON)
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
else
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
if (!pLed1->bLedWPSBlinkInProgress &&
|
|
|
|
pLed1->BlinkingLedState == LED_UNKNOWN) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed1->BlinkingLedState = LED_STATE_OFF;
|
|
|
|
pLed1->CurrLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOff(padapter, pLed1);
|
|
|
|
}
|
|
|
|
switch (pLed->CurrLedState) {
|
|
|
|
case LED_BLINK_SLOWLY:
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_BLINK_StartToBlink:
|
|
|
|
if (pLed->bLedOn) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
} else {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_SCAN_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
} else {
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_TXRX_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
} else {
|
2016-11-17 09:16:42 +00:00
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS:
|
|
|
|
if (pLed->bLedOn) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
} else {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS_STOP: /*WPS authentication fail*/
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS_STOP_OVERLAP: /*WPS session overlap */
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0) {
|
|
|
|
if (pLed->bLedOn)
|
|
|
|
pLed->BlinkTimes = 1;
|
|
|
|
else
|
|
|
|
bStopBlinking = true;
|
|
|
|
}
|
|
|
|
if (bStopBlinking) {
|
|
|
|
pLed->BlinkTimes = 10;
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
} else {
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SwLedBlink5(struct LED_871x *pLed)
|
|
|
|
{
|
|
|
|
struct _adapter *padapter = pLed->padapter;
|
|
|
|
u8 bStopBlinking = false;
|
|
|
|
|
|
|
|
/* Change LED according to BlinkingLedState specified. */
|
2016-09-27 21:51:49 +00:00
|
|
|
if (pLed->BlinkingLedState == LED_STATE_ON)
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
else
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
switch (pLed->CurrLedState) {
|
|
|
|
case LED_SCAN_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (!pLed->bLedOn)
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
} else {
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_TXRX_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (!pLed->bLedOn)
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
} else {
|
2016-11-17 09:16:42 +00:00
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SwLedBlink6(struct LED_871x *pLed)
|
|
|
|
{
|
|
|
|
struct _adapter *padapter = pLed->padapter;
|
|
|
|
u8 bStopBlinking = false;
|
|
|
|
|
|
|
|
/* Change LED according to BlinkingLedState specified. */
|
2016-09-27 21:51:49 +00:00
|
|
|
if (pLed->BlinkingLedState == LED_STATE_ON)
|
2010-08-20 15:15:30 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
else
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
switch (pLed->CurrLedState) {
|
|
|
|
case LED_TXRX_BLINK:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (!pLed->bLedOn)
|
|
|
|
SwLedOn(padapter, pLed);
|
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
} else {
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS:
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Description:
|
|
|
|
* Callback function of LED BlinkTimer,
|
|
|
|
* it just schedules to corresponding BlinkWorkItem.
|
|
|
|
*/
|
treewide: setup_timer() -> timer_setup()
This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.
Casting from unsigned long:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);
and forced object casts:
void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
become:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
Direct function assignments:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;
have a temporary cast added, along with converting the args:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
And finally, callbacks without a data assignment:
void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);
have their argument renamed to verify they're unused during conversion:
void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
The conversion is done with the following Coccinelle script:
spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci
@fix_address_of@
expression e;
@@
setup_timer(
-&(e)
+&e
, ...)
// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@
(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)
@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@
(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)
// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}
// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}
// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@
void _callback(struct timer_list *t)
{ ... }
// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@
void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}
// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@
void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}
// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@
(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)
// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@
(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)
// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@
_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)
// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@
(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)
@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@
void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-16 21:43:17 +00:00
|
|
|
static void BlinkTimerCallback(struct timer_list *t)
|
2010-08-20 15:15:30 +00:00
|
|
|
{
|
treewide: setup_timer() -> timer_setup()
This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.
Casting from unsigned long:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);
and forced object casts:
void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
become:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
Direct function assignments:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;
have a temporary cast added, along with converting the args:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
And finally, callbacks without a data assignment:
void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);
have their argument renamed to verify they're unused during conversion:
void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
The conversion is done with the following Coccinelle script:
spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci
@fix_address_of@
expression e;
@@
setup_timer(
-&(e)
+&e
, ...)
// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@
(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)
@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@
(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)
// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}
// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}
// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@
void _callback(struct timer_list *t)
{ ... }
// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@
void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}
// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@
void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}
// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@
(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)
// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@
(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)
// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@
_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)
// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@
(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)
@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@
void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-16 21:43:17 +00:00
|
|
|
struct LED_871x *pLed = from_timer(pLed, t, BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
|
2012-05-07 14:38:22 +00:00
|
|
|
/* This fixed the crash problem on Fedora 12 when trying to do the
|
2016-09-09 15:31:45 +00:00
|
|
|
* insmod;ifconfig up;rmmod commands.
|
|
|
|
*/
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->padapter->bSurpriseRemoved || pLed->padapter->bDriverStopped)
|
2010-08-20 15:15:30 +00:00
|
|
|
return;
|
2014-07-09 19:10:46 +00:00
|
|
|
schedule_work(&pLed->BlinkWorkItem);
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Description:
|
|
|
|
* Callback function of LED BlinkWorkItem.
|
2012-05-07 14:38:22 +00:00
|
|
|
* We dispatch actual LED blink action according to LedStrategy.
|
2010-08-20 15:15:30 +00:00
|
|
|
*/
|
|
|
|
static void BlinkWorkItemCallback(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct LED_871x *pLed = container_of(work, struct LED_871x,
|
|
|
|
BlinkWorkItem);
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &pLed->padapter->ledpriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
switch (ledpriv->LedStrategy) {
|
|
|
|
case SW_LED_MODE0:
|
|
|
|
SwLedBlink(pLed);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE1:
|
|
|
|
SwLedBlink1(pLed);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE2:
|
|
|
|
SwLedBlink2(pLed);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE3:
|
|
|
|
SwLedBlink3(pLed);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE4:
|
|
|
|
SwLedBlink4(pLed);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE5:
|
|
|
|
SwLedBlink5(pLed);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE6:
|
|
|
|
SwLedBlink6(pLed);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
SwLedBlink(pLed);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*============================================================================
|
|
|
|
* Default LED behavior.
|
|
|
|
*============================================================================
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Implement each led action for SW_LED_MODE0.
|
|
|
|
* This is default strategy.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void SwLedControlMode1(struct _adapter *padapter,
|
|
|
|
enum LED_CTL_MODE LedAction)
|
|
|
|
{
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
|
|
|
struct LED_871x *pLed = &ledpriv->SwLed0;
|
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
|
|
|
struct sitesurvey_ctrl *psitesurveyctrl = &pmlmepriv->sitesurveyctrl;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
if (padapter->eeprompriv.CustomerID == RT_CID_819x_CAMEO)
|
2018-03-03 05:32:36 +00:00
|
|
|
pLed = &ledpriv->SwLed1;
|
2010-08-20 15:15:30 +00:00
|
|
|
switch (LedAction) {
|
|
|
|
case LED_CTL_START_TO_LINK:
|
|
|
|
case LED_CTL_NO_LINK:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedNoLinkBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->CurrLedState == LED_SCAN_BLINK ||
|
|
|
|
IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_LINK:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedLinkBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->CurrLedState == LED_SCAN_BLINK ||
|
|
|
|
IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_NORMAL;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_SITE_SURVEY:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (psitesurveyctrl->traffic_busy &&
|
|
|
|
check_fwstate(pmlmepriv, _FW_LINKED))
|
2010-08-20 15:15:30 +00:00
|
|
|
; /* dummy branch */
|
2016-11-17 09:16:42 +00:00
|
|
|
else if (!pLed->bLedScanBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedScanBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_SCAN_BLINK;
|
|
|
|
pLed->BlinkTimes = 24;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2016-11-17 09:16:42 +00:00
|
|
|
}
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_TX:
|
|
|
|
case LED_CTL_RX:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->CurrLedState == LED_SCAN_BLINK ||
|
|
|
|
IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_TXRX_BLINK;
|
|
|
|
pLed->BlinkTimes = 2;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LED_CTL_START_WPS: /*wait until xinpin finish */
|
|
|
|
case LED_CTL_START_WPS_BOTTON:
|
2016-11-17 09:16:42 +00:00
|
|
|
if (!pLed->bLedWPSBlinkInProgress) {
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedWPSBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_WPS;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_STOP_WPS:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedWPSBlinkInProgress)
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
|
|
|
pLed->bLedWPSBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_WPS_STOP;
|
|
|
|
if (pLed->bLedOn) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
2016-09-16 21:05:21 +00:00
|
|
|
msecs_to_jiffies(LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
} else {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_STOP_WPS_FAIL:
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_POWER_OFF:
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SwLedControlMode2(struct _adapter *padapter,
|
|
|
|
enum LED_CTL_MODE LedAction)
|
|
|
|
{
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2018-03-03 05:32:36 +00:00
|
|
|
struct LED_871x *pLed = &ledpriv->SwLed0;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
switch (LedAction) {
|
|
|
|
case LED_CTL_SITE_SURVEY:
|
2016-11-17 09:16:42 +00:00
|
|
|
if (pmlmepriv->sitesurveyctrl.traffic_busy)
|
2010-08-20 15:15:30 +00:00
|
|
|
; /* dummy branch */
|
2016-11-17 09:16:42 +00:00
|
|
|
else if (!pLed->bLedScanBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
|
|
|
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedScanBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_SCAN_BLINK;
|
|
|
|
pLed->BlinkTimes = 24;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2016-11-17 09:16:42 +00:00
|
|
|
}
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LED_CTL_TX:
|
|
|
|
case LED_CTL_RX:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedBlinkInProgress &&
|
|
|
|
check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->CurrLedState == LED_SCAN_BLINK ||
|
|
|
|
IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
|
|
|
pLed->bLedBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_TXRX_BLINK;
|
|
|
|
pLed->BlinkTimes = 2;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LED_CTL_LINK:
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LED_CTL_START_WPS: /*wait until xinpin finish*/
|
|
|
|
case LED_CTL_START_WPS_BOTTON:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedWPSBlinkInProgress) {
|
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedWPSBlinkInProgress = true;
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2016-11-17 09:16:42 +00:00
|
|
|
}
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LED_CTL_STOP_WPS:
|
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LED_CTL_STOP_WPS_FAIL:
|
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LED_CTL_START_TO_LINK:
|
|
|
|
case LED_CTL_NO_LINK:
|
|
|
|
if (!IS_LED_BLINKING(pLed)) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_POWER_OFF:
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SwLedControlMode3(struct _adapter *padapter,
|
|
|
|
enum LED_CTL_MODE LedAction)
|
|
|
|
{
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2018-03-03 05:32:36 +00:00
|
|
|
struct LED_871x *pLed = &ledpriv->SwLed0;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
switch (LedAction) {
|
|
|
|
case LED_CTL_SITE_SURVEY:
|
|
|
|
if (pmlmepriv->sitesurveyctrl.traffic_busy)
|
|
|
|
; /* dummy branch */
|
2015-10-19 17:14:29 +00:00
|
|
|
else if (!pLed->bLedScanBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedScanBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_SCAN_BLINK;
|
|
|
|
pLed->BlinkTimes = 24;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_TX:
|
|
|
|
case LED_CTL_RX:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedBlinkInProgress &&
|
|
|
|
check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->CurrLedState == LED_SCAN_BLINK ||
|
|
|
|
IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
|
|
|
pLed->bLedBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_TXRX_BLINK;
|
|
|
|
pLed->BlinkTimes = 2;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_LINK:
|
|
|
|
if (IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_START_WPS: /* wait until xinpin finish */
|
|
|
|
case LED_CTL_START_WPS_BOTTON:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedWPSBlinkInProgress) {
|
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedWPSBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_WPS;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_STOP_WPS:
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
2015-10-19 17:15:29 +00:00
|
|
|
} else {
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = true;
|
2015-10-19 17:15:29 +00:00
|
|
|
}
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->CurrLedState = LED_BLINK_WPS_STOP;
|
|
|
|
if (pLed->bLedOn) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
2016-09-16 21:05:21 +00:00
|
|
|
msecs_to_jiffies(LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
} else {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_STOP_WPS_FAIL:
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_START_TO_LINK:
|
|
|
|
case LED_CTL_NO_LINK:
|
|
|
|
if (!IS_LED_BLINKING(pLed)) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_POWER_OFF:
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SwLedControlMode4(struct _adapter *padapter,
|
|
|
|
enum LED_CTL_MODE LedAction)
|
|
|
|
{
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2018-03-03 05:32:36 +00:00
|
|
|
struct LED_871x *pLed = &ledpriv->SwLed0;
|
|
|
|
struct LED_871x *pLed1 = &ledpriv->SwLed1;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
switch (LedAction) {
|
|
|
|
case LED_CTL_START_TO_LINK:
|
|
|
|
if (pLed1->bLedWPSBlinkInProgress) {
|
|
|
|
pLed1->bLedWPSBlinkInProgress = false;
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed1->BlinkTimer);
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed1->BlinkingLedState = LED_STATE_OFF;
|
|
|
|
pLed1->CurrLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed1->bLedOn)
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedStartToLinkBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->CurrLedState == LED_SCAN_BLINK ||
|
|
|
|
IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedStartToLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_StartToBlink;
|
|
|
|
if (pLed->bLedOn) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
} else {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_LINK:
|
|
|
|
case LED_CTL_NO_LINK:
|
|
|
|
/*LED1 settings*/
|
|
|
|
if (LedAction == LED_CTL_LINK) {
|
|
|
|
if (pLed1->bLedWPSBlinkInProgress) {
|
|
|
|
pLed1->bLedWPSBlinkInProgress = false;
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed1->BlinkTimer);
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed1->BlinkingLedState = LED_STATE_OFF;
|
|
|
|
pLed1->CurrLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed1->bLedOn)
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedNoLinkBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->CurrLedState == LED_SCAN_BLINK ||
|
|
|
|
IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_SITE_SURVEY:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pmlmepriv->sitesurveyctrl.traffic_busy &&
|
|
|
|
check_fwstate(pmlmepriv, _FW_LINKED))
|
2010-08-20 15:15:30 +00:00
|
|
|
;
|
2015-10-19 17:14:29 +00:00
|
|
|
else if (!pLed->bLedScanBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedScanBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_SCAN_BLINK;
|
|
|
|
pLed->BlinkTimes = 24;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_TX:
|
|
|
|
case LED_CTL_RX:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->CurrLedState == LED_SCAN_BLINK ||
|
|
|
|
IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_TXRX_BLINK;
|
|
|
|
pLed->BlinkTimes = 2;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_START_WPS: /*wait until xinpin finish*/
|
|
|
|
case LED_CTL_START_WPS_BOTTON:
|
|
|
|
if (pLed1->bLedWPSBlinkInProgress) {
|
|
|
|
pLed1->bLedWPSBlinkInProgress = false;
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed1->BlinkTimer);
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed1->BlinkingLedState = LED_STATE_OFF;
|
|
|
|
pLed1->CurrLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed1->bLedOn)
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedWPSBlinkInProgress) {
|
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedWPSBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_WPS;
|
|
|
|
if (pLed->bLedOn) {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
} else {
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_STOP_WPS: /*WPS connect success*/
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_STOP_WPS_FAIL: /*WPS authentication fail*/
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
/*LED1 settings*/
|
|
|
|
if (pLed1->bLedWPSBlinkInProgress)
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed1->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
|
|
|
pLed1->bLedWPSBlinkInProgress = true;
|
|
|
|
pLed1->CurrLedState = LED_BLINK_WPS_STOP;
|
|
|
|
if (pLed1->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed1->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed1->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_STOP_WPS_FAIL_OVERLAP: /*WPS session overlap*/
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
/*LED1 settings*/
|
|
|
|
if (pLed1->bLedWPSBlinkInProgress)
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed1->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
|
|
|
pLed1->bLedWPSBlinkInProgress = true;
|
|
|
|
pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP;
|
|
|
|
pLed1->BlinkTimes = 10;
|
|
|
|
if (pLed1->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed1->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed1->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_POWER_OFF:
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedStartToLinkBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedStartToLinkBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed1->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed1->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed1->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed1->BlinkingLedState = LED_UNKNOWN;
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
SwLedOff(padapter, pLed1);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SwLedControlMode5(struct _adapter *padapter,
|
|
|
|
enum LED_CTL_MODE LedAction)
|
|
|
|
{
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2018-03-03 05:32:36 +00:00
|
|
|
struct LED_871x *pLed = &ledpriv->SwLed0;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
if (padapter->eeprompriv.CustomerID == RT_CID_819x_CAMEO)
|
2018-03-03 05:32:36 +00:00
|
|
|
pLed = &ledpriv->SwLed1;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
switch (LedAction) {
|
|
|
|
case LED_CTL_POWER_ON:
|
|
|
|
case LED_CTL_NO_LINK:
|
|
|
|
case LED_CTL_LINK: /* solid blue */
|
|
|
|
if (pLed->CurrLedState == LED_SCAN_BLINK)
|
|
|
|
return;
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_SITE_SURVEY:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (pmlmepriv->sitesurveyctrl.traffic_busy &&
|
|
|
|
check_fwstate(pmlmepriv, _FW_LINKED))
|
2010-08-20 15:15:30 +00:00
|
|
|
; /* dummy branch */
|
2015-10-19 17:14:29 +00:00
|
|
|
else if (!pLed->bLedScanBlinkInProgress) {
|
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedScanBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_SCAN_BLINK;
|
|
|
|
pLed->BlinkTimes = 24;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_TX:
|
|
|
|
case LED_CTL_RX:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedBlinkInProgress) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->CurrLedState == LED_SCAN_BLINK)
|
|
|
|
return;
|
|
|
|
pLed->bLedBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_TXRX_BLINK;
|
|
|
|
pLed->BlinkTimes = 2;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_POWER_OFF:
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void SwLedControlMode6(struct _adapter *padapter,
|
|
|
|
enum LED_CTL_MODE LedAction)
|
|
|
|
{
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
|
2018-03-03 05:32:36 +00:00
|
|
|
struct LED_871x *pLed = &ledpriv->SwLed0;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
|
|
|
switch (LedAction) {
|
|
|
|
case LED_CTL_POWER_ON:
|
|
|
|
case LED_CTL_NO_LINK:
|
|
|
|
case LED_CTL_LINK: /*solid blue*/
|
|
|
|
case LED_CTL_SITE_SURVEY:
|
|
|
|
if (IS_LED_WPS_BLINKING(pLed))
|
2017-03-11 18:27:27 +00:00
|
|
|
return;
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
2018-03-03 05:32:36 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_TX:
|
|
|
|
case LED_CTL_RX:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedBlinkInProgress &&
|
|
|
|
check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2010-08-20 15:15:30 +00:00
|
|
|
if (IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
|
|
|
pLed->bLedBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_TXRX_BLINK;
|
|
|
|
pLed->BlinkTimes = 2;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_START_WPS: /*wait until xinpin finish*/
|
|
|
|
case LED_CTL_START_WPS_BOTTON:
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!pLed->bLedWPSBlinkInProgress) {
|
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedWPSBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_WPS;
|
|
|
|
if (pLed->bLedOn)
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
else
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer, jiffies +
|
|
|
|
msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
|
2010-08-20 15:15:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_STOP_WPS_FAIL:
|
|
|
|
case LED_CTL_STOP_WPS:
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_ON;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_ON;
|
2015-02-27 17:55:48 +00:00
|
|
|
mod_timer(&pLed->BlinkTimer,
|
|
|
|
jiffies + msecs_to_jiffies(0));
|
2010-08-20 15:15:30 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_POWER_OFF:
|
2016-09-27 21:51:49 +00:00
|
|
|
pLed->CurrLedState = LED_STATE_OFF;
|
|
|
|
pLed->BlinkingLedState = LED_STATE_OFF;
|
2010-08-20 15:15:30 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2015-05-15 09:19:39 +00:00
|
|
|
del_timer(&pLed->BlinkTimer);
|
2010-08-20 15:15:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Description:
|
|
|
|
* Dispatch LED action according to pHalData->LedStrategy.
|
|
|
|
*/
|
|
|
|
void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction)
|
|
|
|
{
|
2018-03-03 05:32:36 +00:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
2010-08-20 15:15:30 +00:00
|
|
|
|
2015-10-19 17:14:29 +00:00
|
|
|
if (!ledpriv->bRegUseLed)
|
2010-08-20 15:15:30 +00:00
|
|
|
return;
|
|
|
|
switch (ledpriv->LedStrategy) {
|
|
|
|
case SW_LED_MODE0:
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE1:
|
|
|
|
SwLedControlMode1(padapter, LedAction);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE2:
|
|
|
|
SwLedControlMode2(padapter, LedAction);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE3:
|
|
|
|
SwLedControlMode3(padapter, LedAction);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE4:
|
|
|
|
SwLedControlMode4(padapter, LedAction);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE5:
|
|
|
|
SwLedControlMode5(padapter, LedAction);
|
|
|
|
break;
|
|
|
|
case SW_LED_MODE6:
|
|
|
|
SwLedControlMode6(padapter, LedAction);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|