linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: <linux-m68k@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 03/10] m68k/mac: Adopt platform_device_register_simple()
Date: Sat,  8 Apr 2017 19:51:15 -0400 (EDT)	[thread overview]
Message-ID: <d74e6347357b531e4f7bb0467a41daa2f1926645.1491695243.git.fthain@telegraphics.com.au> (raw)
In-Reply-To: <cover.1491695243.git.fthain@telegraphics.com.au>

These changes save 1014 bytes according to scripts/bloat-o-meter.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
 arch/m68k/mac/config.c | 49 ++++++++++++-------------------------------------
 1 file changed, 12 insertions(+), 37 deletions(-)

diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 661892d..22123f7 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -919,15 +919,6 @@ static void mac_get_model(char *str)
 	strcat(str, macintosh_config->name);
 }
 
-static struct resource swim_rsrc = { .flags = IORESOURCE_MEM };
-
-static struct platform_device swim_pdev = {
-	.name		= "swim",
-	.id		= -1,
-	.num_resources	= 1,
-	.resource	= &swim_rsrc,
-};
-
 static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
 	{
 		.flags = IORESOURCE_IRQ,
@@ -992,26 +983,6 @@ static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
 	},
 };
 
-static struct platform_device esp_0_pdev = {
-	.name		= "mac_esp",
-	.id		= 0,
-};
-
-static struct platform_device esp_1_pdev = {
-	.name		= "mac_esp",
-	.id		= 1,
-};
-
-static struct platform_device sonic_pdev = {
-	.name		= "macsonic",
-	.id		= -1,
-};
-
-static struct platform_device mace_pdev = {
-	.name		= "macmace",
-	.id		= -1,
-};
-
 int __init mac_platform_init(void)
 {
 	u8 *swim_base;
@@ -1043,9 +1014,13 @@ int __init mac_platform_init(void)
 	}
 
 	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);
+		struct resource swim_rsrc = {
+			.flags = IORESOURCE_MEM,
+			.start = (resource_size_t)swim_base,
+			.end   = (resource_size_t)swim_base + 0x2000,
+		};
+
+		platform_device_register_simple("swim", -1, &swim_rsrc, 1);
 	}
 
 	/*
@@ -1055,13 +1030,13 @@ int __init mac_platform_init(void)
 	switch (macintosh_config->scsi_type) {
 	case MAC_SCSI_QUADRA:
 	case MAC_SCSI_QUADRA3:
-		platform_device_register(&esp_0_pdev);
+		platform_device_register_simple("mac_esp", 0, NULL, 0);
 		break;
 	case MAC_SCSI_QUADRA2:
-		platform_device_register(&esp_0_pdev);
+		platform_device_register_simple("mac_esp", 0, NULL, 0);
 		if ((macintosh_config->ident == MAC_MODEL_Q900) ||
 		    (macintosh_config->ident == MAC_MODEL_Q950))
-			platform_device_register(&esp_1_pdev);
+			platform_device_register_simple("mac_esp", 1, NULL, 0);
 		break;
 	case MAC_SCSI_IIFX:
 		/* Addresses from The Guide to Mac Family Hardware.
@@ -1127,10 +1102,10 @@ int __init mac_platform_init(void)
 
 	switch (macintosh_config->ether_type) {
 	case MAC_ETHER_SONIC:
-		platform_device_register(&sonic_pdev);
+		platform_device_register_simple("macsonic", -1, NULL, 0);
 		break;
 	case MAC_ETHER_MACE:
-		platform_device_register(&mace_pdev);
+		platform_device_register_simple("macmace", -1, NULL, 0);
 		break;
 	}
 
-- 
2.10.2

  parent reply	other threads:[~2017-04-08 23:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08 23:51 [PATCH 00/10] mac68k: Miscellaneous fixes, cleanup and modernization Finn Thain
2017-04-08 23:51 ` [PATCH 02/10] m68k/mac: Modernize printing of kernel messages Finn Thain
2017-04-08 23:51 ` [PATCH 07/10] nubus: Clean up printk calls (from mac68k CVS) Finn Thain
2017-04-08 23:51 ` [PATCH 01/10] m68k/mac: IOP - Modernize printing of kernel messages Finn Thain
2017-04-08 23:51 ` [PATCH 09/10] nubus: Clean up whitespace Finn Thain
2017-04-08 23:51 ` [PATCH 04/10] m68k/mac: Clarify IOP message alloc/free confusion Finn Thain
2017-04-08 23:51 ` [PATCH 10/10] nubus: Add MVC and VSC video card definitions Finn Thain
2017-04-08 23:51 ` Finn Thain [this message]
2017-04-08 23:51 ` [PATCH 05/10] nubus: Fix nubus_rewinddir (from mac68k CVS) Finn Thain
2017-04-08 23:51 ` [PATCH 08/10] nubus: Fix pointer validation Finn Thain
2017-04-08 23:51 ` [PATCH 06/10] nubus: Remove slot zero probe (from mac68k CVS) Finn Thain
2017-04-16 10:29 ` [PATCH 00/10] mac68k: Miscellaneous fixes, cleanup and modernization Geert Uytterhoeven
2017-04-17  1:50   ` Finn Thain
2017-04-20  7:56     ` Geert Uytterhoeven

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=d74e6347357b531e4f7bb0467a41daa2f1926645.1491695243.git.fthain@telegraphics.com.au \
    --to=fthain@telegraphics.com.au \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).