From patchwork Thu Nov 19 22:49:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 328468 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp817940ils; Thu, 19 Nov 2020 14:51:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxA2xovpL9s84MM2UiTsE0ySCctCSuUVUw39JmrkHGp78HZMaqViojcZPN41XBB/OWFohDI X-Received: by 2002:aa7:d98b:: with SMTP id u11mr33233590eds.107.1605826270995; Thu, 19 Nov 2020 14:51:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605826270; cv=none; d=google.com; s=arc-20160816; b=nNJs69eMrVQGSVu5iHVDx2MPV6cNX+Evddv5vkPj+7pOCLmS3G6gOXBex299uT5/4M b5Tx2rb6VfCelizSI5RdilEpWRLWQbWBZes+4tKa/ezcvylwF1JzgYgrO0u4ZVcUp2Td 29x1szPBFHQSsw+cMirwcHopdzhW9UyAW976/XMKupZmRo0PToio+iB8e+5mbC7MNTuJ Vz8X/fG1b4d/eGXTOFdUziKJexG2WfqAN/oNe9GUmAdQM1nxSb5QAyPLMDRCQuLxQq54 xMWjTlwTAAeBNbeWOMvUUzPpAYIpBHeD8DyobOHPIyyzTsqigqL9dOos0OYUcbW2XjXs H62w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+Xvc6yFy3B6RA1AySob/CnSMzPD16sI2RoCdvJ3slvY=; b=nyplURBlDawG5td3ob0zStwZA7HjfRBv5L5ontBYP36TUo/hCVkcoP3HQAPnLWS8wU NijZkOaMDvydErJ7CI+hINTCHct0cc3XkU3wYp0/nAOKA3+/4O2Ak7EAE0ErplOKSAWx R927zqUnqzedLxLWjJU1jtO8d+xC0jCJO4BlUuEmjgU7z6ZrpKbxmQ2k3aIesnYT9kra xM4i7K4/a5s8JSsxbNtyra/tWkKLzX7xYNHyf3eIG+tOUvNRRzao3LZXt5bOQL2nO0qG r1g8kqoRT/G/oCQQmHjrGmB8lb8Sp9H5PlmEtVGH9E/Kp+Sj9nd3Pw7e4RCwZcLxwOhz PFTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CZHDJnV8; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hq14si545910ejc.99.2020.11.19.14.51.10; Thu, 19 Nov 2020 14:51:10 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-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=@linaro.org header.s=google header.b=CZHDJnV8; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726682AbgKSWto (ORCPT + 8 others); Thu, 19 Nov 2020 17:49:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726691AbgKSWtl (ORCPT ); Thu, 19 Nov 2020 17:49:41 -0500 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EC8BC0617A7 for ; Thu, 19 Nov 2020 14:49:40 -0800 (PST) Received: by mail-il1-x141.google.com with SMTP id n5so6879991ile.7 for ; Thu, 19 Nov 2020 14:49:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+Xvc6yFy3B6RA1AySob/CnSMzPD16sI2RoCdvJ3slvY=; b=CZHDJnV8efZpm/8lO8PTOPbfKNf1/Rc4jo96XFcyZu+uYmp1lTzFjpdpUGFZ+os8uO DFIIKYOL+Qos0m7imSxRMXr37leU+WFEER2FHEpH9y+sBikbiDF9wSqe/TPPsYEma9L5 8QXp0ZVqKv36WsFUhypN3o7VVhb4uizFC+b3M8ryxV3HJ9EjSZXxlab06RjFIw/Shzsd xCvPmSjaYDAFP54qlDkI8nprljSXC+TyAvAJIVSurxjlzRF9ZBuXLnlJbbcIYVVBW4z6 1yIMBGC11Q6DYBvWOTTkCuFFvPhhXALqHzTbgVjD4QZEYjWcqXd0cRefBlyNfYs2PSSY n0Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+Xvc6yFy3B6RA1AySob/CnSMzPD16sI2RoCdvJ3slvY=; b=i82YM016W/WVOpJMzK0SDS92k6NnFAQHzsuHGRWJoooB9gAjT9f6c2Tdd8L3qKh8JB sl7XtxzdGN2BBQ2qoCXsG8GrFeNt92ZmYIojSjG609KKd+vs/RIbNgK6i0srYmWpPBFY GhxvxMgRL/ipsipbHckiwvWxCeMW1UUGujIS9zibZZd7qQki7CNn1ClirB8hAmPtoQ+C ufEheQV7DQc9gHiAQOstObfJ4QPCXZbNYcmPp7y6NYePqV7GHVOMnm4/R5rZZQf7ecuC Y5FTuFF1P8LJ//wxDDYY/Qz3B3DEHore/g2XhiMeWt91SSsNycoQiu16atE+G84HJdXc UF2g== X-Gm-Message-State: AOAM533zhfQKSrf3uxWRWd8lfJ5X2MfUVcMpinOOkKVK3As5Puh5aIW0 Wasmy+MngJtFCBJhn5+Cb/61Jw== X-Received: by 2002:a05:6e02:92f:: with SMTP id o15mr23903000ilt.169.1605826179758; Thu, 19 Nov 2020 14:49:39 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id i3sm446532iom.8.2020.11.19.14.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 14:49:39 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/6] net: ipa: retry modem stop if busy Date: Thu, 19 Nov 2020 16:49:28 -0600 Message-Id: <20201119224929.23819-6-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201119224929.23819-1-elder@linaro.org> References: <20201119224929.23819-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The IPA driver remove callback, ipa_remove(), calls ipa_modem_stop() if the setup stage of initialization is complete. If a concurrent call to ipa_modem_start() or ipa_modem_stop() has begin but not completed, ipa_modem_stop() can return an error (-EBUSY). The next patch adds a driver shutdown callback, which will simply call ipa_remove(). We really want our shutdown callback to clean things up. So add a single retry to the ipa_modem_stop() call in ipa_remove() after a short (millisecond) delay. This offers no guarantee the shutdown will complete successfully, but we'll at least try a little harder before giving up. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 3fb9c5d90b70e..9f4bd822ac625 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -864,6 +864,11 @@ static int ipa_remove(struct platform_device *pdev) if (ipa->setup_complete) { ret = ipa_modem_stop(ipa); + /* If starting or stopping is in progress, try once more */ + if (ret == -EBUSY) { + usleep_range(USEC_PER_MSEC, 2 * USEC_PER_MSEC); + ret = ipa_modem_stop(ipa); + } if (ret) return ret;