From 2724daf439d9f4e9f25c9fb8de8602ba61758478 Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Wed, 4 Nov 2009 00:39:56 +1100 Subject: mac68k: rework SWIM platform device Adjust the platform device code to conform with the code style used in the rest of this patch series. No need to name resources nor to register devices which are not applicable. Signed-off-by: Finn Thain Signed-off-by: Geert Uytterhoeven --- arch/m68k/mac/config.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'arch/m68k') diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index cad55bc087df..e6666a30f24b 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -44,10 +44,6 @@ #include #include -/* platform device info */ - -#define SWIM_IO_SIZE 0x2000 /* SWIM IO resource size */ - /* Mac bootinfo struct */ struct mac_booter_data mac_bi_data; @@ -862,23 +858,23 @@ static void mac_get_model(char *str) strcat(str, macintosh_config->name); } -static struct resource swim_resources[1]; +static struct resource swim_rsrc = { .flags = IORESOURCE_MEM }; -static struct platform_device swim_device = { +static struct platform_device swim_pdev = { .name = "swim", .id = -1, - .num_resources = ARRAY_SIZE(swim_resources), - .resource = swim_resources, -}; - -static struct platform_device *mac_platform_devices[] __initdata = { - &swim_device + .num_resources = 1, + .resource = &swim_rsrc, }; int __init mac_platform_init(void) { u8 *swim_base; + /* + * Floppy device + */ + switch (macintosh_config->floppy_type) { case MAC_FLOPPY_SWIM_ADDR1: swim_base = (u8 *)(VIA1_BASE + 0x1E000); @@ -887,16 +883,17 @@ int __init mac_platform_init(void) swim_base = (u8 *)(VIA1_BASE + 0x16000); break; default: - return 0; + swim_base = NULL; + break; } - swim_resources[0].name = "swim-regs"; - swim_resources[0].start = (resource_size_t)swim_base; - swim_resources[0].end = (resource_size_t)(swim_base + SWIM_IO_SIZE); - swim_resources[0].flags = IORESOURCE_MEM; + if (swim_base) { + swim_rsrc.start = (resource_size_t) swim_base, + swim_rsrc.end = (resource_size_t) swim_base + 0x2000, + platform_device_register(&swim_pdev); + } - return platform_add_devices(mac_platform_devices, - ARRAY_SIZE(mac_platform_devices)); + return 0; } arch_initcall(mac_platform_init); -- cgit v1.2.3