From patchwork Mon Oct 17 11:52:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 4708 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 97C8123DE2 for ; Mon, 17 Oct 2011 11:53:16 +0000 (UTC) Received: from mail-gy0-f180.google.com (mail-gy0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 51B47A184BD for ; Mon, 17 Oct 2011 11:53:16 +0000 (UTC) Received: by gyf1 with SMTP id 1so4439192gyf.11 for ; Mon, 17 Oct 2011 04:53:15 -0700 (PDT) Received: by 10.223.77.71 with SMTP id f7mr24065369fak.33.1318852395539; Mon, 17 Oct 2011 04:53:15 -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.152.1.71 with SMTP id 7cs5424lak; Mon, 17 Oct 2011 04:53:15 -0700 (PDT) Received: by 10.14.2.132 with SMTP id 4mr1203244eef.213.1318852395018; Mon, 17 Oct 2011 04:53:15 -0700 (PDT) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id x17si9636491weq.140.2011.10.17.04.53.14 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Oct 2011 04:53:15 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-ww0-f50.google.com with SMTP id 18so2946249wwi.31 for ; Mon, 17 Oct 2011 04:53:14 -0700 (PDT) Received: by 10.227.197.194 with SMTP id el2mr957184wbb.41.1318852394428; Mon, 17 Oct 2011 04:53:14 -0700 (PDT) Received: from localhost.localdomain (cpc2-aztw13-0-0-cust146.aztw.cable.virginmedia.com. [77.99.12.147]) by mx.google.com with ESMTPS id 11sm20503068wby.15.2011.10.17.04.53.12 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Oct 2011 04:53:13 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: gregkh@suse.de, linus.walleij@stericsson.com, jamie@jamieiles.com, arnd@arndb.de, Lee Jones Subject: [PATCH 6/6] mach-ux500: remove intermediary add_platform_device* functions Date: Mon, 17 Oct 2011 12:52:58 +0100 Message-Id: <1318852378-14180-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1318852378-14180-1-git-send-email-lee.jones@linaro.org> References: <1318852378-14180-1-git-send-email-lee.jones@linaro.org> These are no longer required since a 'parent' pointer is now passed to each registering device. Signed-off-by: Lee Jones --- arch/arm/mach-ux500/devices-common.c | 53 ---------------------------------- arch/arm/mach-ux500/devices-common.h | 34 +++++++++------------ arch/arm/mach-ux500/devices-db8500.h | 10 ++++-- 3 files changed, 22 insertions(+), 75 deletions(-) diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c index b8d9a99..170975f 100644 --- a/arch/arm/mach-ux500/devices-common.c +++ b/arch/arm/mach-ux500/devices-common.c @@ -59,59 +59,6 @@ dbx500_add_amba_device(struct device *parent, const char *name, } static struct platform_device * -dbx500_add_platform_device(const char *name, int id, void *pdata, - struct resource *res, int resnum) -{ - struct platform_device *dev; - int ret; - - dev = platform_device_alloc(name, id); - if (!dev) - return ERR_PTR(-ENOMEM); - - dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); - dev->dev.dma_mask = &dev->dev.coherent_dma_mask; - - ret = platform_device_add_resources(dev, res, resnum); - if (ret) - goto out_free; - - dev->dev.platform_data = pdata; - - ret = platform_device_add(dev); - if (ret) - goto out_free; - - return dev; - -out_free: - platform_device_put(dev); - return ERR_PTR(ret); -} - -struct platform_device * -dbx500_add_platform_device_4k1irq(const char *name, int id, - resource_size_t base, - int irq, void *pdata) -{ - struct resource resources[] = { - [0] = { - .start = base, - .end = base + SZ_4K - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = irq, - .end = irq, - .flags = IORESOURCE_IRQ, - } - }; - - return dbx500_add_platform_device(name, id, pdata, resources, - ARRAY_SIZE(resources)); -} - -static struct platform_device * dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq, struct nmk_gpio_platform_data *pdata) { diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h index f8adff8..089371e 100644 --- a/arch/arm/mach-ux500/devices-common.h +++ b/arch/arm/mach-ux500/devices-common.h @@ -8,14 +8,13 @@ #ifndef __DEVICES_COMMON_H #define __DEVICES_COMMON_H -extern struct amba_device * -dbx500_add_amba_device(struct device *parent, const char *name, resource_size_t base, - int irq, void *pdata, unsigned int periphid); +#include +#include -extern struct platform_device * -dbx500_add_platform_device_4k1irq(const char *name, int id, - resource_size_t base, - int irq, void *pdata); +extern struct amba_device * +dbx500_add_amba_device(struct device *parent, const char *name, + resource_size_t base, int irq, void *pdata, + unsigned int periphid); struct spi_master_cntlr; @@ -62,18 +61,15 @@ static inline struct platform_device * dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq, struct nmk_i2c_controller *pdata) { - return dbx500_add_platform_device_4k1irq("nmk-i2c", id, base, irq, - pdata); -} - -struct msp_i2s_platform_data; - -static inline struct platform_device * -dbx500_add_msp_i2s(int id, resource_size_t base, int irq, - struct msp_i2s_platform_data *pdata) -{ - return dbx500_add_platform_device_4k1irq("MSP_I2S", id, base, irq, - pdata); + struct resource resources[] = { + DEFINE_RES_MEM(base, SZ_4K), + DEFINE_RES_IRQ(irq), + }; + + return platform_device_register_resndata(parent, "nmk-i2c", + id, resources, + ARRAY_SIZE(resources), + pdata, sizeof(*pdata)); } static inline struct amba_device * diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h index 9bd08ad..9fd93e9 100644 --- a/arch/arm/mach-ux500/devices-db8500.h +++ b/arch/arm/mach-ux500/devices-db8500.h @@ -18,9 +18,13 @@ db8500_add_ske_keypad(struct device *parent, struct ske_keypad_platform_data *pdata, size_t size) { - return dbx500_add_platform_device_4k1irq("nmk-ske-keypad", -1, - U8500_SKE_BASE, - IRQ_DB8500_KB, pdata); + struct resource resources[] = { + DEFINE_RES_MEM(U8500_SKE_BASE, SZ_4K), + DEFINE_RES_IRQ(IRQ_DB8500_KB), + }; + + return platform_device_register_resndata(parent, "nmk-ske-keypad", -1, + resources, 2, pdata, size); } static inline struct amba_device *