Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp635357ybi; Fri, 14 Jun 2019 00:25:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVYUi82eBJNnlrG3+CQeNq0oRXRHRoXxYNq471IrYWFOfYk11Kum8giEzN+4QfJDxtF1d7 X-Received: by 2002:a17:902:8a87:: with SMTP id p7mr74917815plo.124.1560497143274; Fri, 14 Jun 2019 00:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560497143; cv=none; d=google.com; s=arc-20160816; b=wxO1H5czyWSim6EkmA5OSVP9KyO56fqyBRT8lWGidl9L2wRFP76JXgR4Y+Piorf5Ah VIpT5GdfTFQRQJPwIfgX3B9gteZtObvti2NCSou/tFhRd1Orb+yUgF2CgUSP2hEiHOkA B/dVB8J/vfAZYlrJqu3D38t4EOWRkod9OENaoEkqgb8E33Dhz/AdxCZISAnwRIeW3KMU 3Y8ArWomyHMiPsRDBBey5c/DWkxTJfD6vMuS3zVzuxDJjkhfeSy2RHgsY6En+JdqImx4 /LSIY7o3Sx06xcEuwpP15STSOr9FcmPk2IhHa05CTBQuGThrML+LLpaBs0ZW4BBcrrYo ENbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=f4v4zYkIYQ/Pu+JOWnrnuNJubr7rN6cQjnh5i4dZnA0=; b=sMx7fzPxFzGxGlmYPSbW8dgI+09Jvnn7l7ui+01p8HncNJQxAvHYC6sNkTUYyJO5eC azp+S+3babOawix+WCD91HKTFtdr7SsQ1/ZZIPdNbTYTvQezHtdZvOZStub8w98wyX/+ AVMH+bnZtqDAybvnR3dEu4GCN7XDLoudUOmRlZhrorOr2R/hJ9jegvTsuUI/W1gNp1f0 btVO2+yBLJKZEj3UkkAGPC0YmjSp6ZPrnE3THshX8+Cc4lWcUJkuR9WpsEnps0WBLyQS n4v3yFFezqqrEZfHozx8c5DJxyz0RTdRADXscDHNRLuUXQ1Sr6Fa4ssVVH838OerqGNw cjKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m26si1761364pgv.388.2019.06.14.00.25.26; Fri, 14 Jun 2019 00:25:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726658AbfFNHY3 (ORCPT + 99 others); Fri, 14 Jun 2019 03:24:29 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:48179 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726552AbfFNHY3 (ORCPT ); Fri, 14 Jun 2019 03:24:29 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x5E7OO9s024954, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtitcasv01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x5E7OO9s024954 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 14 Jun 2019 15:24:25 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.439.0; Fri, 14 Jun 2019 15:24:24 +0800 From: To: CC: Subject: [PATCH v2 08/11] rtw88: power on again if it was already on Date: Fri, 14 Jun 2019 15:24:12 +0800 Message-ID: <1560497055-17197-9-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560497055-17197-1-git-send-email-yhchuang@realtek.com> References: <1560497055-17197-1-git-send-email-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang We could fail to power on because it was already on. If the return value is -EALREADY, power off and then power on again to turn on the hardware as expected. Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/mac.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c index 25a923b..fc14b37 100644 --- a/drivers/net/wireless/realtek/rtw88/mac.c +++ b/drivers/net/wireless/realtek/rtw88/mac.c @@ -285,8 +285,14 @@ int rtw_mac_power_on(struct rtw_dev *rtwdev) goto err; ret = rtw_mac_power_switch(rtwdev, true); - if (ret) + if (ret == -EALREADY) { + rtw_mac_power_switch(rtwdev, false); + ret = rtw_mac_power_switch(rtwdev, true); + if (ret) + goto err; + } else if (ret) { goto err; + } ret = rtw_mac_init_system_cfg(rtwdev); if (ret) -- 2.7.4