From patchwork Tue Dec 27 14:01:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 133318 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 24B59B701D for ; Wed, 28 Dec 2011 01:03:46 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RfXbC-00075h-3z; Tue, 27 Dec 2011 14:01:50 +0000 Received: from mgw2.diku.dk ([130.225.96.92]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RfXb8-00075T-N1 for linux-mtd@lists.infradead.org; Tue, 27 Dec 2011 14:01:47 +0000 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id CFEE919BC07; Tue, 27 Dec 2011 15:01:42 +0100 (CET) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 11325-16; Tue, 27 Dec 2011 15:01:37 +0100 (CET) Received: from palace.topps.diku.dk (palace.ekstranet.diku.dk [192.38.115.202]) by mgw2.diku.dk (Postfix) with ESMTP id 11F3919BC3F; Tue, 27 Dec 2011 15:01:32 +0100 (CET) From: Julia Lawall To: David Woodhouse Subject: [PATCH 6/6] drivers/mtd/nand/txx9ndfmc.c: use devm_request_and_ioremap Date: Tue, 27 Dec 2011 15:01:31 +0100 Message-Id: <1324994491-21828-7-git-send-email-julia@diku.dk> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1324994491-21828-1-git-send-email-julia@diku.dk> References: <1324994491-21828-1-git-send-email-julia@diku.dk> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -3.2 (---) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-3.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.3 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 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 From: Julia Lawall Reimplement a call to devm_request_mem_region followed by a call to ioremap or ioremap_nocache by a call to devm_request_and_ioremap. The semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // @nm@ expression myname; identifier i; @@ struct platform_driver i = { .driver = { .name = myname } }; @@ expression dev,res,size; expression nm.myname; @@ -if (!devm_request_mem_region(dev, res->start, size, - \(res->name\|dev_name(dev)\|myname\))) { - ... - return ...; -} ... when != res->start ( -devm_ioremap(dev,res->start,size) +devm_request_and_ioremap(dev,res) | -devm_ioremap_nocache(dev,res->start,size) +devm_request_and_ioremap(dev,res) ) ... when any when != res->start // Signed-off-by: Julia Lawall --- drivers/mtd/nand/txx9ndfmc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c index ace46fd..c7c4f1d 100644 --- a/drivers/mtd/nand/txx9ndfmc.c +++ b/drivers/mtd/nand/txx9ndfmc.c @@ -298,11 +298,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev) drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) return -ENOMEM; - if (!devm_request_mem_region(&dev->dev, res->start, - resource_size(res), dev_name(&dev->dev))) - return -EBUSY; - drvdata->base = devm_ioremap(&dev->dev, res->start, - resource_size(res)); + drvdata->base = devm_request_and_ioremap(&dev->dev, res); if (!drvdata->base) return -EBUSY;