Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2810587pxu; Mon, 7 Dec 2020 16:54:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhRVpjw7RYzHtE7MfjVWAVYP1VtE+ZfOdlaGyxlcrNq1SFTos3rHk8qq/b4J+86EAqSdNS X-Received: by 2002:a17:906:2e16:: with SMTP id n22mr21755390eji.477.1607388861557; Mon, 07 Dec 2020 16:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607388861; cv=none; d=google.com; s=arc-20160816; b=yv3sVESpLHRY7vQiK1pu1FiOhGBGiqsppabC56Rd9o2mkBPYYaKZ8DQuo1Tjd3jBZr mBpNIJIWcmFxrjiemxfNLYEc0teZyWdbHRZLy1ZzMB3QZSfrzsPjzy/BV1Lfc/XHjkgW e8G3Kz5CqKEXQJJUTXzhHt+6tAITEoPeV9g1UlvToPBlxfUwtqz5lrwoqJEtwDuHhFUh fJ/wW5ggjSBybPyvvscrEVBPXhy1Bm04hmM1D89LedYNtIm+nTrf8XQCqKYqUp9t/iej EdkL7qOxvnVUKXfhcxYK9h6PuOSk3qrkOXiioFWW+CSdpuNoEe8qxGovhdM9gdcJnTh5 7i4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=xZahUYllljXiYxe4ydcG6ftS2v4ZpfHRVkgWv217yho=; b=z6EYKEp1bj3rFupPcX2rT4fXlthLuDNVESDZO3CtwPfeTnDVoIgbjkYbr9pna4Sq4w oLevfpD5CJBhyJfN6r7nVyzjVO2R8CLbjxCJq6+394bS7zmjgPI9YsIyvBQuf9zia+4D H+jiHndVt0+6CZCTRRXHMYc7RFAXccPSz6Vqa+8dmlpxeWKKrAkPc7WIY/+KrMxTZwBQ alqx1oV47dCRuL+pCBtZxrKWvtJTgSZh53kO+QlGzqRllTgO2/d6u3RKN97TKs41Rwtb t09b8FVcdCFKs8bOsb4eVxyW6dJGnj4tA54N5qkRq1+VrnqL/QSy8czPj+tZqhfC9dhT zRIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=n61Znjts; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o4si9309036edj.19.2020.12.07.16.53.59; Mon, 07 Dec 2020 16:54:21 -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=@nvidia.com header.s=n1 header.b=n61Znjts; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728505AbgLHAPC (ORCPT + 99 others); Mon, 7 Dec 2020 19:15:02 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:12012 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbgLHAPC (ORCPT ); Mon, 7 Dec 2020 19:15:02 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Mon, 07 Dec 2020 16:14:22 -0800 Received: from [10.2.90.244] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 8 Dec 2020 00:14:21 +0000 Subject: Re: [PATCH v1 3/7] spi: qspi-tegra: Add support for Tegra210 QSPI controller To: Lukas Wunner CC: , , , , , References: <1606857168-5839-1-git-send-email-skomatineni@nvidia.com> <1606857168-5839-4-git-send-email-skomatineni@nvidia.com> <20201206181612.GA26286@wunner.de> From: Sowjanya Komatineni Message-ID: <8ce3fa3a-88d7-e981-731a-9bce85047892@nvidia.com> Date: Mon, 7 Dec 2020 16:14:53 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201206181612.GA26286@wunner.de> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1607386462; bh=xZahUYllljXiYxe4ydcG6ftS2v4ZpfHRVkgWv217yho=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding: Content-Language:X-Originating-IP:X-ClientProxiedBy; b=n61ZnjtsimFPYzBZV6lW3PUKROTJd25X7QXBQmBs0UHJ3I5/tmhrBQGpCNAqGaCAT PZcXiPNvYYIwZmC3235tEi1lhw7ZcaVHAJH2M5c/Sj9ssuJavwK7JgDCUjcyU1o7G+ ZEVFgq4Lha2pQ74qVChIafYkfflCz+WPxYLp4G/+5EVAXJdsrrWtT8t2xs4YjeNM01 OfNVbjuDsbJDSPj0OvoYCaMNc3MA/jEHZl3vvXdYEK0iu8mTKc4unfjXkYKpuZPo/l 4/X/ZIfYzUgkCvJs5Y9YNsLQIHV2K316YkYOxj5IjuptmMRTnIwjqfUVS+rnVrHBVy f7ZZ1wp2DowCg== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/6/20 10:16 AM, Lukas Wunner wrote: > On Tue, Dec 01, 2020 at 01:12:44PM -0800, Sowjanya Komatineni wrote: >> + ret = devm_spi_register_master(&pdev->dev, master); > [...] >> +static int tegra_qspi_remove(struct platform_device *pdev) >> +{ >> + struct spi_master *master = platform_get_drvdata(pdev); >> + struct tegra_qspi_data *tqspi = spi_master_get_devdata(master); >> + >> + free_irq(tqspi->irq, tqspi); >> + >> + tegra_qspi_deinit_dma_param(tqspi, false); >> + tegra_qspi_deinit_dma_param(tqspi, true); >> + >> + pm_runtime_disable(&pdev->dev); >> + if (!pm_runtime_status_suspended(&pdev->dev)) >> + tegra_qspi_runtime_suspend(&pdev->dev); >> + >> + return 0; >> +} > With devm_spi_register_master(), the SPI controller is unregistered > *after* tegra_qspi_remove(). SPI transactions may still be ongoing > until the SPI controller is unregistered, yet you perform teardown > steps (such as freeing the IRQ) while it is still registered. > > Bottom line is, you can't use devm_spi_register_master() in this case. > You need to use spi_register_master() and explicitly call > spi_unregister_master() in tegra_qspi_remove() *before* performing > teardown steps. > > However, be sure to use the devm variant to *allocate* the SPI controller, > i.e. use devm_spi_alloc_master() instead of spi_alloc_master(). > > Thanks, > > Lukas Thanks Lukas. I see devm_spi_alloc_master() in 5.4 but not from 5.5 Thanks Sowjanya