Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1339457pxu; Fri, 16 Oct 2020 09:31:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfmh7l5BctqQ3d9JyRMvlzBxgFTGXWN9OKKeB4o9MSpQekE5Wb2q92prEr/8a5NbuXBePw X-Received: by 2002:a17:906:8248:: with SMTP id f8mr4758482ejx.292.1602865874321; Fri, 16 Oct 2020 09:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602865874; cv=none; d=google.com; s=arc-20160816; b=WkQqY1ycSMm40z/FRYRsUQvNyYiTsMbUA81bKB3pPEM2SWyqralFw4QvyQhWsq+H7k M6NXIrLQwnoE0r9MVrqm7+Dge8gxY92kB3zwEd7ljhog6Png9nu51nnoCBG6vJOxujs2 UF/ohGHRLoLyVAFkQe3G61TxG+5GOilLSbcRM2M/zZ41HEztv3BbJkDDn19qh+KU47ns 8DWBQRXJhSeqtI+zan/rIc4KyaFIJPK/Cer1yiHBeCltxl+V0HyEBNtvxSuB1XGoxh6p WQsrudi3fAvkp2rNpq9SDHxMUcRpwMv08IOZUhhZ2HuBp+s01TpVFwW36Cv4dAP3Y/Wl w1ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4EydL6LOPhka8uxCGp9Fx42ZBiiuBDUFZqTMKuzQDfg=; b=l6fLm0r2bMoZBZ21EjR0RHeVqe7fGrx89cGqQdmAJi425SW4rZqBzuDfMuR8AkaMcL d6rZ5eE9G5HF+GDP2gMKcQ1jJD5Dvk7D2h7JeUp3H/02pXCxMN1QqPbTPNpkBsyKhZMp NY2qDuxG1Bri9vlYyLh44iNMkD88Hfn7M2nn7l9XMdZOzfPywdOloyzmCDQ59on668zs GCxvypVoUP0xakaDQ3P3jt+07xZaHBXwtcOWi/fA5ZJh820ruDIUdNnM01jwmCX/6XUE C3o0GaVrOqCE4v07NGCBDyw8TaiVZe7XiYt/20lmQXkoMzyHX+RXdZAW37FaP4g4n4Z4 8Yfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VOgIS4Nm; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l25si1914110edj.169.2020.10.16.09.30.43; Fri, 16 Oct 2020 09:31:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VOgIS4Nm; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436489AbgJPPqJ (ORCPT + 99 others); Fri, 16 Oct 2020 11:46:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:60482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436486AbgJPPqC (ORCPT ); Fri, 16 Oct 2020 11:46:02 -0400 Received: from localhost (unknown [176.207.245.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A657D205CA; Fri, 16 Oct 2020 15:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602863161; bh=niTpDyZfJRFbAZD949hDaB5cZh5LED6Tjpy2z6iQJrA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VOgIS4Nmj843vZ6IiDfsxUjjhmrqfJd2xURjWisHLw2CbJhUZS+oqoPBeMK5Pf4nk ggS2cGwb3sNxSU2lfA5Hq4tkTh/oDkUjsNhsQ4T9yLecwdfpd/h9jWt6PbqFaFlRp+ Yje8h2NqXZHX7F6S102rU6iyCev8xUT0yPUSpGKk= Date: Fri, 16 Oct 2020 17:45:56 +0200 From: Lorenzo Bianconi To: sean.wang@mediatek.com Cc: nbd@nbd.name, lorenzo.bianconi@redhat.com, ryder.lee@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org, Sean Wang , YN Chen Subject: Re: [PATCH 1/2] mt76: mt7663: handle failure event for patch semaphore cmd Message-ID: <20201016154556.GA700952@lore-desk> References: <267346a9a9c5f71caec03292b6c33b39864b38c5.1602807276.git.objelf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="YZ5djTAD1cGYuMQK" Content-Disposition: inline In-Reply-To: <267346a9a9c5f71caec03292b6c33b39864b38c5.1602807276.git.objelf@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > From: Sean Wang >=20 > Just follow up vendor driver to retry a few times obtaining patch > semaphore when the event is PATCH_NOT_DL_SEM_FAIL. That usually > happens in Bluetooth and Wifi driver contends to download patch > simultaneously. >=20 > Co-developed-by: YN Chen > Signed-off-by: YN Chen > Signed-off-by: Sean Wang > --- > drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/ne= t/wireless/mediatek/mt76/mt7615/mcu.c > index 2b17bd1c2a32..c990ccd6f472 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c > @@ -1945,14 +1945,21 @@ static int mt7615_load_patch(struct mt7615_dev *d= ev, u32 addr, const char *name) > { > const struct mt7615_patch_hdr *hdr; > const struct firmware *fw =3D NULL; > - int len, ret, sem; > + int len, ret, sem, c =3D 50; > =20 > +retry: > sem =3D mt7615_mcu_patch_sem_ctrl(dev, 1); > switch (sem) { > case PATCH_IS_DL: > return 0; > case PATCH_NOT_DL_SEM_SUCCESS: > break; > + case PATCH_NOT_DL_SEM_FAIL: > + if (is_mt7663(&dev->mt76) && c--) { > + msleep(100); > + goto retry; > + } > + fallthrough; I guess it is more clear to have a dedicated routine for this. E.g: int mt7615_mcu_get_patch_semaphore() { .... } Regards, Lorenzo > default: > dev_err(dev->mt76.dev, "Failed to get patch semaphore\n"); > return -EAGAIN; > --=20 > 2.25.1 --YZ5djTAD1cGYuMQK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCX4nAMQAKCRA6cBh0uS2t rDqQAQCedzj17j1YTnDbrr3SSz6sBCBFGouH/x53fytdy6+WlwEAnKmO3SqyXcoE SBNw3YRd/djU6IkXBpH5NEnM0tLJzgc= =eXek -----END PGP SIGNATURE----- --YZ5djTAD1cGYuMQK--