From patchwork Mon Apr 2 01:22:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 7567 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 004C923E23 for ; Mon, 2 Apr 2012 01:22:07 +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 BD2B9A1812D for ; Mon, 2 Apr 2012 01:22:06 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so4975195iag.11 for ; Sun, 01 Apr 2012 18:22:06 -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:x-gm-message-state; bh=ChEMZxgleRz84yCSK1B6Kw1NimcxIOh+bsQlsjVogT8=; b=CTOlWh06FXYTATjLSSOiNzQwNlRQr90VQVwa+wfwKWyib7cUiimoZVblaLdgpcZc8V aJnDzyIIqRIwdN2DsJQ9lvOFDomndYZMHA8X5bH2kETKMByFYUvHmq+pPXyvik7v/jmA oHQ1SWdKXM+feAUIVOd2cToN6uFZN9tDGnwHgmXq8HlkL2rDu01pV+ZguMXeIpe3/EWQ k/iRd2lMt9iNnDgC1KLPK/93km7D9kR8+DVzZ/n4xPcOsjj1OFcCccSpRKUw7QxuRIMM u5SZXDzmZvXmK9LH3cIeW4JD/ZrjDdrXQgKOhrYK1HqcGIdez074ucovk+y8uDcxsw36 4oCg== Received: by 10.50.212.101 with SMTP id nj5mr4052427igc.41.1333329726467; Sun, 01 Apr 2012 18:22:06 -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.5.205 with SMTP id 13csp87702ibw; Sun, 1 Apr 2012 18:22:05 -0700 (PDT) Received: by 10.204.10.91 with SMTP id o27mr2826225bko.5.1333329725276; Sun, 01 Apr 2012 18:22:05 -0700 (PDT) Received: from mail.df.lth.se (mail.df.lth.se. [194.47.250.12]) by mx.google.com with ESMTPS id ur7si8960584bkb.119.2012.04.01.18.22.04 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 01 Apr 2012 18:22:05 -0700 (PDT) Received-SPF: neutral (google.com: 194.47.250.12 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=194.47.250.12; Authentication-Results: mx.google.com; spf=neutral (google.com: 194.47.250.12 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) smtp.mail=linus.walleij@linaro.org Received: from fecusia (c83-249-217-152.bredband.comhem.se [83.249.217.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.df.lth.se (Postfix) with ESMTPSA id 2EEBC65D8D; Mon, 2 Apr 2012 03:22:03 +0200 (CEST) Received: by fecusia (sSMTP sendmail emulation); Mon, 2 Apr 2012 03:22:02 +0200 From: "Linus Walleij" To: linux-arm-kernel@lists.infradead.org Cc: Shawn Guo , Linus Walleij , Russell King Subject: [PATCH 3/4] ARM: integrator: factor out dynamic amba device allocator Date: Mon, 2 Apr 2012 03:22:01 +0200 Message-Id: <1333329721-31700-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.7.7.6 X-Gm-Message-State: ALoCoQkJ0wJqLrNlxIGg7UON78KObBVedYsjDm7FWC0ewBO0S9pHCfYgPcs/MQiTBIgSG6fAYmGY Replace the local amba device allocator with the core code from the bus driver. Cc: Russell King Signed-off-by: Linus Walleij --- arch/arm/mach-integrator/impd1.c | 22 +++++++--------------- 1 files changed, 7 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c index 3e538da..e428f3a 100644 --- a/arch/arm/mach-integrator/impd1.c +++ b/arch/arm/mach-integrator/impd1.c @@ -398,24 +398,16 @@ static int impd1_probe(struct lm_device *dev) struct impd1_device *idev = impd1_devs + i; struct amba_device *d; unsigned long pc_base; + char devname[32]; pc_base = dev->resource.start + idev->offset; - - d = amba_device_alloc(NULL, pc_base, SZ_4K); - if (!d) + snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12); + d = amba_ahb_device_add(&dev->dev, devname, pc_base, SZ_4K, + dev->irq, dev->irq, + idev->platform_data, idev->id); + if (IS_ERR(d)) { + dev_err(&dev->dev, "unable to register device: %ld\n", PTR_ERR(d)); continue; - - dev_set_name(&d->dev, "lm%x:%5.5lx", dev->id, idev->offset >> 12); - d->dev.parent = &dev->dev; - d->irq[0] = dev->irq; - d->irq[1] = dev->irq; - d->periphid = idev->id; - d->dev.platform_data = idev->platform_data; - - ret = amba_device_add(d, &dev->resource); - if (ret) { - dev_err(&d->dev, "unable to register device: %d\n", ret); - amba_device_put(d); } }