Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1251986pxu; Mon, 23 Nov 2020 16:02:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxVDRGATN6fFjocH41FXGc0vg8KIfwN+j/Szq7DSv+RV5J75Ya3ZQPzLkJ+2jp5gCrrRj8 X-Received: by 2002:a17:906:82d9:: with SMTP id a25mr1913609ejy.101.1606176178654; Mon, 23 Nov 2020 16:02:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606176178; cv=none; d=google.com; s=arc-20160816; b=JXyRUSZald/bUqnB5UuIOT8gN96YSxDvouY+4UNlhFwYPO/CqTSlq3Y9Y6Id7hD3W7 YK0POfhGGvg3FvwSLBGAi0AlgjZ2R1FFB31hNT9VofgVOEmPJ7fdliudSqt+RgDpxrL6 hp0xIjscl3aYKRwlViAMIPKNEBAAF+oyZvChCDb28tNgJbb3yQ6dxs6HtSDQZ+pb6usE kdGFVz3muI7wDqr2RkZaGpy83qRHvBveqnSpRrQ7oaF+QDVf2G145p/WkJ50DRw8/N0G W/Y4F73fO/LkoZScT8j43AY2a/WaAQdVZlnNR0e1DmyZbPrec5l3vTgYJbfw/4q3JXzt J/EQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kW9NFnUowL+F/crMJ/2uau1TfSdRLjY7VqiQzJuQLF0=; b=dffLgSlf28233ri2B7B2jOXbEFK/ruCjBuNqMHs5fU6WViHzBpYzadrg/lVSO1btXK cZGMLVrws/n/TtvuWiiO6iSKHKFu3RIgkTHZenfW9ZUBpbs88UpULhDskamHN7/tL2Gc fKDRoD6vgw6uwSj1fOsoTYQY48Jk9qJ3ukZoPZuW7QWkHGdgs8ZmVtresIi/jcplhmuc uCRuWh+BpBUDc/ve1/ZKkoXdh7Ns5266CFLfnwpGT0XknPF4FwhGz4p9LprGAPwRuTiG smaNWZsW2yN5BYWRV+WBwMrSAdAqehMQswUlJD7TAG9l9FYtSRoNaktLjBdko9aUhm2F 2EkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MTODjHdL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc22si591611edb.371.2020.11.23.16.02.35; Mon, 23 Nov 2020 16:02:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=MTODjHdL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732219AbgKWNUa (ORCPT + 99 others); Mon, 23 Nov 2020 08:20:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:52088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732239AbgKWMjW (ORCPT ); Mon, 23 Nov 2020 07:39:22 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 9C2F52065E; Mon, 23 Nov 2020 12:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135162; bh=lGAiTNLPpgZHf6Z751ZJKF2JpgaVX5LuiCr1mKXV1pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MTODjHdLv0JNymj/SYQV6G3ppTqTsqAUSMWqsroqckxYbWU12N0I3PCKfA0A8Nhqg wEoX8j6YKzniUwLIX71UrRUxuRU2zAe+mH8Z0Zq0FNCVgpTABy+FJUprsEnSoypmf8 kYI7O3hqwrKQMEAPTsq6Ys+mrTCyFx6hjWyCmK9Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Faiz Abbas , Dan Murphy , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.4 087/158] can: m_can: m_can_stop(): set device to software init mode before closing Date: Mon, 23 Nov 2020 13:21:55 +0100 Message-Id: <20201123121824.131320309@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Faiz Abbas [ Upstream commit a584e9bc1b7e88f24f8504886eafbe6c73d8a97c ] There might be some requests pending in the buffer when the interface close sequence occurs. In some devices, these pending requests might lead to the module not shutting down properly when m_can_clk_stop() is called. Therefore, move the device to init state before potentially powering it down. Fixes: e0d1f4816f2a ("can: m_can: add Bosch M_CAN controller support") Signed-off-by: Faiz Abbas Acked-by: Dan Murphy Link: https://lore.kernel.org/r/20200825055442.16994-1-faiz_abbas@ti.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/m_can/m_can.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 85e3df24e7bfb..661db85d569ce 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1366,6 +1366,9 @@ static void m_can_stop(struct net_device *dev) /* disable all interrupts */ m_can_disable_all_interrupts(cdev); + /* Set init mode to disengage from the network */ + m_can_config_endisable(cdev, true); + /* set the state as STOPPED */ cdev->can.state = CAN_STATE_STOPPED; } -- 2.27.0