From patchwork Mon Apr 23 11:30:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8035 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5116523E47 for ; Mon, 23 Apr 2012 11:30:53 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 10018A1884E for ; Mon, 23 Apr 2012 11:30:52 +0000 (UTC) Received: by iage36 with SMTP id e36so22629027iag.11 for ; Mon, 23 Apr 2012 04:30:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=GOgFy8AJ8n+gRi7DZBrh2J/bDcXz1UqS3M6nJwGjrCo=; b=cFqVA1fNcZ1Ymx34G/uixtJggdZ1WLwFDFljuCtkvvkEDGKFhrp/S/FU/TQX4RgeTA /Q5Wsco3dig4ftwNoiL3sZMLwD99he3gsLFezLfeAc8C+iI4gVZ0at0zIayNG7i7SWXt a5QyPEB3gdd/591/LxOo7bUQ7n9lbYpwr4p0Gb3QA0+2DQcGIhpv+dam0qLaBNeB9FIv FSidbAMpbUrgKwwUdx+Qa3iwFhkFxE4jve4RRo8dclAFHGD2pQx3DGYLFpLsmxVuOq4f sp7DOZvbB3j/Rs8ZGMJIIhdBuIHCD2LbVyPvlglwArSNYwex7nB9Rp7i4kF21agjz9Ki tsbQ== Received: by 10.42.19.72 with SMTP id a8mr10766406icb.39.1335180652406; Mon, 23 Apr 2012 04:30:52 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp105937ibt; Mon, 23 Apr 2012 04:30:51 -0700 (PDT) Received: by 10.14.127.74 with SMTP id c50mr381915eei.0.1335180650878; Mon, 23 Apr 2012 04:30:50 -0700 (PDT) Received: from eu1sys200aog103.obsmtp.com (eu1sys200aog103.obsmtp.com. [207.126.144.115]) by mx.google.com with SMTP id c8si4286255eeo.94.2012.04.23.04.30.42 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 04:30:50 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.115 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.115; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.115 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob103.postini.com ([207.126.147.11]) with SMTP ID DSNKT5U9YiNwhwGHPpByvkxolg9T9UC2lnOm@postini.com; Mon, 23 Apr 2012 11:30:50 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 59CE3DA; Mon, 23 Apr 2012 11:22:16 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id D7BD0154E; Mon, 23 Apr 2012 11:30:37 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id D975224C2F1; Mon, 23 Apr 2012 13:30:30 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 23 Apr 2012 13:30:36 +0200 From: Linus Walleij To: , Cc: Grant Likely , Philippe LANGLAIS , Rabin Vincent , Jonas Aberg , Lee Jones , Linus Walleij Subject: [PATCH 5/9 v2] gpio/nomadik: use ioremap() instead of static mappings Date: Mon, 23 Apr 2012 13:30:32 +0200 Message-ID: <1335180632-21381-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkNfr2Yqxeft42FLM0V1IKQIcm7nYT+xsUxboEV8rJw86iBjtSsLT6UI6+OnTUUwXuJyFcz From: Linus Walleij We were using a custom io_p2v() (physical-to-virtual) translation macro, but it's fully possible to just ioremap() this memory now, so skip use of static addresses altogether. Signed-off-by: Linus Walleij --- drivers/gpio/gpio-nomadik.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index 7b45d88..bddc3dd 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c @@ -28,7 +28,6 @@ #include #include -#include #include /* @@ -1139,6 +1138,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) struct resource *res; struct clk *clk; int secondary_irq; + void __iomem *base; int irq; int ret; @@ -1169,10 +1169,16 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) goto out; } + base = ioremap(res->start, resource_size(res)); + if (!base) { + ret = -ENOMEM; + goto out_release; + } + clk = clk_get(&dev->dev, NULL); if (IS_ERR(clk)) { ret = PTR_ERR(clk); - goto out_release; + goto out_unmap; } nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); @@ -1186,7 +1192,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) */ nmk_chip->bank = dev->id; nmk_chip->clk = clk; - nmk_chip->addr = io_p2v(res->start); + nmk_chip->addr = base; nmk_chip->chip = nmk_gpio_template; nmk_chip->parent_irq = irq; nmk_chip->secondary_parent_irq = secondary_irq; @@ -1226,6 +1232,8 @@ out_free: out_clk: clk_disable(clk); clk_put(clk); +out_unmap: + iounmap(base); out_release: release_mem_region(res->start, resource_size(res)); out: