From patchwork Mon Aug 6 23:14:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 1281941 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 457093FC23 for ; Mon, 6 Aug 2012 23:13:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757085Ab2HFXNL (ORCPT ); Mon, 6 Aug 2012 19:13:11 -0400 Received: from ogre.sisk.pl ([193.178.161.156]:44967 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932227Ab2HFXLv (ORCPT ); Mon, 6 Aug 2012 19:11:51 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 236531DB9C1; Tue, 7 Aug 2012 01:01:54 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03974-09; Tue, 7 Aug 2012 01:01:17 +0200 (CEST) Received: from ferrari.rjw.lan (62-121-64-87.home.aster.pl [62.121.64.87]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 9D35E1DB9D0; Tue, 7 Aug 2012 01:00:56 +0200 (CEST) From: "Rafael J. Wysocki" To: "Linux-sh list" Subject: [PATCH 11/12] ARM: shmobile: Move r8a7779's PM domain objects to a table Date: Tue, 7 Aug 2012 01:14:14 +0200 User-Agent: KMail/1.13.6 (Linux/3.5.0+; KDE/4.6.0; x86_64; ; ) Cc: LKML , Linux PM list , Magnus Damm References: <201208070105.23262.rjw@sisk.pl> In-Reply-To: <201208070105.23262.rjw@sisk.pl> MIME-Version: 1.0 Message-Id: <201208070114.15231.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Instead of giving a name to every r8a7779's PM domain object, put them all into a table and initialize them all together in a loop. Signed-off-by: Rafael J. Wysocki --- arch/arm/mach-shmobile/include/mach/r8a7779.h | 9 --- arch/arm/mach-shmobile/pm-r8a7779.c | 65 ++++++++++++++------------ arch/arm/mach-shmobile/setup-r8a7779.c | 5 -- 3 files changed, 39 insertions(+), 40 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux/arch/arm/mach-shmobile/include/mach/r8a7779.h =================================================================== --- linux.orig/arch/arm/mach-shmobile/include/mach/r8a7779.h +++ linux/arch/arm/mach-shmobile/include/mach/r8a7779.h @@ -347,14 +347,9 @@ extern int r8a7779_sysc_power_down(struc extern int r8a7779_sysc_power_up(struct r8a7779_pm_ch *r8a7779_ch); #ifdef CONFIG_PM -extern struct r8a7779_pm_domain r8a7779_sh4a; -extern struct r8a7779_pm_domain r8a7779_sgx; -extern struct r8a7779_pm_domain r8a7779_vdp1; -extern struct r8a7779_pm_domain r8a7779_impx3; - -extern void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd); +extern void __init r8a7779_init_pm_domains(void); #else -#define r8a7779_init_pm_domain(pd) do { } while (0) +static inline void r8a7779_init_pm_domains(void) {} #endif /* CONFIG_PM */ #endif /* __ASM_R8A7779_H__ */ Index: linux/arch/arm/mach-shmobile/pm-r8a7779.c =================================================================== --- linux.orig/arch/arm/mach-shmobile/pm-r8a7779.c +++ linux/arch/arm/mach-shmobile/pm-r8a7779.c @@ -183,7 +183,7 @@ static bool pd_active_wakeup(struct devi return true; } -void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) +static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) { struct generic_pm_domain *genpd = &r8a7779_pd->genpd; @@ -199,37 +199,44 @@ void r8a7779_init_pm_domain(struct r8a77 pd_power_up(&r8a7779_pd->genpd); } -struct r8a7779_pm_domain r8a7779_sh4a = { - .genpd_name = "SH4A", - .ch = { - .chan_offs = 0x80, /* PWRSR1 .. PWRER1 */ - .isr_bit = 16, /* SH4A */ - } +static struct r8a7779_pm_domain r8a7779_pm_domains[] = { + { + .genpd_name = "SH4A", + .ch = { + .chan_offs = 0x80, /* PWRSR1 .. PWRER1 */ + .isr_bit = 16, /* SH4A */ + }, + }, + { + .genpd_name = "SGX", + .ch = { + .chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */ + .isr_bit = 20, /* SGX */ + }, + }, + { + .genpd_name = "VDP1", + .ch = { + .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */ + .isr_bit = 21, /* VDP */ + }, + }, + { + .genpd_name = "IMPX3", + .ch = { + .chan_offs = 0x140, /* PWRSR4 .. PWRER4 */ + .isr_bit = 24, /* IMP */ + }, + }, }; -struct r8a7779_pm_domain r8a7779_sgx = { - .genpd_name = "SGX", - .ch = { - .chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */ - .isr_bit = 20, /* SGX */ - } -}; - -struct r8a7779_pm_domain r8a7779_vdp1 = { - .genpd_name = "VDP1", - .ch = { - .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */ - .isr_bit = 21, /* VDP */ - } -}; +void __init r8a7779_init_pm_domains(void) +{ + int j; -struct r8a7779_pm_domain r8a7779_impx3 = { - .genpd_name = "IMPX3", - .ch = { - .chan_offs = 0x140, /* PWRSR4 .. PWRER4 */ - .isr_bit = 24, /* IMP */ - } -}; + for (j = 0; j < ARRAY_SIZE(r8a7779_pm_domains); j++) + r8a7779_init_pm_domain(&r8a7779_pm_domains[j]); +} #endif /* CONFIG_PM */ Index: linux/arch/arm/mach-shmobile/setup-r8a7779.c =================================================================== --- linux.orig/arch/arm/mach-shmobile/setup-r8a7779.c +++ linux/arch/arm/mach-shmobile/setup-r8a7779.c @@ -251,10 +251,7 @@ void __init r8a7779_add_standard_devices #endif r8a7779_pm_init(); - r8a7779_init_pm_domain(&r8a7779_sh4a); - r8a7779_init_pm_domain(&r8a7779_sgx); - r8a7779_init_pm_domain(&r8a7779_vdp1); - r8a7779_init_pm_domain(&r8a7779_impx3); + r8a7779_init_pm_domains(); platform_add_devices(r8a7779_early_devices, ARRAY_SIZE(r8a7779_early_devices));