Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5383747ybi; Wed, 12 Jun 2019 01:24:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjWxrbXCWqQscmgaIwxHHo0a/HpDYh5zpd2DyjAKxHrMzcyLsgPVR1D5PYgNRcSHFZ4jlA X-Received: by 2002:a17:90a:2430:: with SMTP id h45mr32561833pje.14.1560327883689; Wed, 12 Jun 2019 01:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560327883; cv=none; d=google.com; s=arc-20160816; b=d/koKM4YWdC4DBVD6aZFsA5psF8Go2hELMATLCy9ndJmDN/Hw/fiPpT1i7CwbMvTxg PBQ1PTpOWCqVcjb1uhwE09cOSQzM5d9qL6wpIpjHmZn+28xXNvErhIrrGEvR0EYPCDkd bd69yxzKBA9147r2llpXuOMxfuDrmK5Q51rEtB3ov/kCiO3eQGrE0/FoBJEJHtwG0lZs Bzqk+Uyq8Dls2X4tyoIFTr90sNgyRa96j1P+FjFTbzEqVfVWFBzIQHMxplfkxXT/SzIP qnQ55ArWGqav1JvCVOjZAAY3r0A0F5u4u6mpxnyHw4Xi+ujy0fdtXE5OXqIxCfZkoD0C U/ug== 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=A270xYSqA81Rot1Y+7y+Jm4Flyysx946msO2/rwP4k3veDQkswgYnuPFp+jzD9v9Eo 1FE0o+qXqzG1XnGjd4d4d9nrrnUP39j2Vqhvq/OYacjywNEdQD6GCAl5Q6tutTCz+rlL ZyZCBnPcv1pu73C5AAF/Sojnn9gNoJ59nbRPmrMWT1QA0tLfgv2DQS4O/tF7TG6TzipU E1aU/cZSw/P8ryZNrKYSp8JbGaSqdCumVolX2SgBzilZ8UZRc5rPsGuKlitajvMeURqP P/T9gOy/fta/vPyNxqob3LXrTz4svJX5Au7kN131cRAnRRGW5LwJ2iX3y6PcTre44iDg Lgig== 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 d10si14475981plr.307.2019.06.12.01.24.28; Wed, 12 Jun 2019 01:24: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 S1731248AbfFLGph (ORCPT + 99 others); Wed, 12 Jun 2019 02:45:37 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:51308 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731217AbfFLGpg (ORCPT ); Wed, 12 Jun 2019 02:45:36 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x5C6jWG6004380, 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 x5C6jWG6004380 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 12 Jun 2019 14:45:33 +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; Wed, 12 Jun 2019 14:45:32 +0800 From: To: CC: Subject: [PATCH 08/11] rtw88: power on again if it was already on Date: Wed, 12 Jun 2019 14:45:14 +0800 Message-ID: <1560321917-17751-9-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560321917-17751-1-git-send-email-yhchuang@realtek.com> References: <1560321917-17751-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