mirror of
https://github.com/torvalds/linux.git
synced 2024-11-01 17:51:43 +00:00
r8152: move calling delay_autosuspend function
Move calling delay_autosuspend() in rtl8152_runtime_suspend(). Calling delay_autosuspend() as late as possible. The original flows are 1. check if the driver/device is busy now. 2. set wake events. 3. enter runtime suspend. If the wake event occurs between (1) and (2), the device may miss it. Besides, to avoid the runtime resume occurs after runtime suspend immediately, move the checking to the end of rtl8152_runtime_suspend(). Signed-off-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
21cbd0ecad
commit
bd88298222
@ -4355,13 +4355,6 @@ static int rtl8152_runtime_suspend(struct r8152 *tp)
|
|||||||
if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
|
if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) {
|
||||||
u32 rcr = 0;
|
u32 rcr = 0;
|
||||||
|
|
||||||
if (delay_autosuspend(tp)) {
|
|
||||||
clear_bit(SELECTIVE_SUSPEND, &tp->flags);
|
|
||||||
smp_mb__after_atomic();
|
|
||||||
ret = -EBUSY;
|
|
||||||
goto out1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (netif_carrier_ok(netdev)) {
|
if (netif_carrier_ok(netdev)) {
|
||||||
u32 ocp_data;
|
u32 ocp_data;
|
||||||
|
|
||||||
@ -4395,6 +4388,11 @@ static int rtl8152_runtime_suspend(struct r8152 *tp)
|
|||||||
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, rcr);
|
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, rcr);
|
||||||
napi_enable(napi);
|
napi_enable(napi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (delay_autosuspend(tp)) {
|
||||||
|
rtl8152_runtime_resume(tp);
|
||||||
|
ret = -EBUSY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out1:
|
out1:
|
||||||
|
Loading…
Reference in New Issue
Block a user