From patchwork Sat Sep 18 23:12:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 65148 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7682CB6EFE for ; Sun, 19 Sep 2010 15:10:20 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1OxC8O-0004Or-EH; Sun, 19 Sep 2010 05:08:16 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1OxBNy-00041d-DH for linux-mtd@bombadil.infradead.org; Sun, 19 Sep 2010 04:20:18 +0000 Received: from mail-fx0-f49.google.com ([209.85.161.49]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Ox6bL-0008Lx-6z for linux-mtd@lists.infradead.org; Sat, 18 Sep 2010 23:14:03 +0000 Received: by fxm4 with SMTP id 4so197257fxm.36 for ; Sat, 18 Sep 2010 16:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=8OdlrUWz2h/l629H0VLPJgVou9FrIIWYYLrgPPXq3Ik=; b=jBH9fXiPJmVALTVNlFhG/8LP1i+dgJ+NVP3bL76UKvsoWEdr5M2U0hamMH2gT8ONHy lAJSAJ2150wuLxZsloUOUpraouTas1x1cdsSUpmtCmJaHzStCIFXAORdEbIHZcxVqNF+ 6UWv7Kovcgc6AnWwNphhn0uHciquJQYfKc9eY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=uAgaOpYFX5IhOye+DUFu4bOA4IDltFtCPUrdT5ZaCHZvmWSaCB/NyqbRLiEdqexVQU ZLCxNgx4MkVyED/6bzE2APXv8cys9XKLyH5zGWuDLELYKRrsIPI2R2YRx15vGGm3E5iU pfCZP1yuCPvRzODqvA4lLiM8tqudRWErqvWq8= Received: by 10.223.124.146 with SMTP id u18mr2919258far.94.1284851577966; Sat, 18 Sep 2010 16:12:57 -0700 (PDT) Received: from localhost.localdomain (87.68.18.135.cable.012.net.il [87.68.18.135]) by mx.google.com with ESMTPS id 19sm2237753fas.25.2010.09.18.16.12.55 (version=SSLv3 cipher=RC4-MD5); Sat, 18 Sep 2010 16:12:57 -0700 (PDT) From: Maxim Levitsky To: David Woodhouse Subject: [PATCH 2/3] MTD: r852: remove useless pci powerup/down from suspend/resume routines. Date: Sun, 19 Sep 2010 01:12:37 +0200 Message-Id: <1284851558-1154-3-git-send-email-maximlevitsky@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1284851558-1154-1-git-send-email-maximlevitsky@gmail.com> References: <1284851558-1154-1-git-send-email-maximlevitsky@gmail.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100919_001347_384831_D1186A81 X-CRM114-Status: GOOD ( 18.85 ) X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.3.1 on casper.infradead.org summary: Content analysis details: (-1.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 TVD_SUBJ_WIPE_DEBT TVD_SUBJ_WIPE_DEBT 0.0 FREEMAIL_FROM Sender email is freemail (maximlevitsky[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Andrew Morton , linux-mtd@lists.infradead.org, Maxim Levitsky , Maciej Rutecki X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org It turns out that pci core now handles these, so this code is redundand and can even cause bugs Signed-off-by: Maxim Levitsky --- drivers/mtd/nand/r852.c | 30 +----------------------------- drivers/mtd/nand/r852.h | 2 -- 2 files changed, 1 insertions(+), 31 deletions(-) diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c index 5169ca6..d9d7efb 100644 --- a/drivers/mtd/nand/r852.c +++ b/drivers/mtd/nand/r852.c @@ -757,11 +757,6 @@ static irqreturn_t r852_irq(int irq, void *data) spin_lock_irqsave(&dev->irqlock, flags); - /* We can recieve shared interrupt while pci is suspended - in that case reads will return 0xFFFFFFFF.... */ - if (dev->insuspend) - goto out; - /* handle card detection interrupts first */ card_status = r852_read_reg(dev, R852_CARD_IRQ_STA); r852_write_reg(dev, R852_CARD_IRQ_STA, card_status); @@ -1035,7 +1030,6 @@ void r852_shutdown(struct pci_dev *pci_dev) int r852_suspend(struct device *device) { struct r852_device *dev = pci_get_drvdata(to_pci_dev(device)); - unsigned long flags; if (dev->ctlreg & R852_CTL_CARDENABLE) return -EBUSY; @@ -1047,43 +1041,22 @@ int r852_suspend(struct device *device) r852_disable_irqs(dev); r852_engine_disable(dev); - spin_lock_irqsave(&dev->irqlock, flags); - dev->insuspend = 1; - spin_unlock_irqrestore(&dev->irqlock, flags); - - /* At that point, even if interrupt handler is running, it will quit */ - /* So wait for this to happen explictly */ - synchronize_irq(dev->irq); - /* If card was pulled off just during the suspend, which is very unlikely, we will remove it on resume, it too late now anyway... */ dev->card_unstable = 0; - - pci_save_state(to_pci_dev(device)); - return pci_prepare_to_sleep(to_pci_dev(device)); + return 0; } int r852_resume(struct device *device) { struct r852_device *dev = pci_get_drvdata(to_pci_dev(device)); - unsigned long flags; - - /* Turn on the hardware */ - pci_back_from_sleep(to_pci_dev(device)); - pci_restore_state(to_pci_dev(device)); r852_disable_irqs(dev); r852_card_update_present(dev); r852_engine_disable(dev); - /* Now its safe for IRQ to run */ - spin_lock_irqsave(&dev->irqlock, flags); - dev->insuspend = 0; - spin_unlock_irqrestore(&dev->irqlock, flags); - - /* If card status changed, just do the work */ if (dev->card_detected != dev->card_registred) { dbg("card was %s during low power state", @@ -1121,7 +1094,6 @@ MODULE_DEVICE_TABLE(pci, r852_pci_id_tbl); SIMPLE_DEV_PM_OPS(r852_pm_ops, r852_suspend, r852_resume); - static struct pci_driver r852_pci_driver = { .name = DRV_NAME, .id_table = r852_pci_id_tbl, diff --git a/drivers/mtd/nand/r852.h b/drivers/mtd/nand/r852.h index 8096cc2..e6a21d9 100644 --- a/drivers/mtd/nand/r852.h +++ b/drivers/mtd/nand/r852.h @@ -140,8 +140,6 @@ struct r852_device { /* interrupt handling */ spinlock_t irqlock; /* IRQ protecting lock */ int irq; /* irq num */ - int insuspend; /* device is suspended */ - /* misc */ void *tmp_buffer; /* temporary buffer */ uint8_t ctlreg; /* cached contents of control reg */