From patchwork Fri Mar 22 07:14:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 2318301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A71E53FD8C for ; Fri, 22 Mar 2013 07:20:16 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UIwBc-0003XA-N4; Fri, 22 Mar 2013 07:14:48 +0000 Received: from mail-da0-x22a.google.com ([2607:f8b0:400e:c00::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UIwBZ-0003WP-2l for linux-arm-kernel@lists.infradead.org; Fri, 22 Mar 2013 07:14:45 +0000 Received: by mail-da0-f42.google.com with SMTP id n15so2112060dad.15 for ; Fri, 22 Mar 2013 00:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:sender:message-id:to:cc:in-reply-to:references:from :subject:mime-version:content-type; bh=aYCJ897Kxi9j4usVyB7XORlL2YXeRWBHicA6eoUeEkw=; b=vAhnGB7Sz99pN4qtcbU7eBtt8DvaRu66Uw92NoN/yUMnG5GyHasM6yeKz8AkcljMfw 4HcAfQeGGPdoYcPB9ICrpTFM6/YGBd+eqebS24gnVt756/1K/wHTpUjc3w+bmPCPO7P8 HHjDmvMq6GSAtk95b+vuiIT4nEXYnjC4A77hQXKotDw00ZnGn/YXwgnojqL8xoGQ46wy yfb3OPaE0Ln7yuaEkyZd2hDHEvGWNd44SoMbqyhbohenHpVTUOBd9P63fA/Zi0Xb8eIZ Xooiklf6FUMX9Ch5oq71usucZmfqWuelQIZ6ryu5inqj9GoJrbIJu8MCBfwAttY9Hp2S JTIA== X-Received: by 10.66.248.99 with SMTP id yl3mr1685794pac.134.1363936483734; Fri, 22 Mar 2013 00:14:43 -0700 (PDT) Received: from morimoto-Dell-XPS420.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPS id cy4sm1368812pbc.13.2013.03.22.00.14.40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 22 Mar 2013 00:14:42 -0700 (PDT) Date: Fri, 22 Mar 2013 00:14:42 -0700 (PDT) Message-ID: <87y5dfewip.wl%kuninori.morimoto.gx@renesas.com> To: Paul , Simon , arnd@arndb.de In-Reply-To: <87zjxvewko.wl%kuninori.morimoto.gx@renesas.com> References: <87zjxvewko.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [RFC][PATCH 1/3] ARM: shmobile: define PLATFORM_xxx_INFO() MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130322_031445_218387_98D4AFC9 X-CRM114-Status: GOOD ( 14.84 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (kuninori.morimoto.gx[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Magnus , Kuninori Morimoto , linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org platform_device_register_xxx() are needed until DT supports of all drivers are completed. This PLATFORM_xxx_INFO() macro is useful for it and is possible to reduce code. This patch put it ot common.h Signed-off-by: Kuninori Morimoto --- arch/arm/mach-shmobile/include/mach/common.h | 20 +++++++++++ arch/arm/mach-shmobile/setup-r8a7778.c | 48 +++++++++++--------------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index 03f73de..6a066a3 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h @@ -94,4 +94,24 @@ static inline void __init shmobile_init_late(void) shmobile_cpuidle_init(); } +#define PLATFORM_FULL_INFO(n, i, m) \ +{ \ + .parent = &platform_bus, \ + .name = n, \ + .id = i, \ + .res = m ## _resources, \ + .num_res = ARRAY_SIZE(m ##_resources), \ + .data = &m ##_platform_data, \ + .size_data = sizeof(m ## _platform_data), \ +} + +#define PLATFORM_DATA_INFO(n, i, m) \ +{ \ + .parent = &platform_bus, \ + .name = n, \ + .id = i, \ + .data = &m ##_platform_data, \ + .size_data = sizeof(m ## _platform_data), \ +} + #endif /* __ARCH_MACH_COMMON_H */ diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c index 01c62be..45a1a53 100644 --- a/arch/arm/mach-shmobile/setup-r8a7778.c +++ b/arch/arm/mach-shmobile/setup-r8a7778.c @@ -44,14 +44,18 @@ .irqs = SCIx_IRQ_MUXED(irq), \ } -static struct plat_sci_port scif_platform_data[] = { - SCIF_INFO(0xffe40000, gic_iid(0x66)), - SCIF_INFO(0xffe41000, gic_iid(0x67)), - SCIF_INFO(0xffe42000, gic_iid(0x68)), - SCIF_INFO(0xffe43000, gic_iid(0x69)), - SCIF_INFO(0xffe44000, gic_iid(0x6a)), - SCIF_INFO(0xffe45000, gic_iid(0x6b)), -}; +static struct plat_sci_port scif0_platform_data = + SCIF_INFO(0xffe40000, gic_iid(0x66)); +static struct plat_sci_port scif1_platform_data = + SCIF_INFO(0xffe41000, gic_iid(0x67)); +static struct plat_sci_port scif2_platform_data = + SCIF_INFO(0xffe42000, gic_iid(0x68)); +static struct plat_sci_port scif3_platform_data = + SCIF_INFO(0xffe43000, gic_iid(0x69)); +static struct plat_sci_port scif4_platform_data = + SCIF_INFO(0xffe44000, gic_iid(0x6a)); +static struct plat_sci_port scif5_platform_data = + SCIF_INFO(0xffe45000, gic_iid(0x6b)); /* TMU */ static struct resource sh_tmu0_resources[] = { @@ -78,20 +82,15 @@ static struct sh_timer_config sh_tmu1_platform_data = { .clocksource_rating = 200, }; -#define PLATFORM_INFO(n, i) \ -{ \ - .parent = &platform_bus, \ - .name = #n, \ - .id = i, \ - .res = n ## i ## _resources, \ - .num_res = ARRAY_SIZE(n ## i ##_resources), \ - .data = &n ## i ##_platform_data, \ - .size_data = sizeof(n ## i ## _platform_data), \ -} - -struct platform_device_info platform_devinfo[] = { - PLATFORM_INFO(sh_tmu, 0), - PLATFORM_INFO(sh_tmu, 1), +static struct platform_device_info platform_devinfo[] = { + PLATFORM_DATA_INFO("sh-sci", 0, scif0), + PLATFORM_DATA_INFO("sh-sci", 1, scif1), + PLATFORM_DATA_INFO("sh-sci", 2, scif2), + PLATFORM_DATA_INFO("sh-sci", 3, scif3), + PLATFORM_DATA_INFO("sh-sci", 4, scif4), + PLATFORM_DATA_INFO("sh-sci", 5, scif5), + PLATFORM_FULL_INFO("sh_tmu", 0, sh_tmu0), + PLATFORM_FULL_INFO("sh_tmu", 1, sh_tmu1), }; void __init r8a7778_add_standard_devices(void) @@ -109,11 +108,6 @@ void __init r8a7778_add_standard_devices(void) } #endif - for (i = 0; i < ARRAY_SIZE(scif_platform_data); i++) - platform_device_register_data(&platform_bus, "sh-sci", i, - &scif_platform_data[i], - sizeof(struct plat_sci_port)); - for (i = 0; i < ARRAY_SIZE(platform_devinfo); i++) platform_device_register_full(&platform_devinfo[i]); }