diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-10-06 09:55:53 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-12-06 11:52:23 -0500 |
commit | 7a5b4e16c880f8350d255dc188f81622905618c1 (patch) | |
tree | 78ab8222057c0578a641db587081e89bbcbdb1ef /arch/arm/mach-sa1100/generic.c | |
parent | 6ec22f9b037fc0c2e00ddb7023fad279c365324d (diff) |
ARM: sa11x0: convert set_xxx_data() to register_xxx()
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>
Diffstat (limited to 'arch/arm/mach-sa1100/generic.c')
-rw-r--r-- | arch/arm/mach-sa1100/generic.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index 23cfdd593954..9faea1511c1f 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
@@ -162,6 +162,17 @@ static void sa1100_power_off(void) | |||
162 | PMCR = PMCR_SF; | 162 | PMCR = PMCR_SF; |
163 | } | 163 | } |
164 | 164 | ||
165 | static void sa11x0_register_device(struct platform_device *dev, void *data) | ||
166 | { | ||
167 | int err; | ||
168 | dev->dev.platform_data = data; | ||
169 | err = platform_device_register(dev); | ||
170 | if (err) | ||
171 | printk(KERN_ERR "Unable to register device %s: %d\n", | ||
172 | dev->name, err); | ||
173 | } | ||
174 | |||
175 | |||
165 | static struct resource sa11x0udc_resources[] = { | 176 | static struct resource sa11x0udc_resources[] = { |
166 | [0] = { | 177 | [0] = { |
167 | .start = 0x80000000, | 178 | .start = 0x80000000, |
@@ -234,9 +245,9 @@ static struct platform_device sa11x0mcp_device = { | |||
234 | .resource = sa11x0mcp_resources, | 245 | .resource = sa11x0mcp_resources, |
235 | }; | 246 | }; |
236 | 247 | ||
237 | void sa11x0_set_mcp_data(struct mcp_plat_data *data) | 248 | void sa11x0_register_mcp(struct mcp_plat_data *data) |
238 | { | 249 | { |
239 | sa11x0mcp_device.dev.platform_data = data; | 250 | sa11x0_register_device(&sa11x0mcp_device, data); |
240 | } | 251 | } |
241 | 252 | ||
242 | static struct resource sa11x0ssp_resources[] = { | 253 | static struct resource sa11x0ssp_resources[] = { |
@@ -293,13 +304,13 @@ static struct platform_device sa11x0mtd_device = { | |||
293 | .id = -1, | 304 | .id = -1, |
294 | }; | 305 | }; |
295 | 306 | ||
296 | void sa11x0_set_flash_data(struct flash_platform_data *flash, | 307 | void sa11x0_register_mtd(struct flash_platform_data *flash, |
297 | struct resource *res, int nr) | 308 | struct resource *res, int nr) |
298 | { | 309 | { |
299 | flash->name = "sa1100"; | 310 | flash->name = "sa1100"; |
300 | sa11x0mtd_device.dev.platform_data = flash; | ||
301 | sa11x0mtd_device.resource = res; | 311 | sa11x0mtd_device.resource = res; |
302 | sa11x0mtd_device.num_resources = nr; | 312 | sa11x0mtd_device.num_resources = nr; |
313 | sa11x0_register_device(&sa11x0mtd_device, flash); | ||
303 | } | 314 | } |
304 | 315 | ||
305 | static struct resource sa11x0ir_resources[] = { | 316 | static struct resource sa11x0ir_resources[] = { |
@@ -329,9 +340,9 @@ static struct platform_device sa11x0ir_device = { | |||
329 | .resource = sa11x0ir_resources, | 340 | .resource = sa11x0ir_resources, |
330 | }; | 341 | }; |
331 | 342 | ||
332 | void sa11x0_set_irda_data(struct irda_platform_data *irda) | 343 | void sa11x0_register_irda(struct irda_platform_data *irda) |
333 | { | 344 | { |
334 | sa11x0ir_device.dev.platform_data = irda; | 345 | sa11x0_register_device(&sa11x0ir_device, irda); |
335 | } | 346 | } |
336 | 347 | ||
337 | static struct platform_device sa11x0rtc_device = { | 348 | static struct platform_device sa11x0rtc_device = { |
@@ -343,21 +354,15 @@ static struct platform_device *sa11x0_devices[] __initdata = { | |||
343 | &sa11x0udc_device, | 354 | &sa11x0udc_device, |
344 | &sa11x0uart1_device, | 355 | &sa11x0uart1_device, |
345 | &sa11x0uart3_device, | 356 | &sa11x0uart3_device, |
346 | &sa11x0mcp_device, | ||
347 | &sa11x0ssp_device, | 357 | &sa11x0ssp_device, |
348 | &sa11x0pcmcia_device, | 358 | &sa11x0pcmcia_device, |
349 | &sa11x0fb_device, | 359 | &sa11x0fb_device, |
350 | &sa11x0mtd_device, | ||
351 | &sa11x0rtc_device, | 360 | &sa11x0rtc_device, |
352 | }; | 361 | }; |
353 | 362 | ||
354 | static int __init sa1100_init(void) | 363 | static int __init sa1100_init(void) |
355 | { | 364 | { |
356 | pm_power_off = sa1100_power_off; | 365 | pm_power_off = sa1100_power_off; |
357 | |||
358 | if (sa11x0ir_device.dev.platform_data) | ||
359 | platform_device_register(&sa11x0ir_device); | ||
360 | |||
361 | return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices)); | 366 | return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices)); |
362 | } | 367 | } |
363 | 368 | ||