From patchwork Thu Jul 3 19:42:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HIMANGI SARAOGI X-Patchwork-Id: 4476761 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D44ECBEEAA for ; Thu, 3 Jul 2014 19:42:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E0FAA20384 for ; Thu, 3 Jul 2014 19:42:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 167CD20304 for ; Thu, 3 Jul 2014 19:42:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753646AbaGCTmf (ORCPT ); Thu, 3 Jul 2014 15:42:35 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:49651 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753427AbaGCTmf (ORCPT ); Thu, 3 Jul 2014 15:42:35 -0400 Received: by mail-pd0-f175.google.com with SMTP id v10so712711pde.34 for ; Thu, 03 Jul 2014 12:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=zt0KxmmT+tvV33dWlNFvj7XOK5clfaqDEKTKxppazt8=; b=Fh7Os2mRzqPiJUb+dnl/eykPTuD2eIxAlVOqoVnb48Uudk+BC3cSbnHu0cwXqkm9z/ wpm0QppDn7mwjmBz9OaYtbeX9oalAMYeAVLzugQObjFvwqmLHcz0vJAFk3LJy38oY10K i134gHN7HMeSh8Xx01Xg5Z23CaMISr51eO0nGiD4gdPI3V5/M2GfGRXLsXZlC/WA8kcp YIXyM3HkEKdtmsiF/dBesc2iOCTK3SyTB31XJmY3T98dO3XlhHRPoU7FQ1QIStdpAcsC pME10yEiBKHe9yFG0NvCAj9kgZ2RXUmge3lBnqNWvA18fP5AfbpIwFrpBu4J+8imL/mf vFXA== X-Received: by 10.67.4.138 with SMTP id ce10mr6691090pad.12.1404416554505; Thu, 03 Jul 2014 12:42:34 -0700 (PDT) Received: from localhost ([42.104.13.151]) by mx.google.com with ESMTPSA id g6sm146189832pat.2.2014.07.03.12.42.31 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 03 Jul 2014 12:42:33 -0700 (PDT) Date: Fri, 4 Jul 2014 01:12:25 +0530 From: Himangi Saraogi To: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: julia.lawall@lip6.fr Subject: [PATCH] spi/spi-sh: Use devm_ioremap Message-ID: <20140703194225.GA4388@himangi-Dell> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces the use of devm_ioremap and removes the iounmaps in the probe and remove functions. Also, the labels are renamed to preserve ordering. Signed-off-by: Himangi Saraogi --- I would like to know if it will be a good idea to devmify the request_irq as well. There is ampiguity as the calls to spi_unregister_master and destroy_workqueue are before free_irq in remove function while after free_irq in the probe function. drivers/spi/spi-sh.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c index 03edf5e..2c30da0 100644 --- a/drivers/spi/spi-sh.c +++ b/drivers/spi/spi-sh.c @@ -432,7 +432,6 @@ static int spi_sh_remove(struct platform_device *pdev) spi_unregister_master(ss->master); destroy_workqueue(ss->workqueue); free_irq(ss->irq, ss); - iounmap(ss->addr); return 0; } @@ -480,7 +479,7 @@ static int spi_sh_probe(struct platform_device *pdev) } ss->irq = irq; ss->master = master; - ss->addr = ioremap(res->start, resource_size(res)); + ss->addr = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (ss->addr == NULL) { dev_err(&pdev->dev, "ioremap error.\n"); ret = -ENOMEM; @@ -501,7 +500,7 @@ static int spi_sh_probe(struct platform_device *pdev) ret = request_irq(irq, spi_sh_irq, 0, "spi_sh", ss); if (ret < 0) { dev_err(&pdev->dev, "request_irq error\n"); - goto error3; + goto error2; } master->num_chipselect = 2; @@ -513,17 +512,15 @@ static int spi_sh_probe(struct platform_device *pdev) ret = spi_register_master(master); if (ret < 0) { printk(KERN_ERR "spi_register_master error.\n"); - goto error4; + goto error3; } return 0; - error4: - free_irq(irq, ss); error3: - destroy_workqueue(ss->workqueue); + free_irq(irq, ss); error2: - iounmap(ss->addr); + destroy_workqueue(ss->workqueue); error1: spi_master_put(master);