aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2007-11-08 06:17:19 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-01-26 10:07:50 -0500
commit03f5b2cee6cabd0400b9f89956c373a0b5d3802a (patch)
treeabea1a5700170fc5434b200679aa51e876afe3a7
parent2fd2b1242810fb4d2ba36548fecc1f005c36770c (diff)
[ARM] pxa: avoid always registering MMC, I2C, IrDA and framebuffer devices
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>
-rw-r--r--arch/arm/mach-pxa/devices.h2
-rw-r--r--arch/arm/mach-pxa/generic.c20
-rw-r--r--arch/arm/mach-pxa/pxa25x.c4
-rw-r--r--arch/arm/mach-pxa/pxa27x.c7
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c4
5 files changed, 19 insertions, 18 deletions
diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h
index 94c8d5cdd60a..51162a7dba07 100644
--- a/arch/arm/mach-pxa/devices.h
+++ b/arch/arm/mach-pxa/devices.h
@@ -12,3 +12,5 @@ extern struct platform_device pxa_device_rtc;
12 12
13extern struct platform_device pxa27x_device_i2c_power; 13extern struct platform_device pxa27x_device_i2c_power;
14extern struct platform_device pxa27x_device_ohci; 14extern struct platform_device pxa27x_device_ohci;
15
16void __init pxa_register_device(struct platform_device *dev, void *data);
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 1c34946ee16e..3d863c919e8b 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -235,6 +235,18 @@ void __init pxa_map_io(void)
235} 235}
236 236
237 237
238void __init pxa_register_device(struct platform_device *dev, void *data)
239{
240 int ret;
241
242 dev->dev.platform_data = data;
243
244 ret = platform_device_register(dev);
245 if (ret)
246 dev_err(&dev->dev, "unable to register device: %d\n", ret);
247}
248
249
238static struct resource pxamci_resources[] = { 250static struct resource pxamci_resources[] = {
239 [0] = { 251 [0] = {
240 .start = 0x41100000, 252 .start = 0x41100000,
@@ -263,7 +275,7 @@ struct platform_device pxa_device_mci = {
263 275
264void __init pxa_set_mci_info(struct pxamci_platform_data *info) 276void __init pxa_set_mci_info(struct pxamci_platform_data *info)
265{ 277{
266 pxa_device_mci.dev.platform_data = info; 278 pxa_register_device(&pxa_device_mci, info);
267} 279}
268 280
269 281
@@ -328,7 +340,7 @@ struct platform_device pxa_device_fb = {
328 340
329void __init set_pxa_fb_info(struct pxafb_mach_info *info) 341void __init set_pxa_fb_info(struct pxafb_mach_info *info)
330{ 342{
331 pxa_device_fb.dev.platform_data = info; 343 pxa_register_device(&pxa_device_fb, info);
332} 344}
333 345
334void __init set_pxa_fb_parent(struct device *parent_dev) 346void __init set_pxa_fb_parent(struct device *parent_dev)
@@ -433,7 +445,7 @@ struct platform_device pxa_device_i2c = {
433 445
434void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info) 446void __init pxa_set_i2c_info(struct i2c_pxa_platform_data *info)
435{ 447{
436 pxa_device_i2c.dev.platform_data = info; 448 pxa_register_device(&pxa_device_i2c, info);
437} 449}
438 450
439static struct resource pxai2s_resources[] = { 451static struct resource pxai2s_resources[] = {
@@ -468,7 +480,7 @@ struct platform_device pxa_device_ficp = {
468 480
469void __init pxa_set_ficp_info(struct pxaficp_platform_data *info) 481void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
470{ 482{
471 pxa_device_ficp.dev.platform_data = info; 483 pxa_register_device(&pxa_device_ficp, info);
472} 484}
473 485
474struct platform_device pxa_device_rtc = { 486struct platform_device pxa_device_rtc = {
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 9732d5d9466b..d9ee0d9b36df 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -287,15 +287,11 @@ void __init pxa25x_init_irq(void)
287} 287}
288 288
289static struct platform_device *pxa25x_devices[] __initdata = { 289static struct platform_device *pxa25x_devices[] __initdata = {
290 &pxa_device_mci,
291 &pxa_device_udc, 290 &pxa_device_udc,
292 &pxa_device_fb,
293 &pxa_device_ffuart, 291 &pxa_device_ffuart,
294 &pxa_device_btuart, 292 &pxa_device_btuart,
295 &pxa_device_stuart, 293 &pxa_device_stuart,
296 &pxa_device_i2c,
297 &pxa_device_i2s, 294 &pxa_device_i2s,
298 &pxa_device_ficp,
299 &pxa_device_rtc, 295 &pxa_device_rtc,
300}; 296};
301 297
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 8e126e6b74c3..e7151dba6682 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -401,7 +401,7 @@ struct platform_device pxa27x_device_ohci = {
401 401
402void __init pxa_set_ohci_info(struct pxaohci_platform_data *info) 402void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
403{ 403{
404 pxa27x_device_ohci.dev.platform_data = info; 404 pxa_register_device(&pxa27x_device_ohci, info);
405} 405}
406 406
407static struct resource i2c_power_resources[] = { 407static struct resource i2c_power_resources[] = {
@@ -424,18 +424,13 @@ struct platform_device pxa27x_device_i2c_power = {
424}; 424};
425 425
426static struct platform_device *devices[] __initdata = { 426static struct platform_device *devices[] __initdata = {
427 &pxa_device_mci,
428 &pxa_device_udc, 427 &pxa_device_udc,
429 &pxa_device_fb,
430 &pxa_device_ffuart, 428 &pxa_device_ffuart,
431 &pxa_device_btuart, 429 &pxa_device_btuart,
432 &pxa_device_stuart, 430 &pxa_device_stuart,
433 &pxa_device_i2c,
434 &pxa_device_i2s, 431 &pxa_device_i2s,
435 &pxa_device_ficp,
436 &pxa_device_rtc, 432 &pxa_device_rtc,
437 &pxa27x_device_i2c_power, 433 &pxa27x_device_i2c_power,
438 &pxa27x_device_ohci,
439}; 434};
440 435
441static int __init pxa27x_init(void) 436static int __init pxa27x_init(void)
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 61d9c9d69e6b..37fbc4face09 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -209,15 +209,11 @@ void __init pxa3xx_init_irq(void)
209 */ 209 */
210 210
211static struct platform_device *devices[] __initdata = { 211static struct platform_device *devices[] __initdata = {
212 &pxa_device_mci,
213 &pxa_device_udc, 212 &pxa_device_udc,
214 &pxa_device_fb,
215 &pxa_device_ffuart, 213 &pxa_device_ffuart,
216 &pxa_device_btuart, 214 &pxa_device_btuart,
217 &pxa_device_stuart, 215 &pxa_device_stuart,
218 &pxa_device_i2c,
219 &pxa_device_i2s, 216 &pxa_device_i2s,
220 &pxa_device_ficp,
221 &pxa_device_rtc, 217 &pxa_device_rtc,
222}; 218};
223 219