ARM: sa11x0: convert set_xxx_data() to register_xxx()
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 6 Oct 2009 13:55:53 +0000 (14:55 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 6 Dec 2009 16:52:23 +0000 (16:52 +0000)
Only register devices if we have platform data for those which require
platform data.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
13 files changed:
arch/arm/mach-sa1100/assabet.c
arch/arm/mach-sa1100/badge4.c
arch/arm/mach-sa1100/cerf.c
arch/arm/mach-sa1100/collie.c
arch/arm/mach-sa1100/generic.c
arch/arm/mach-sa1100/generic.h
arch/arm/mach-sa1100/h3600.c
arch/arm/mach-sa1100/hackkit.c
arch/arm/mach-sa1100/jornada720.c
arch/arm/mach-sa1100/lart.c
arch/arm/mach-sa1100/pleb.c
arch/arm/mach-sa1100/shannon.c
arch/arm/mach-sa1100/simpad.c

index 55e64477a87620de602964da3573f822dea1a516..169e5b87dbffa5ac001dda528e282bada4c7b673 100644 (file)
@@ -249,10 +249,10 @@ static void __init assabet_init(void)
 #endif
        }
 
-       sa11x0_set_flash_data(&assabet_flash_data, assabet_flash_resources,
-                             ARRAY_SIZE(assabet_flash_resources));
-       sa11x0_set_irda_data(&assabet_irda_data);
-       sa11x0_set_mcp_data(&assabet_mcp_data);
+       sa11x0_register_mtd(&assabet_flash_data, assabet_flash_resources,
+                           ARRAY_SIZE(assabet_flash_resources));
+       sa11x0_register_irda(&assabet_irda_data);
+       sa11x0_register_mcp(&assabet_mcp_data);
 }
 
 /*
index ab5883b39ddf3a75101bb2f5d15bc05f78e2d01f..051ec0f0023c26e9d47da2e09e0875239d3355ca 100644 (file)
@@ -212,7 +212,7 @@ static int __init badge4_init(void)
        /* maybe turn on 5v0 from the start */
        badge4_set_5V(BADGE4_5V_INITIALLY, five_v_on);
 
-       sa11x0_set_flash_data(&badge4_flash_data, &badge4_flash_resource, 1);
+       sa11x0_register_mtd(&badge4_flash_data, &badge4_flash_resource, 1);
 
        return 0;
 }
index fd3ad9cfc9125683c792847ff5a5d43d087f0364..bc950ef418af35a534bf01900482d68b8232ddf1 100644 (file)
@@ -129,8 +129,8 @@ static struct mcp_plat_data cerf_mcp_data = {
 static void __init cerf_init(void)
 {
        platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
-       sa11x0_set_flash_data(&cerf_flash_data, &cerf_flash_resource, 1);
-       sa11x0_set_mcp_data(&cerf_mcp_data);
+       sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
+       sa11x0_register_mcp(&cerf_mcp_data);
 }
 
 MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
index bbf2ebcc3066b517658697a830a94a0af0ba58b9..be7e5a3c47d0e60bf4a0ff5f253312f90ef984fa 100644 (file)
@@ -272,9 +272,9 @@ static void __init collie_init(void)
                printk(KERN_WARNING "collie: Unable to register LoCoMo device\n");
        }
 
-       sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources,
-                             ARRAY_SIZE(collie_flash_resources));
-       sa11x0_set_mcp_data(&collie_mcp_data);
+       sa11x0_register_mtd(&collie_flash_data, collie_flash_resources,
+                           ARRAY_SIZE(collie_flash_resources));
+       sa11x0_register_mcp(&collie_mcp_data);
 
        sharpsl_save_param();
 }
index 23cfdd5939541d82be5f1670ce19ddd9f5bf224e..9faea1511c1f06554277b99a35192641e23cade0 100644 (file)
@@ -162,6 +162,17 @@ static void sa1100_power_off(void)
        PMCR = PMCR_SF;
 }
 
+static void sa11x0_register_device(struct platform_device *dev, void *data)
+{
+       int err;
+       dev->dev.platform_data = data;
+       err = platform_device_register(dev);
+       if (err)
+               printk(KERN_ERR "Unable to register device %s: %d\n",
+                       dev->name, err);
+}
+
+
 static struct resource sa11x0udc_resources[] = {
        [0] = {
                .start  = 0x80000000,
@@ -234,9 +245,9 @@ static struct platform_device sa11x0mcp_device = {
        .resource       = sa11x0mcp_resources,
 };
 
-void sa11x0_set_mcp_data(struct mcp_plat_data *data)
+void sa11x0_register_mcp(struct mcp_plat_data *data)
 {
-       sa11x0mcp_device.dev.platform_data = data;
+       sa11x0_register_device(&sa11x0mcp_device, data);
 }
 
 static struct resource sa11x0ssp_resources[] = {
@@ -293,13 +304,13 @@ static struct platform_device sa11x0mtd_device = {
        .id             = -1,
 };
 
-void sa11x0_set_flash_data(struct flash_platform_data *flash,
-                          struct resource *res, int nr)
+void sa11x0_register_mtd(struct flash_platform_data *flash,
+                        struct resource *res, int nr)
 {
        flash->name = "sa1100";
-       sa11x0mtd_device.dev.platform_data = flash;
        sa11x0mtd_device.resource = res;
        sa11x0mtd_device.num_resources = nr;
+       sa11x0_register_device(&sa11x0mtd_device, flash);
 }
 
 static struct resource sa11x0ir_resources[] = {
@@ -329,9 +340,9 @@ static struct platform_device sa11x0ir_device = {
        .resource       = sa11x0ir_resources,
 };
 
-void sa11x0_set_irda_data(struct irda_platform_data *irda)
+void sa11x0_register_irda(struct irda_platform_data *irda)
 {
-       sa11x0ir_device.dev.platform_data = irda;
+       sa11x0_register_device(&sa11x0ir_device, irda);
 }
 
 static struct platform_device sa11x0rtc_device = {
@@ -343,21 +354,15 @@ static struct platform_device *sa11x0_devices[] __initdata = {
        &sa11x0udc_device,
        &sa11x0uart1_device,
        &sa11x0uart3_device,
-       &sa11x0mcp_device,
        &sa11x0ssp_device,
        &sa11x0pcmcia_device,
        &sa11x0fb_device,
-       &sa11x0mtd_device,
        &sa11x0rtc_device,
 };
 
 static int __init sa1100_init(void)
 {
        pm_power_off = sa1100_power_off;
-
-       if (sa11x0ir_device.dev.platform_data)
-               platform_device_register(&sa11x0ir_device);
-
        return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
 }
 
index 793c2e6c991fd3e968f9ea54bce4bd77dd64cfb3..ec03f187c52bcef3e1cf28145b373016b7e66e2d 100644 (file)
@@ -32,14 +32,11 @@ extern unsigned int sa11x0_ppcr_to_freq(unsigned int idx);
 struct flash_platform_data;
 struct resource;
 
-extern void sa11x0_set_flash_data(struct flash_platform_data *flash,
-                                 struct resource *res, int nr);
-
-struct sa11x0_ssp_plat_ops;
-extern void sa11x0_set_ssp_data(struct sa11x0_ssp_plat_ops *ops);
+void sa11x0_register_mtd(struct flash_platform_data *flash,
+                        struct resource *res, int nr);
 
 struct irda_platform_data;
-void sa11x0_set_irda_data(struct irda_platform_data *irda);
+void sa11x0_register_irda(struct irda_platform_data *irda);
 
 struct mcp_plat_data;
-void sa11x0_set_mcp_data(struct mcp_plat_data *data);
+void sa11x0_register_mcp(struct mcp_plat_data *data);
index 0eb2f159578b639d56e7cddaeea9ffd033a213d8..0b4b8704f9b3a8b9b5aed52da547530afbc9adea 100644 (file)
@@ -102,8 +102,8 @@ static struct irda_platform_data h3600_irda_data = {
 
 static void h3xxx_mach_init(void)
 {
-       sa11x0_set_flash_data(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
-       sa11x0_set_irda_data(&h3600_irda_data);
+       sa11x0_register_mtd(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
+       sa11x0_register_irda(&h3600_irda_data);
 }
 
 /*
index e7056c0b562c2017377284bdcce635ee6858edbf..51568dfc8e97187c2892b699bc5ac493d1b16008 100644 (file)
@@ -187,7 +187,7 @@ static struct resource hackkit_flash_resource = {
 
 static void __init hackkit_init(void)
 {
-       sa11x0_set_flash_data(&hackkit_flash_data, &hackkit_flash_resource, 1);
+       sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1);
 }
 
 /**********************************************************************
index fd776bb666cd997ae50385156ecb3b709cd35272..13ebd2d99bfd90ea66541bfb47d19682fe348f08 100644 (file)
@@ -354,7 +354,7 @@ static struct resource jornada720_flash_resource = {
 
 static void __init jornada720_mach_init(void)
 {
-       sa11x0_set_flash_data(&jornada720_flash_data, &jornada720_flash_resource, 1);
+       sa11x0_register_mtd(&jornada720_flash_data, &jornada720_flash_resource, 1);
 }
 
 MACHINE_START(JORNADA720, "HP Jornada 720")
index 1f940df0e5af17a9b2199c376e4e0c8d85d13adf..68069d6dc07a8b26d29787f0632a4895d66021ea 100644 (file)
@@ -28,7 +28,7 @@ static struct mcp_plat_data lart_mcp_data = {
 
 static void __init lart_init(void)
 {
-       sa11x0_set_mcp_data(&lart_mcp_data);
+       sa11x0_register_mcp(&lart_mcp_data);
 }
 
 static struct map_desc lart_io_desc[] __initdata = {
index e1458bc1868ef8907b1ca8bb878d467c67764ecf..1ccd6018d3a3a1dcec774ae0aad88108f75c9be0 100644 (file)
@@ -109,7 +109,7 @@ static struct flash_platform_data pleb_flash_data = {
 
 static void __init pleb_init(void)
 {
-       sa11x0_set_flash_data(&pleb_flash_data, pleb_flash_resources,
+       sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources,
                              ARRAY_SIZE(pleb_flash_resources));
 
 
index ddd917d1083d79c4d04da6d2ced5248322672e3b..85e82bb73d7ef7b3244428954949716906ebdd8e 100644 (file)
@@ -59,8 +59,8 @@ static struct mcp_plat_data shannon_mcp_data = {
 
 static void __init shannon_init(void)
 {
-       sa11x0_set_flash_data(&shannon_flash_data, &shannon_flash_resource, 1);
-       sa11x0_set_mcp_data(&shannon_mcp_data);
+       sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1);
+       sa11x0_register_mcp(&shannon_mcp_data);
 }
 
 static void __init shannon_map_io(void)
index 3c74534f7fee427221f38733d3aee96dcbddc134..49cfd64663ac5753cec35a0db395d809baf4fc15 100644 (file)
@@ -166,9 +166,9 @@ static void __init simpad_map_io(void)
        PCFR = 0;
        PSDR = 0;
 
-       sa11x0_set_flash_data(&simpad_flash_data, simpad_flash_resources,
+       sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
                              ARRAY_SIZE(simpad_flash_resources));
-       sa11x0_set_mcp_data(&simpad_mcp_data);
+       sa11x0_register_mcp(&simpad_mcp_data);
 }
 
 static void simpad_power_off(void)