public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Laurent Vivier <laurent@lvivier.info>, linux-m68k@vger.kernel.org
Subject: [PATCH 2/13] mac68k: rework SWIM platform device
Date: Wed, 4 Nov 2009 00:39:56 +1100 (EST)	[thread overview]
Message-ID: <alpine.OSX.2.00.0911031438480.483@silk.local> (raw)

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 <fthain@telegraphics.com.au>

---
 arch/m68k/mac/config.c |   35 ++++++++++++++++-------------------
 drivers/block/swim.c   |    4 ++--
 2 files changed, 18 insertions(+), 21 deletions(-)

Index: linux-2.6.31/arch/m68k/mac/config.c
===================================================================
--- linux-2.6.31.orig/arch/m68k/mac/config.c	2009-11-03 03:23:40.000000000 +1100
+++ linux-2.6.31/arch/m68k/mac/config.c	2009-11-03 03:23:41.000000000 +1100
@@ -44,10 +44,6 @@
 #include <asm/mac_oss.h>
 #include <asm/mac_psc.h>
 
-/* 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);
Index: linux-2.6.31/drivers/block/swim.c
===================================================================
--- linux-2.6.31.orig/drivers/block/swim.c	2009-11-03 03:23:24.000000000 +1100
+++ linux-2.6.31/drivers/block/swim.c	2009-11-03 03:23:41.000000000 +1100
@@ -864,7 +864,7 @@ static int __devinit swim_probe(struct p
 	struct swim_priv *swd;
 	int ret;
 
-	res = platform_get_resource_byname(dev, IORESOURCE_MEM, "swim-regs");
+	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	if (!res) {
 		ret = -ENODEV;
 		goto out;
@@ -942,7 +942,7 @@ static int __devexit swim_remove(struct 
 
 	iounmap(swd->base);
 
-	res = platform_get_resource_byname(dev, IORESOURCE_MEM, "swim-regs");
+	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	if (res)
 		release_mem_region(res->start, resource_size(res));
 

                 reply	other threads:[~2009-11-03 13:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.00.0911031438480.483@silk.local \
    --to=fthain@telegraphics.com.au \
    --cc=geert@linux-m68k.org \
    --cc=laurent@lvivier.info \
    --cc=linux-m68k@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox