Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2665490pxa; Mon, 24 Aug 2020 22:56:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1mMgsrqM87R9NxUBiPAmQk47aohywLBqrsZ7mIufpiMIXZUF8T+O/DraXnnAkB75ZNt1h X-Received: by 2002:a05:6402:2285:: with SMTP id cw5mr8454095edb.242.1598334967951; Mon, 24 Aug 2020 22:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598334967; cv=none; d=google.com; s=arc-20160816; b=y+jL3tgVdvQOGF7aAQArDZJgQSoirdvR2YbktGQ+reMYp53KhOlFrh65BijZFKrLxe aaxnezTi2jjAO/552Wh7XnwNDmyoXa+n0PKhHstFeWD1kZAmwAhkFcL6jrUNGDzAOsv8 pw2cuG3ufgpXkM70YIWzgNbIeRaDlarGaZs//09kRplO1S8DvthfFsuBKtV/nWoqVpYm k3+4+T45MXcG0PLTBGN29wb3aHNEAnPEgMcHHQsx+B43+YEFB9cbH9d0tFSijkmhGsFf es5FCTy57jtpWMIXITi3AjOcbobWPJfVtMKQoYKev0ZQUXL8oH837noW91PEOLv1Ghyy QCVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=duyqkgdZLKCTlkGLaMdgAkkMB3mW9knGedMzsy1T14E=; b=aJpGQgAQCqtF0eg/6eiAv9VNzAjNERJqVUPN+FTpdntEsRIs9XkXFjJ7GHr/g069Vx 0SvhsjkrZXx8vkfec3bgQEyaDgW1XXWeuhHHIZkGFLRrarqcW5cGDer4nZY2CGrmY1ba vzMyIF6qSPDS+EJUZx092/bdqYLsYg4zKg7+hGZKqYdYwVYdp1Ly7EqZCaZoEGYcDLgj tx5oHeFtdCp9V78S8JRqpNi21RXX6mONWN8uOlxU1joFGQUu1KSdbUoko9uy6w3UEbDa HWGFLs+rTjTOi2KuKf5VUOjss0u6IEDruL1DiPE1eGiZDAanhGMAurFcbyRE5kXak3Er DISg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tOVdYnP+; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si1909456ejq.552.2020.08.24.22.55.45; Mon, 24 Aug 2020 22:56:07 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=tOVdYnP+; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728936AbgHYFzE (ORCPT + 99 others); Tue, 25 Aug 2020 01:55:04 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:57226 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726090AbgHYFzE (ORCPT ); Tue, 25 Aug 2020 01:55:04 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 07P5sofs048261; Tue, 25 Aug 2020 00:54:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1598334890; bh=duyqkgdZLKCTlkGLaMdgAkkMB3mW9knGedMzsy1T14E=; h=From:To:CC:Subject:Date; b=tOVdYnP+frzvJARr/LTTrYvwaapkKNRW883MplcBvowCq6km/wckDDt6wJBsYJ0t+ KrGPt8o9OAN+MLi0/aC/46wJm2NZmvH5BzAa6vq1Q9gDUU/ue67NjwTZJFmS2HRvvc LoIoSV2XZ94Nz79g1MUxKy/X1QdeenvSyq+LGIME= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 07P5so1X001719; Tue, 25 Aug 2020 00:54:50 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 25 Aug 2020 00:54:49 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 25 Aug 2020 00:54:49 -0500 Received: from a0230074-Latitude-E7470.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 07P5silM040890; Tue, 25 Aug 2020 00:54:45 -0500 From: Faiz Abbas To: , , CC: , , , , , , Subject: [PATCH v2] can: m_can: Set device to software init mode before closing Date: Tue, 25 Aug 2020 11:24:42 +0530 Message-ID: <20200825055442.16994-1-faiz_abbas@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Faiz Abbas --- changes since v1: Rebased to latest mainline 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 02c5795b7393..d0c458f7f6e1 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1414,6 +1414,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.17.1