From patchwork Tue Apr 16 14:35:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Nyekjaer X-Patchwork-Id: 1086353 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=geanix.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=geanix.com header.i=@geanix.com header.b="Y/W3LzIV"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44k7Fw56NKz9s3l for ; Wed, 17 Apr 2019 00:35:48 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729473AbfDPOfr (ORCPT ); Tue, 16 Apr 2019 10:35:47 -0400 Received: from first.geanix.com ([116.203.34.67]:33996 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726751AbfDPOfr (ORCPT ); Tue, 16 Apr 2019 10:35:47 -0400 Received: from zen.localdomain (unknown [85.184.147.232]) by first.geanix.com (Postfix) with ESMTPSA id 0A111303E7A; Tue, 16 Apr 2019 14:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1555425323; bh=OUH69ZeYbW5jFeKB11n8egRtOQlkOZf4r33O/fuUzGc=; h=From:To:Cc:Subject:Date; b=Y/W3LzIVJDVDddbh+RyS6bh5J0F0fJ+ah4ln5M7qY1SG3R6GqV2jYii+U/YSyz2Xj 54vY8vTKmYzoZG9DuqttGWr2z5RzEY6nrILWSJALSAZTYyy21gevjm6R7nm2Wi940/ DSkFWMlgDCivvvwFm9olLAi7Q1N2Rz+m3pyEX05atV40PxMPHq+f3CIkNRHXsKSVQb 66lCelstHr+gJpBGex4sUEJ3nXwiKaFMdgKKopbqKvXCyCpSfCcfFjYsUMCOWRD1bO OqylkcZrcVxMrG2hiWaOBImF7Ng9Sgv6L58PIWTo/9MDLzFaIHAkrGsxNoxKfkng0Z lFC28aGpt58yw== From: Sean Nyekjaer To: netdev@vger.kernel.org, linux-can@vger.kernel.org, mkl@pengutronix.de Cc: Sean Nyekjaer Subject: [PATCH] can: flexcan: fix deadlock when using self wakeup Date: Tue, 16 Apr 2019 16:35:11 +0200 Message-Id: <20190416143512.17735-1-sean@geanix.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, UNPARSEABLE_RELAY, URIBL_BLOCKED autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on 3e0c63300934 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When suspending, when there is still can traffic on the interfaces the flexcan immediately wakes the platform again. As it should :-) But it throws this error msg: [ 3169.378661] PM: noirq suspend of devices failed On the way down to suspend the interface that throws the error message does call flexcan_suspend but fails to call flexcan_noirq_suspend. That means the flexcan_enter_stop_mode is called, but on the way out of suspend the driver only calls flexcan_resume and skips flexcan_noirq_resume, thus it doesn't call flexcan_exit_stop_mode. This leaves the flexcan in stop mode, and with the current driver it can't recover from this even with a soft reboot, it requires a hard reboot. Fixes: de3578c198c6 ("can: flexcan: add self wakeup support") Signed-off-by: Sean Nyekjaer --- drivers/net/can/flexcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 78f67f59b165..3fbce94e7ee5 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -1588,6 +1588,7 @@ static int __maybe_unused flexcan_resume(struct device *device) netif_start_queue(dev); if (device_may_wakeup(device)) { disable_irq_wake(dev->irq); + flexcan_exit_stop_mode(priv); } else { err = flexcan_chip_enable(priv); if (err) @@ -1615,7 +1616,6 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device) if (netif_running(dev) && device_may_wakeup(device)) { flexcan_enable_wakeup_irq(priv, false); - flexcan_exit_stop_mode(priv); } return 0;