From patchwork Tue Dec 5 20:29:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 10095077 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E600160327 for ; Wed, 6 Dec 2017 08:39:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D665929C10 for ; Wed, 6 Dec 2017 08:39:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C97FB29C13; Wed, 6 Dec 2017 08:39:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C657129C10 for ; Wed, 6 Dec 2017 08:39:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D209E6E6CD; Wed, 6 Dec 2017 08:38:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 704 seconds by postgrey-1.35 at gabe; Tue, 05 Dec 2017 20:41:18 UTC Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5F74F6E131 for ; Tue, 5 Dec 2017 20:41:18 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id vB5KTXPC017958 for ; Tue, 5 Dec 2017 14:29:33 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1512505773; bh=l0lc6yhExI6VYmb7ghVvalXC1+Poz2fwSU5hDXc2yCo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=r1VkMmFq5Jmahn8zmHOHXwCr6zGPTXe4Jtsv9mBjuVcXDQr3mbxzYmsTeXJaILOTL 1RO96GiYVUebaBrLZfOH/SVL7Zvp8bbc3PSmVXsoOoRLFU4vgTyTmzpqhytNpDppoJ tb3CULgJ871XNcsEoAfsKdS5eaPDJPJAhxA4o5DM= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id vB5KTXbl025269 for ; Tue, 5 Dec 2017 14:29:33 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 5 Dec 2017 14:29:33 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 5 Dec 2017 14:29:32 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vB5KTW5P021089; Tue, 5 Dec 2017 14:29:32 -0600 Received: from localhost (uda0226330.dhcp.ti.com [128.247.58.154]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id vB5KTW323539; Tue, 5 Dec 2017 14:29:32 -0600 (CST) From: "Andrew F. Davis" To: Tomi Valkeinen Subject: [PATCH 2/2] drm: omapdrm: Simplify platform registration Date: Tue, 5 Dec 2017 14:29:32 -0600 Message-ID: <20171205202932.26597-2-afd@ti.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171205202932.26597-1-afd@ti.com> References: <20171205202932.26597-1-afd@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Mailman-Approved-At: Wed, 06 Dec 2017 08:38:48 +0000 Cc: dri-devel@lists.freedesktop.org, "Andrew F . Davis" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Currently, calls into each file are used to register the various platform drivers. Change this to a table of pointers to platform_driver structs to allow using platform_register_drivers. Signed-off-by: Andrew F. Davis --- drivers/gpu/drm/omapdrm/dss/core.c | 51 +++++++++++-------------------------- drivers/gpu/drm/omapdrm/dss/dispc.c | 12 +-------- drivers/gpu/drm/omapdrm/dss/dsi.c | 12 +-------- drivers/gpu/drm/omapdrm/dss/dss.c | 12 +-------- drivers/gpu/drm/omapdrm/dss/dss.h | 35 +++++++++++-------------- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 12 +-------- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 12 +-------- drivers/gpu/drm/omapdrm/dss/venc.c | 12 +-------- 8 files changed, 36 insertions(+), 122 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c index 8b8477813864..4a83e1cf8850 100644 --- a/drivers/gpu/drm/omapdrm/dss/core.c +++ b/drivers/gpu/drm/omapdrm/dss/core.c @@ -28,52 +28,33 @@ #include "dss.h" /* INIT */ -static int (*dss_output_drv_reg_funcs[])(void) __initdata = { - dss_init_platform_driver, - dispc_init_platform_driver, +static struct platform_driver * const omap_dss_drivers[] = { + &omap_dsshw_driver, + &omap_dispchw_driver, #ifdef CONFIG_OMAP2_DSS_DSI - dsi_init_platform_driver, + &omap_dsihw_driver, #endif #ifdef CONFIG_OMAP2_DSS_VENC - venc_init_platform_driver, + &omap_venchw_driver, #endif #ifdef CONFIG_OMAP4_DSS_HDMI - hdmi4_init_platform_driver, + &omapdss_hdmi4hw_driver, #endif #ifdef CONFIG_OMAP5_DSS_HDMI - hdmi5_init_platform_driver, + &omapdss_hdmi5hw_driver, #endif }; -static void (*dss_output_drv_unreg_funcs[])(void) = { -#ifdef CONFIG_OMAP5_DSS_HDMI - hdmi5_uninit_platform_driver, -#endif -#ifdef CONFIG_OMAP4_DSS_HDMI - hdmi4_uninit_platform_driver, -#endif -#ifdef CONFIG_OMAP2_DSS_VENC - venc_uninit_platform_driver, -#endif -#ifdef CONFIG_OMAP2_DSS_DSI - dsi_uninit_platform_driver, -#endif - dispc_uninit_platform_driver, - dss_uninit_platform_driver, -}; - static struct platform_device *omap_drm_device; static int __init omap_dss_init(void) { int r; - int i; - for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) { - r = dss_output_drv_reg_funcs[i](); - if (r) - goto err_reg; - } + r = platform_register_drivers(omap_dss_drivers, + ARRAY_SIZE(omap_dss_drivers)); + if (r) + goto err_reg; omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0); if (IS_ERR(omap_drm_device)) { @@ -84,10 +65,8 @@ static int __init omap_dss_init(void) return 0; err_reg: - for (i = ARRAY_SIZE(dss_output_drv_reg_funcs) - i; - i < ARRAY_SIZE(dss_output_drv_reg_funcs); - ++i) - dss_output_drv_unreg_funcs[i](); + platform_unregister_drivers(omap_dss_drivers, + ARRAY_SIZE(omap_dss_drivers)); return r; } @@ -98,8 +77,8 @@ static void __exit omap_dss_exit(void) platform_device_unregister(omap_drm_device); - for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) - dss_output_drv_unreg_funcs[i](); + platform_unregister_drivers(omap_dss_drivers, + ARRAY_SIZE(omap_dss_drivers)); } module_init(omap_dss_init); diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 23946bc6317d..82534dbf2120 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -4683,7 +4683,7 @@ static const struct dev_pm_ops dispc_pm_ops = { .runtime_resume = dispc_runtime_resume, }; -static struct platform_driver omap_dispchw_driver = { +struct platform_driver omap_dispchw_driver = { .probe = dispc_probe, .remove = dispc_remove, .driver = { @@ -4693,13 +4693,3 @@ static struct platform_driver omap_dispchw_driver = { .suppress_bind_attrs = true, }, }; - -int __init dispc_init_platform_driver(void) -{ - return platform_driver_register(&omap_dispchw_driver); -} - -void dispc_uninit_platform_driver(void) -{ - platform_driver_unregister(&omap_dispchw_driver); -} diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c index e13d2d2d7e61..80f1f3679a3c 100644 --- a/drivers/gpu/drm/omapdrm/dss/dsi.c +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c @@ -5658,7 +5658,7 @@ static const struct dev_pm_ops dsi_pm_ops = { .runtime_resume = dsi_runtime_resume, }; -static struct platform_driver omap_dsihw_driver = { +struct platform_driver omap_dsihw_driver = { .probe = dsi_probe, .remove = dsi_remove, .driver = { @@ -5668,13 +5668,3 @@ static struct platform_driver omap_dsihw_driver = { .suppress_bind_attrs = true, }, }; - -int __init dsi_init_platform_driver(void) -{ - return platform_driver_register(&omap_dsihw_driver); -} - -void dsi_uninit_platform_driver(void) -{ - platform_driver_unregister(&omap_dsihw_driver); -} diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index ecedda5ce588..7eaeffce77b3 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1525,7 +1525,7 @@ static const struct dev_pm_ops dss_pm_ops = { .runtime_resume = dss_runtime_resume, }; -static struct platform_driver omap_dsshw_driver = { +struct platform_driver omap_dsshw_driver = { .probe = dss_probe, .remove = dss_remove, .shutdown = dss_shutdown, @@ -1536,13 +1536,3 @@ static struct platform_driver omap_dsshw_driver = { .suppress_bind_attrs = true, }, }; - -int __init dss_init_platform_driver(void) -{ - return platform_driver_register(&omap_dsshw_driver); -} - -void dss_uninit_platform_driver(void) -{ - platform_driver_unregister(&omap_dsshw_driver); -} diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h index dc95fe84d20a..20d0c0f78d19 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.h +++ b/drivers/gpu/drm/omapdrm/dss/dss.h @@ -262,9 +262,6 @@ static inline int dss_debugfs_create_file(const char *name, } #endif /* CONFIG_OMAP2_DSS_DEBUGFS */ -int dss_init_platform_driver(void) __init; -void dss_uninit_platform_driver(void); - int dss_runtime_get(void); void dss_runtime_put(void); @@ -327,9 +324,6 @@ static inline void sdi_uninit_port(struct device_node *port) struct dentry; struct file_operations; -int dsi_init_platform_driver(void) __init; -void dsi_uninit_platform_driver(void); - void dsi_dump_clocks(struct seq_file *s); void dsi_irq_handler(void); @@ -353,8 +347,6 @@ static inline void dpi_uninit_port(struct device_node *port) #endif /* DISPC */ -int dispc_init_platform_driver(void) __init; -void dispc_uninit_platform_driver(void); void dispc_dump_clocks(struct seq_file *s); int dispc_runtime_get(void); @@ -398,18 +390,6 @@ void dispc_wb_set_channel_in(enum dss_writeback_channel channel); int dispc_wb_setup(const struct omap_dss_writeback_info *wi, bool mem_to_mem, const struct videomode *vm); -/* VENC */ -int venc_init_platform_driver(void) __init; -void venc_uninit_platform_driver(void); - -/* HDMI */ -int hdmi4_init_platform_driver(void) __init; -void hdmi4_uninit_platform_driver(void); - -int hdmi5_init_platform_driver(void) __init; -void hdmi5_uninit_platform_driver(void); - - #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr) { @@ -453,4 +433,19 @@ int dss_pll_write_config_type_b(struct dss_pll *pll, const struct dss_pll_clock_info *cinfo); int dss_pll_wait_reset_done(struct dss_pll *pll); +extern struct platform_driver omap_dsshw_driver; +extern struct platform_driver omap_dispchw_driver; +#ifdef CONFIG_OMAP2_DSS_DSI +extern struct platform_driver omap_dsihw_driver; +#endif +#ifdef CONFIG_OMAP2_DSS_VENC +extern struct platform_driver omap_venchw_driver; +#endif +#ifdef CONFIG_OMAP4_DSS_HDMI +extern struct platform_driver omapdss_hdmi4hw_driver; +#endif +#ifdef CONFIG_OMAP5_DSS_HDMI +extern struct platform_driver omapdss_hdmi5hw_driver; +#endif + #endif diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index 1f10123400d5..bf914f2ac99e 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c @@ -845,7 +845,7 @@ static const struct of_device_id hdmi_of_match[] = { {}, }; -static struct platform_driver omapdss_hdmihw_driver = { +struct platform_driver omapdss_hdmi4hw_driver = { .probe = hdmi4_probe, .remove = hdmi4_remove, .driver = { @@ -855,13 +855,3 @@ static struct platform_driver omapdss_hdmihw_driver = { .suppress_bind_attrs = true, }, }; - -int __init hdmi4_init_platform_driver(void) -{ - return platform_driver_register(&omapdss_hdmihw_driver); -} - -void hdmi4_uninit_platform_driver(void) -{ - platform_driver_unregister(&omapdss_hdmihw_driver); -} diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c index 7091197da940..689cda41858b 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c @@ -841,7 +841,7 @@ static const struct of_device_id hdmi_of_match[] = { {}, }; -static struct platform_driver omapdss_hdmihw_driver = { +struct platform_driver omapdss_hdmi5hw_driver = { .probe = hdmi5_probe, .remove = hdmi5_remove, .driver = { @@ -851,13 +851,3 @@ static struct platform_driver omapdss_hdmihw_driver = { .suppress_bind_attrs = true, }, }; - -int __init hdmi5_init_platform_driver(void) -{ - return platform_driver_register(&omapdss_hdmihw_driver); -} - -void hdmi5_uninit_platform_driver(void) -{ - platform_driver_unregister(&omapdss_hdmihw_driver); -} diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c index 02457e836fe5..40aa89203fad 100644 --- a/drivers/gpu/drm/omapdrm/dss/venc.c +++ b/drivers/gpu/drm/omapdrm/dss/venc.c @@ -984,7 +984,7 @@ static const struct of_device_id venc_of_match[] = { {}, }; -static struct platform_driver omap_venchw_driver = { +struct platform_driver omap_venchw_driver = { .probe = venc_probe, .remove = venc_remove, .driver = { @@ -994,13 +994,3 @@ static struct platform_driver omap_venchw_driver = { .suppress_bind_attrs = true, }, }; - -int __init venc_init_platform_driver(void) -{ - return platform_driver_register(&omap_venchw_driver); -} - -void venc_uninit_platform_driver(void) -{ - platform_driver_unregister(&omap_venchw_driver); -}