[ARM] pxa: avoid always registering MMC, I2C, IrDA and framebuffer devices
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Thu, 8 Nov 2007 11:17:19 +0000 (11:17 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 26 Jan 2008 15:07:50 +0000 (15:07 +0000)
Only register the MMC, framebuffer, I2C and FICP devices when the
platform supplies the necessary platform data structures for the
devices.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/devices.h
arch/arm/mach-pxa/generic.c
arch/arm/mach-pxa/pxa25x.c
arch/arm/mach-pxa/pxa27x.c
arch/arm/mach-pxa/pxa3xx.c

index 94c8d5cdd60a9f940298c284ea58ffbbdda4e2b9..51162a7dba079efaebe94235cd5db2149ff22af3 100644 (file)
@@ -12,3 +12,5 @@ extern struct platform_device pxa_device_rtc;
 
 extern struct platform_device pxa27x_device_i2c_power;
 extern struct platform_device pxa27x_device_ohci;
+
+void __init pxa_register_device(struct platform_device *dev, void *data);
index 1c34946ee16e60c0fb3f6ff6491efc276455e108..3d863c919e8b58570159702f2e60a5075bf167e0 100644 (file)
@@ -235,6 +235,18 @@ void __init pxa_map_io(void)
 }
 
 
+void __init pxa_register_device(struct platform_device *dev, void *data)
+{
+       int ret;
+
+       dev->dev.platform_data = data;
+
+       ret = platform_device_register(dev);
+       if (ret)
+               dev_err(&dev->dev, "unable to register device: %d\n", ret);
+}
+
+
 static struct resource pxamci_resources[] = {
        [0] = {
                .start  = 0x41100000,
@@ -263,7 +275,7 @@ struct platform_device pxa_device_mci = {
 
 void __init pxa_set_mci_info(struct pxamci_platform_data *info)
 {
-       pxa_device_mci.dev.platform_data = info;
+       pxa_register_device(&pxa_device_mci, info);
 }
 
 
@@ -328,7 +340,7 @@ struct platform_device pxa_device_fb = {
 
 void __init set_pxa_fb_info(struct pxafb_mach_info *info)
 {
-       pxa_device_fb.dev.platform_data = info;
+       pxa_register_device(&pxa_device_fb, info);
 }
 
 void __init set_pxa_fb_parent(struct device *parent_dev)
@@ -433,7 +445,7 @@ struct platform_device pxa_device_i2c = {
 
 void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
 {
-       pxa_device_i2c.dev.platform_data = info;
+       pxa_register_device(&pxa_device_i2c, info);
 }
 
 static struct resource pxai2s_resources[] = {
@@ -468,7 +480,7 @@ struct platform_device pxa_device_ficp = {
 
 void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
 {
-       pxa_device_ficp.dev.platform_data = info;
+       pxa_register_device(&pxa_device_ficp, info);
 }
 
 struct platform_device pxa_device_rtc = {
index 9732d5d9466b1381fdb1b6ce416403af4215675d..d9ee0d9b36df62666cb13b67e04f11c02560d0c9 100644 (file)
@@ -287,15 +287,11 @@ void __init pxa25x_init_irq(void)
 }
 
 static struct platform_device *pxa25x_devices[] __initdata = {
-       &pxa_device_mci,
        &pxa_device_udc,
-       &pxa_device_fb,
        &pxa_device_ffuart,
        &pxa_device_btuart,
        &pxa_device_stuart,
-       &pxa_device_i2c,
        &pxa_device_i2s,
-       &pxa_device_ficp,
        &pxa_device_rtc,
 };
 
index 8e126e6b74c31be9e7f34cad14334ae70363dd7b..e7151dba6682e8eecae414515e62d504efb82ca4 100644 (file)
@@ -401,7 +401,7 @@ struct platform_device pxa27x_device_ohci = {
 
 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
 {
-       pxa27x_device_ohci.dev.platform_data = info;
+       pxa_register_device(&pxa27x_device_ohci, info);
 }
 
 static struct resource i2c_power_resources[] = {
@@ -424,18 +424,13 @@ struct platform_device pxa27x_device_i2c_power = {
 };
 
 static struct platform_device *devices[] __initdata = {
-       &pxa_device_mci,
        &pxa_device_udc,
-       &pxa_device_fb,
        &pxa_device_ffuart,
        &pxa_device_btuart,
        &pxa_device_stuart,
-       &pxa_device_i2c,
        &pxa_device_i2s,
-       &pxa_device_ficp,
        &pxa_device_rtc,
        &pxa27x_device_i2c_power,
-       &pxa27x_device_ohci,
 };
 
 static int __init pxa27x_init(void)
index 61d9c9d69e6b54c17d49067a3f3822e161c33d09..37fbc4face09f1a56fca7c6bf7566aff3e2f3097 100644 (file)
@@ -209,15 +209,11 @@ void __init pxa3xx_init_irq(void)
  */
 
 static struct platform_device *devices[] __initdata = {
-       &pxa_device_mci,
        &pxa_device_udc,
-       &pxa_device_fb,
        &pxa_device_ffuart,
        &pxa_device_btuart,
        &pxa_device_stuart,
-       &pxa_device_i2c,
        &pxa_device_i2s,
-       &pxa_device_ficp,
        &pxa_device_rtc,
 };