mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
wifi: rtw88: Lock rtwdev->mutex before setting the LED
Some users report that the LED blinking breaks AP mode somehow. Most
likely the LED code and the dynamic mechanism are trying to access the
hardware registers at the same time. Fix it by locking rtwdev->mutex
before setting the LED and unlocking it after.
Fixes: 4b6652bc6d ("wifi: rtw88: Add support for LED blinking")
Closes: https://github.com/lwfinger/rtw88/issues/305
Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/ed69fa07-8678-4a40-af44-65e7b1862197@gmail.com
This commit is contained in:
committed by
Ping-Ke Shih
parent
58de1f91e0
commit
26a8bf978a
@@ -6,13 +6,23 @@
|
||||
#include "debug.h"
|
||||
#include "led.h"
|
||||
|
||||
static int rtw_led_set_blocking(struct led_classdev *led,
|
||||
enum led_brightness brightness)
|
||||
static void rtw_led_set(struct led_classdev *led,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
struct rtw_dev *rtwdev = container_of(led, struct rtw_dev, led_cdev);
|
||||
|
||||
mutex_lock(&rtwdev->mutex);
|
||||
|
||||
rtwdev->chip->ops->led_set(led, brightness);
|
||||
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
}
|
||||
|
||||
static int rtw_led_set_blocking(struct led_classdev *led,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
rtw_led_set(led, brightness);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -37,7 +47,7 @@ void rtw_led_init(struct rtw_dev *rtwdev)
|
||||
return;
|
||||
|
||||
if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE)
|
||||
led->brightness_set = rtwdev->chip->ops->led_set;
|
||||
led->brightness_set = rtw_led_set;
|
||||
else
|
||||
led->brightness_set_blocking = rtw_led_set_blocking;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user