linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/6] mach-ux500: remove intermediary add_platform_device* functions
Date: Mon,  6 Feb 2012 11:22:26 -0800	[thread overview]
Message-ID: <1328556146-3730-7-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1328556146-3730-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 <lee.jones@linaro.org>
---
 arch/arm/mach-ux500/devices-common.c |   53 ----------------------------------
 arch/arm/mach-ux500/devices-common.h |   46 ++++++++++++++++-------------
 arch/arm/mach-ux500/devices-db8500.h |   10 ++++--
 3 files changed, 33 insertions(+), 76 deletions(-)

diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index 96effbd..c3bc094 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..39c74ec 100644
--- a/arch/arm/mach-ux500/devices-common.h
+++ b/arch/arm/mach-ux500/devices-common.h
@@ -8,14 +8,15 @@
 #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 <linux/platform_device.h>
+#include <linux/dma-mapping.h>
+#include <linux/sys_soc.h>
+#include <plat/i2c.h>
 
-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;
 
@@ -60,20 +61,25 @@ struct nmk_i2c_controller;
 
 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)
+	       struct nmk_i2c_controller *data)
 {
-	return dbx500_add_platform_device_4k1irq("MSP_I2S", id, base, irq,
-						 pdata);
+	struct resource res[] = {
+		DEFINE_RES_MEM(base, SZ_4K),
+		DEFINE_RES_IRQ(irq),
+	};
+
+	struct platform_device_info pdevinfo = {
+		.parent = parent,
+		.name = "nmk-i2c",
+		.id = id,
+		.res = res,
+		.num_res = ARRAY_SIZE(res),
+		.data = data,
+		.size_data = sizeof(*data),
+		.dma_mask = DMA_BIT_MASK(32),
+	};
+
+	return platform_device_register_full(&pdevinfo);
 }
 
 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 *
-- 
1.7.5.4

  parent reply	other threads:[~2012-02-06 19:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-06 19:22 [PATCH 0/6] ux500: Export SoC information and some platform clean-up Lee Jones
2012-02-06 19:22 ` [PATCH 1/6] mach-ux500: pass parent pointer to each platform device Lee Jones
2012-02-06 19:22 ` [PATCH 2/6] drivers/base: add bus for System-on-Chip devices Lee Jones
2012-02-06 19:22 ` [PATCH 3/6] Documentation: add information for new sysfs soc bus functionality Lee Jones
2012-02-06 19:22 ` [PATCH 4/6] mach-ux500: export System-on-Chip information ux500 via sysfs Lee Jones
2012-02-06 19:22 ` [PATCH 5/6] mach-ux500: move top level platform devices in sysfs to /sys/devices/socX Lee Jones
2012-02-06 19:22 ` Lee Jones [this message]
2012-02-06 19:33 ` [PATCH 0/6] ux500: Export SoC information and some platform clean-up Linus Walleij
2012-02-10 19:43 ` Greg KH
2012-02-13  6:28   ` Arnd Bergmann
2012-02-13 19:54     ` Linus Walleij
  -- strict thread matches above, loose matches on Subject: below --
2012-02-01  9:23 Lee Jones
2012-02-01  9:23 ` [PATCH 6/6] mach-ux500: remove intermediary add_platform_device* functions Lee Jones
2012-01-21 17:08 [PATCH 0/6] ux500: Export SoC information and some platform clean-up Lee Jones
2012-01-21 17:08 ` [PATCH 6/6] mach-ux500: remove intermediary add_platform_device* functions Lee Jones
2012-01-20 16:10 [PATCH 0/6] ux500: Export SoC information and some platform clean-up Lee Jones
2012-01-20 16:10 ` [PATCH 6/6] mach-ux500: remove intermediary add_platform_device* functions Lee Jones
2011-10-17 11:52 [PATCH 0/6] ux500: Export SoC information and some platform clean-up Lee Jones
2011-10-17 11:52 ` [PATCH 6/6] mach-ux500: remove intermediary add_platform_device* functions Lee Jones
2011-10-17 11:59   ` Jamie Iles
2011-10-19 14:43     ` Lee Jones
2011-10-19 14:45       ` Jamie Iles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1328556146-3730-7-git-send-email-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).