From patchwork Wed Jan 6 15:57:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Korsgaard X-Patchwork-Id: 42303 X-Patchwork-Delegate: grant.likely@secretlab.ca Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id BEDA9B7C93 for ; Thu, 7 Jan 2010 02:57:27 +1100 (EST) Received: by ozlabs.org (Postfix) id 67004B6F04; Thu, 7 Jan 2010 02:57:20 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from mail-ew0-f214.google.com (mail-ew0-f214.google.com [209.85.219.214]) by ozlabs.org (Postfix) with ESMTP id 7D9FCB6EFE for ; Thu, 7 Jan 2010 02:57:19 +1100 (EST) Received: by ewy6 with SMTP id 6so16286999ewy.9 for ; Wed, 06 Jan 2010 07:57:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:from:to:cc :subject:date:message-id:x-mailer; bh=WEeWfnZnQQXaSIC3KUFdt6M8SoJHbeLXRKYFXNcZfag=; b=NTt0VSONcD0D0n7Mk5QzFd4xB3Q1s3RiiE725T/VcvNXQ0zZa4PxVcQTBnp7LRcqi+ KFkfy9hr+kOmtevs5W4ZXb+l001y1pT4VcBQ8OCn7Ib97rxGPe2il6XPH3/z4PTgew0k PjZ4OKi8YW+hJWHsfAcSmLsFvLFGT0qzvTiMw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; b=p7aoDjH2S94jI/SQGHtymUCp6DTaGytBaWf7F6jWxBLMGC71CPhvJ6zCbsgGBAbgMn WEds4Nv87Mhe9/dd/zcZ/vEgKN6/89zHhiQ2WiGZ6E03cFLszkJlnJZOs8HEZDJXD2Xm lvADEYXFWGOxn+YCbq4LXjf6mye4JVhw7Vv18= Received: by 10.213.110.206 with SMTP id o14mr22730557ebp.6.1262793436729; Wed, 06 Jan 2010 07:57:16 -0800 (PST) Received: from macbook.be.48ers.dk (191.207-78-194.adsl-fix.skynet.be [194.78.207.191]) by mx.google.com with ESMTPS id 16sm14148604ewy.14.2010.01.06.07.57.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 06 Jan 2010 07:57:15 -0800 (PST) Received: by macbook.be.48ers.dk (Postfix, from userid 1000) id AEDFCC3A13; Wed, 6 Jan 2010 16:57:14 +0100 (CET) From: Peter Korsgaard To: avorontsov@ru.mvista.com, dbrownell@users.sourceforge.net, galak@kernel.crashing.org, linuxppc-dev@ozlabs.org Subject: [PATCH] spi_mpc8xxx: fix WARN_ON on remove after 4c1fba44296 Date: Wed, 6 Jan 2010 16:57:11 +0100 Message-Id: <1262793431-24214-1-git-send-email-jacmet@sunsite.dk> X-Mailer: git-send-email 1.6.5 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Commit 4c1fba44296 (Add support for QE DMA mode and CPM1/CPM2 chips) added unconditional calls to _cpm_init() / _cpm_free() from probe()/remove(), but only checked if we're actually using CPM mode in _init(), causing the WARN_ON in mpc8xxx_spi_free_dummy_rx() for !CPM. Fix it by adding the same check in _cpm_free() as well. Signed-off-by: Peter Korsgaard --- drivers/spi/spi_mpc8xxx.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c index 1fb2a6e..0604d6b 100644 --- a/drivers/spi/spi_mpc8xxx.c +++ b/drivers/spi/spi_mpc8xxx.c @@ -946,6 +946,9 @@ static void mpc8xxx_spi_cpm_free(struct mpc8xxx_spi *mspi) { struct device *dev = mspi->dev; + if (!(mspi->flags & SPI_CPM_MODE)) + return 0; + dma_unmap_single(dev, mspi->dma_dummy_rx, SPI_MRBLR, DMA_FROM_DEVICE); dma_unmap_single(dev, mspi->dma_dummy_tx, PAGE_SIZE, DMA_TO_DEVICE); cpm_muram_free(cpm_muram_offset(mspi->tx_bd));