* [PATCH 0/5] OMAP: DSS: add __inits and __exits
@ 2011-04-01 10:00 Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 1/5] OMAP: DSS2: make omap_dss_(un)register_device static Tomi Valkeinen
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
These patches add __inits and __exits to multiple functions in omapdss and
panel drivers. Also omap_dss_register_driver_probe() is added which allows us
to define panel driver probe functions as __init.
This moved almost 7kB from .text section to .init section on my configuration.
Tomi Valkeinen (5):
OMAP: DSS2: make omap_dss_(un)register_device static
OMAP: DSS2: add __inits to omapdss driver
OMAP: DSS2: use __exit for selected panel drivers
OMAP: DSS2: Add omap_dss_register_driver_probe()
OMAP: DSS2: use omap_dss_register_driver_probe() in selected drivers
arch/arm/plat-omap/include/plat/display.h | 5 +-
drivers/video/omap2/displays/panel-generic-dpi.c | 10 ++--
.../video/omap2/displays/panel-sharp-ls037v7dw01.c | 10 ++--
drivers/video/omap2/displays/panel-taal.c | 9 +--
drivers/video/omap2/dss/core.c | 64 +++++++++++++++++---
drivers/video/omap2/dss/dispc.c | 7 +-
drivers/video/omap2/dss/dpi.c | 2 +-
drivers/video/omap2/dss/dsi.c | 7 +-
drivers/video/omap2/dss/dss.c | 9 +--
drivers/video/omap2/dss/dss_features.c | 2 +-
drivers/video/omap2/dss/hdmi.c | 8 +-
drivers/video/omap2/dss/manager.c | 2 +-
drivers/video/omap2/dss/overlay.c | 2 +-
drivers/video/omap2/dss/rfbi.c | 7 +-
drivers/video/omap2/dss/sdi.c | 2 +-
drivers/video/omap2/dss/venc.c | 7 +-
16 files changed, 96 insertions(+), 57 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] OMAP: DSS2: make omap_dss_(un)register_device static
2011-04-01 10:00 [PATCH 0/5] OMAP: DSS: add __inits and __exits Tomi Valkeinen
@ 2011-04-01 10:00 ` Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 2/5] OMAP: DSS2: add __inits to omapdss driver Tomi Valkeinen
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
omap_dss_register_device and omap_dss_unregister_device can only be
called from core.c, so we can make it static.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
arch/arm/plat-omap/include/plat/display.h | 3 ---
drivers/video/omap2/dss/core.c | 7 +++++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h
index 5e04ddc..e239a0d 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -519,9 +519,6 @@ struct omap_dss_driver {
int omap_dss_register_driver(struct omap_dss_driver *);
void omap_dss_unregister_driver(struct omap_dss_driver *);
-int omap_dss_register_device(struct omap_dss_device *);
-void omap_dss_unregister_device(struct omap_dss_device *);
-
void omap_dss_get_device(struct omap_dss_device *dssdev);
void omap_dss_put_device(struct omap_dss_device *dssdev);
#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 1aa2ed1..9bcb0b8 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -54,6 +54,9 @@ unsigned int dss_debug;
module_param_named(debug, dss_debug, bool, 0644);
#endif
+static int omap_dss_register_device(struct omap_dss_device *);
+static void omap_dss_unregister_device(struct omap_dss_device *);
+
/* REGULATORS */
struct regulator *dss_get_vdds_dsi(void)
@@ -480,7 +483,7 @@ static void omap_dss_dev_release(struct device *dev)
reset_device(dev, 0);
}
-int omap_dss_register_device(struct omap_dss_device *dssdev)
+static int omap_dss_register_device(struct omap_dss_device *dssdev)
{
static int dev_num;
@@ -494,7 +497,7 @@ int omap_dss_register_device(struct omap_dss_device *dssdev)
return device_register(&dssdev->dev);
}
-void omap_dss_unregister_device(struct omap_dss_device *dssdev)
+static void omap_dss_unregister_device(struct omap_dss_device *dssdev)
{
device_unregister(&dssdev->dev);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] OMAP: DSS2: add __inits to omapdss driver
2011-04-01 10:00 [PATCH 0/5] OMAP: DSS: add __inits and __exits Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 1/5] OMAP: DSS2: make omap_dss_(un)register_device static Tomi Valkeinen
@ 2011-04-01 10:00 ` Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 3/5] OMAP: DSS2: use __exit for selected panel drivers Tomi Valkeinen
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
We can use platform_driver_probe() instead of platform_driver_register()
and thus add __init to many functions in omapdss driver.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 15 +++++++--------
drivers/video/omap2/dss/dispc.c | 7 +++----
drivers/video/omap2/dss/dpi.c | 2 +-
drivers/video/omap2/dss/dsi.c | 7 +++----
drivers/video/omap2/dss/dss.c | 9 ++++-----
drivers/video/omap2/dss/dss_features.c | 2 +-
drivers/video/omap2/dss/hdmi.c | 8 ++++----
drivers/video/omap2/dss/manager.c | 2 +-
drivers/video/omap2/dss/overlay.c | 2 +-
drivers/video/omap2/dss/rfbi.c | 7 +++----
drivers/video/omap2/dss/sdi.c | 2 +-
drivers/video/omap2/dss/venc.c | 7 +++----
12 files changed, 32 insertions(+), 38 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 9bcb0b8..3584e3e 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -109,7 +109,7 @@ static const struct file_operations dss_debug_fops = {
static struct dentry *dss_debugfs_dir;
-static int dss_initialize_debugfs(void)
+static int __init dss_initialize_debugfs(void)
{
dss_debugfs_dir = debugfs_create_dir("omapdss", NULL);
if (IS_ERR(dss_debugfs_dir)) {
@@ -156,7 +156,7 @@ static void dss_uninitialize_debugfs(void)
debugfs_remove_recursive(dss_debugfs_dir);
}
#else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
-static inline int dss_initialize_debugfs(void)
+static inline int __init dss_initialize_debugfs(void)
{
return 0;
}
@@ -166,7 +166,7 @@ static inline void dss_uninitialize_debugfs(void)
#endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
/* PLATFORM DEVICE */
-static int omap_dss_probe(struct platform_device *pdev)
+static int __init omap_dss_probe(struct platform_device *pdev)
{
struct omap_dss_board_info *pdata = pdev->dev.platform_data;
int r;
@@ -307,7 +307,6 @@ static int omap_dss_resume(struct platform_device *pdev)
}
static struct platform_driver omap_dss_driver = {
- .probe = omap_dss_probe,
.remove = omap_dss_remove,
.shutdown = omap_dss_shutdown,
.suspend = omap_dss_suspend,
@@ -483,7 +482,7 @@ static void omap_dss_dev_release(struct device *dev)
reset_device(dev, 0);
}
-static int omap_dss_register_device(struct omap_dss_device *dssdev)
+static int __init omap_dss_register_device(struct omap_dss_device *dssdev)
{
static int dev_num;
@@ -503,7 +502,7 @@ static void omap_dss_unregister_device(struct omap_dss_device *dssdev)
}
/* BUS */
-static int omap_dss_bus_register(void)
+static int __init omap_dss_bus_register(void)
{
int r;
@@ -542,7 +541,7 @@ static int __init omap_dss_init(void)
if (r)
return r;
- r = platform_driver_register(&omap_dss_driver);
+ r = platform_driver_probe(&omap_dss_driver, omap_dss_probe);
if (r) {
omap_dss_bus_unregister();
return r;
@@ -578,7 +577,7 @@ static int __init omap_dss_init(void)
static int __init omap_dss_init2(void)
{
- return platform_driver_register(&omap_dss_driver);
+ return platform_driver_probe(&omap_dss_driver, omap_dss_probe);
}
core_initcall(omap_dss_init);
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 7804779..8cfc9f0 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3419,7 +3419,7 @@ int dispc_setup_plane(enum omap_plane plane,
}
/* DISPC HW IP initialisation */
-static int omap_dispchw_probe(struct platform_device *pdev)
+static int __init omap_dispchw_probe(struct platform_device *pdev)
{
u32 rev;
int r = 0;
@@ -3491,7 +3491,6 @@ static int omap_dispchw_remove(struct platform_device *pdev)
}
static struct platform_driver omap_dispchw_driver = {
- .probe = omap_dispchw_probe,
.remove = omap_dispchw_remove,
.driver = {
.name = "omapdss_dispc",
@@ -3499,9 +3498,9 @@ static struct platform_driver omap_dispchw_driver = {
},
};
-int dispc_init_platform_driver(void)
+int __init dispc_init_platform_driver(void)
{
- return platform_driver_register(&omap_dispchw_driver);
+ return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe);
}
void dispc_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 2d3ca4c..4e8ea50 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -319,7 +319,7 @@ int dpi_init_display(struct omap_dss_device *dssdev)
return 0;
}
-int dpi_init(void)
+int __init dpi_init(void)
{
return 0;
}
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 23d9bbe..102bd70 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -3819,7 +3819,7 @@ static void dsi_exit(void)
}
/* DSI1 HW IP initialisation */
-static int omap_dsi1hw_probe(struct platform_device *pdev)
+static int __init omap_dsi1hw_probe(struct platform_device *pdev)
{
int r;
dsi.pdev = pdev;
@@ -3839,7 +3839,6 @@ static int omap_dsi1hw_remove(struct platform_device *pdev)
}
static struct platform_driver omap_dsi1hw_driver = {
- .probe = omap_dsi1hw_probe,
.remove = omap_dsi1hw_remove,
.driver = {
.name = "omapdss_dsi1",
@@ -3847,9 +3846,9 @@ static struct platform_driver omap_dsi1hw_driver = {
},
};
-int dsi_init_platform_driver(void)
+int __init dsi_init_platform_driver(void)
{
- return platform_driver_register(&omap_dsi1hw_driver);
+ return platform_driver_probe(&omap_dsi1hw_driver, omap_dsi1hw_probe);
}
void dsi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 9a73af6..428cc8f 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -635,7 +635,7 @@ void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select hdmi)
REG_FLD_MOD(DSS_CONTROL, hdmi, 15, 15); /* VENC_HDMI_SWITCH */
}
-static int dss_init(void)
+static int __init dss_init(void)
{
int r;
u32 rev;
@@ -1088,7 +1088,7 @@ void dss_debug_dump_clocks(struct seq_file *s)
/* DSS HW IP initialisation */
-static int omap_dsshw_probe(struct platform_device *pdev)
+static int __init omap_dsshw_probe(struct platform_device *pdev)
{
int r;
@@ -1152,7 +1152,6 @@ static int omap_dsshw_remove(struct platform_device *pdev)
}
static struct platform_driver omap_dsshw_driver = {
- .probe = omap_dsshw_probe,
.remove = omap_dsshw_remove,
.driver = {
.name = "omapdss_dss",
@@ -1160,9 +1159,9 @@ static struct platform_driver omap_dsshw_driver = {
},
};
-int dss_init_platform_driver(void)
+int __init dss_init_platform_driver(void)
{
- return platform_driver_register(&omap_dsshw_driver);
+ return platform_driver_probe(&omap_dsshw_driver, omap_dsshw_probe);
}
void dss_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index 179a7a4..f30b917 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -360,7 +360,7 @@ void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
*end = omap_current_dss_features->reg_fields[id].end;
}
-void dss_features_init(void)
+void __init dss_features_init(void)
{
if (cpu_is_omap24xx())
omap_current_dss_features = &omap2_dss_features;
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 0d44f07..ce07539 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -1276,7 +1276,7 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev)
}
/* HDMI HW IP initialisation */
-static int omapdss_hdmihw_probe(struct platform_device *pdev)
+static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
{
struct resource *hdmi_mem;
@@ -1313,7 +1313,6 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev)
}
static struct platform_driver omapdss_hdmihw_driver = {
- .probe = omapdss_hdmihw_probe,
.remove = omapdss_hdmihw_remove,
.driver = {
.name = "omapdss_hdmi",
@@ -1321,9 +1320,10 @@ static struct platform_driver omapdss_hdmihw_driver = {
},
};
-int hdmi_init_platform_driver(void)
+int __init hdmi_init_platform_driver(void)
{
- return platform_driver_register(&omapdss_hdmihw_driver);
+ return platform_driver_probe(&omapdss_hdmihw_driver,
+ omapdss_hdmihw_probe);
}
void hdmi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index bcd37ec..08152a7 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -1475,7 +1475,7 @@ static void omap_dss_add_overlay_manager(struct omap_overlay_manager *manager)
list_add_tail(&manager->list, &manager_list);
}
-int dss_init_overlay_managers(struct platform_device *pdev)
+int __init dss_init_overlay_managers(struct platform_device *pdev)
{
int i, r;
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c
index f1aca6d..96f304a 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -570,7 +570,7 @@ void dss_overlay_setup_l4_manager(struct omap_overlay_manager *mgr)
}
#endif
-void dss_init_overlays(struct platform_device *pdev)
+void __init dss_init_overlays(struct platform_device *pdev)
{
int i, r;
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 5ea17f4..8bbe83e 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -1013,7 +1013,7 @@ int rfbi_init_display(struct omap_dss_device *dssdev)
}
/* RFBI HW IP initialisation */
-static int omap_rfbihw_probe(struct platform_device *pdev)
+static int __init omap_rfbihw_probe(struct platform_device *pdev)
{
u32 rev;
u32 l;
@@ -1065,7 +1065,6 @@ static int omap_rfbihw_remove(struct platform_device *pdev)
}
static struct platform_driver omap_rfbihw_driver = {
- .probe = omap_rfbihw_probe,
.remove = omap_rfbihw_remove,
.driver = {
.name = "omapdss_rfbi",
@@ -1073,9 +1072,9 @@ static struct platform_driver omap_rfbihw_driver = {
},
};
-int rfbi_init_platform_driver(void)
+int __init rfbi_init_platform_driver(void)
{
- return platform_driver_register(&omap_rfbihw_driver);
+ return platform_driver_probe(&omap_rfbihw_driver, omap_rfbihw_probe);
}
void rfbi_uninit_platform_driver(void)
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 54a53e6..87d5a7e 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -160,7 +160,7 @@ int sdi_init_display(struct omap_dss_device *dssdev)
return 0;
}
-int sdi_init(void)
+int __init sdi_init(void)
{
return 0;
}
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 8e35a5b..c56c16b 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -714,7 +714,7 @@ void venc_dump_regs(struct seq_file *s)
}
/* VENC HW IP initialisation */
-static int omap_venchw_probe(struct platform_device *pdev)
+static int __init omap_venchw_probe(struct platform_device *pdev)
{
u8 rev_id;
struct resource *venc_mem;
@@ -759,7 +759,6 @@ static int omap_venchw_remove(struct platform_device *pdev)
}
static struct platform_driver omap_venchw_driver = {
- .probe = omap_venchw_probe,
.remove = omap_venchw_remove,
.driver = {
.name = "omapdss_venc",
@@ -767,12 +766,12 @@ static struct platform_driver omap_venchw_driver = {
},
};
-int venc_init_platform_driver(void)
+int __init venc_init_platform_driver(void)
{
if (cpu_is_omap44xx())
return 0;
- return platform_driver_register(&omap_venchw_driver);
+ return platform_driver_probe(&omap_venchw_driver, omap_venchw_probe);
}
void venc_uninit_platform_driver(void)
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] OMAP: DSS2: use __exit for selected panel drivers
2011-04-01 10:00 [PATCH 0/5] OMAP: DSS: add __inits and __exits Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 1/5] OMAP: DSS2: make omap_dss_(un)register_device static Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 2/5] OMAP: DSS2: add __inits to omapdss driver Tomi Valkeinen
@ 2011-04-01 10:00 ` Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 4/5] OMAP: DSS2: Add omap_dss_register_driver_probe() Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 5/5] OMAP: DSS2: use omap_dss_register_driver_probe() in selected drivers Tomi Valkeinen
4 siblings, 0 replies; 6+ messages in thread
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
We can use __exit for the driver remove function in plain dss panels
(ie. those that do not need i2c or spi).
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/displays/panel-generic-dpi.c | 4 ++--
.../video/omap2/displays/panel-sharp-ls037v7dw01.c | 4 ++--
drivers/video/omap2/displays/panel-taal.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c
index 4a9b9ff..e359f93 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -285,7 +285,7 @@ static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
return 0;
}
-static void generic_dpi_panel_remove(struct omap_dss_device *dssdev)
+static void __exit generic_dpi_panel_remove(struct omap_dss_device *dssdev)
{
struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
@@ -358,7 +358,7 @@ static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev,
static struct omap_dss_driver dpi_driver = {
.probe = generic_dpi_panel_probe,
- .remove = generic_dpi_panel_remove,
+ .remove = __exit_p(generic_dpi_panel_remove),
.enable = generic_dpi_panel_enable,
.disable = generic_dpi_panel_disable,
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
index d2b35d2..c772747 100644
--- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
@@ -120,7 +120,7 @@ static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
return 0;
}
-static void sharp_ls_panel_remove(struct omap_dss_device *dssdev)
+static void __exit sharp_ls_panel_remove(struct omap_dss_device *dssdev)
{
struct sharp_data *sd = dev_get_drvdata(&dssdev->dev);
struct backlight_device *bl = sd->bl;
@@ -205,7 +205,7 @@ static int sharp_ls_panel_resume(struct omap_dss_device *dssdev)
static struct omap_dss_driver sharp_ls_driver = {
.probe = sharp_ls_panel_probe,
- .remove = sharp_ls_panel_remove,
+ .remove = __exit_p(sharp_ls_panel_remove),
.enable = sharp_ls_panel_enable,
.disable = sharp_ls_panel_disable,
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index adc9900..490998f 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -819,7 +819,7 @@ err:
return r;
}
-static void taal_remove(struct omap_dss_device *dssdev)
+static void __exit taal_remove(struct omap_dss_device *dssdev)
{
struct taal_data *td = dev_get_drvdata(&dssdev->dev);
struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
@@ -1557,7 +1557,7 @@ static enum omap_dss_update_mode taal_get_update_mode(
static struct omap_dss_driver taal_driver = {
.probe = taal_probe,
- .remove = taal_remove,
+ .remove = __exit_p(taal_remove),
.enable = taal_enable,
.disable = taal_disable,
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] OMAP: DSS2: Add omap_dss_register_driver_probe()
2011-04-01 10:00 [PATCH 0/5] OMAP: DSS: add __inits and __exits Tomi Valkeinen
` (2 preceding siblings ...)
2011-04-01 10:00 ` [PATCH 3/5] OMAP: DSS2: use __exit for selected panel drivers Tomi Valkeinen
@ 2011-04-01 10:00 ` Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 5/5] OMAP: DSS2: use omap_dss_register_driver_probe() in selected drivers Tomi Valkeinen
4 siblings, 0 replies; 6+ messages in thread
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
Implement omap_dss_register_driver_probe() function, which is similar to
platform_driver_probe(). omap_dss_register_driver_probe will add the
driver and probe devices in one go, thus enabling us to use __init for
panel probe functions.
Also, if no devices are found in omap_dss_register_driver_probe(), the
function will return -ENODEV, which causes the panel driver module to be
unloaded.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
arch/arm/plat-omap/include/plat/display.h | 2 +
drivers/video/omap2/dss/core.c | 44 +++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h
index e239a0d..226a78f 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -517,6 +517,8 @@ struct omap_dss_driver {
};
int omap_dss_register_driver(struct omap_dss_driver *);
+int omap_dss_register_driver_probe(struct omap_dss_driver *,
+ int (*probe)(struct omap_dss_device *));
void omap_dss_unregister_driver(struct omap_dss_driver *);
void omap_dss_get_device(struct omap_dss_device *dssdev);
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 3584e3e..b3eba14 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -447,6 +447,50 @@ void omap_dss_unregister_driver(struct omap_dss_driver *dssdriver)
}
EXPORT_SYMBOL(omap_dss_unregister_driver);
+static int omap_dss_driver_probe_fail(struct device *dev)
+{
+ return -ENXIO;
+}
+
+static int find_any_dev(struct device *dev, void *data)
+{
+ struct omap_dss_driver *dssdrv = data;
+ return dev->driver = &dssdrv->driver;
+}
+
+int omap_dss_register_driver_probe(struct omap_dss_driver *dssdriver,
+ int (*probe)(struct omap_dss_device *))
+{
+ int r;
+
+ /* make sure driver won't have bind/unbind attributes */
+ dssdriver->driver.suppress_bind_attrs = true;
+
+ /* temporary section violation during probe() */
+ dssdriver->probe = probe;
+ r = omap_dss_register_driver(dssdriver);
+
+ /* fixup that section violation */
+
+ dssdriver->probe = NULL;
+ dssdriver->driver.probe = omap_dss_driver_probe_fail;
+
+ if (r)
+ return r;
+
+ /* find any device using this driver */
+ r = bus_for_each_dev(&dss_bus_type, NULL, dssdriver, find_any_dev);
+
+ if (r = 0) {
+ /* no devices for this driver */
+ omap_dss_unregister_driver(dssdriver);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL(omap_dss_register_driver_probe);
+
/* DEVICE */
static void reset_device(struct device *dev, int check)
{
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] OMAP: DSS2: use omap_dss_register_driver_probe() in selected drivers
2011-04-01 10:00 [PATCH 0/5] OMAP: DSS: add __inits and __exits Tomi Valkeinen
` (3 preceding siblings ...)
2011-04-01 10:00 ` [PATCH 4/5] OMAP: DSS2: Add omap_dss_register_driver_probe() Tomi Valkeinen
@ 2011-04-01 10:00 ` Tomi Valkeinen
4 siblings, 0 replies; 6+ messages in thread
From: Tomi Valkeinen @ 2011-04-01 10:00 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
Use omap_dss_register_driver_probe() in plain dss panel drivers, which
allows us to use __init for the driver probe functions.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/displays/panel-generic-dpi.c | 6 +++---
.../video/omap2/displays/panel-sharp-ls037v7dw01.c | 6 +++---
drivers/video/omap2/displays/panel-taal.c | 5 ++---
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c
index e359f93..010ea4e 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -246,7 +246,7 @@ static void generic_dpi_panel_power_off(struct omap_dss_device *dssdev)
omapdss_dpi_display_disable(dssdev);
}
-static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
+static int __init generic_dpi_panel_probe(struct omap_dss_device *dssdev)
{
struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
struct panel_config *panel_config = NULL;
@@ -357,7 +357,6 @@ static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev,
}
static struct omap_dss_driver dpi_driver = {
- .probe = generic_dpi_panel_probe,
.remove = __exit_p(generic_dpi_panel_remove),
.enable = generic_dpi_panel_enable,
@@ -377,7 +376,8 @@ static struct omap_dss_driver dpi_driver = {
static int __init generic_dpi_panel_drv_init(void)
{
- return omap_dss_register_driver(&dpi_driver);
+ return omap_dss_register_driver_probe(&dpi_driver,
+ generic_dpi_panel_probe);
}
static void __exit generic_dpi_panel_drv_exit(void)
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
index c772747..2cf3c9f 100644
--- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
@@ -79,7 +79,7 @@ static const struct backlight_ops sharp_ls_bl_ops = {
-static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
+static int __init sharp_ls_panel_probe(struct omap_dss_device *dssdev)
{
struct backlight_properties props;
struct backlight_device *bl;
@@ -204,7 +204,6 @@ static int sharp_ls_panel_resume(struct omap_dss_device *dssdev)
}
static struct omap_dss_driver sharp_ls_driver = {
- .probe = sharp_ls_panel_probe,
.remove = __exit_p(sharp_ls_panel_remove),
.enable = sharp_ls_panel_enable,
@@ -220,7 +219,8 @@ static struct omap_dss_driver sharp_ls_driver = {
static int __init sharp_ls_panel_drv_init(void)
{
- return omap_dss_register_driver(&sharp_ls_driver);
+ return omap_dss_register_driver_probe(&sharp_ls_driver,
+ sharp_ls_panel_probe);
}
static void __exit sharp_ls_panel_drv_exit(void)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 490998f..d62821e 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -661,7 +661,7 @@ static void taal_hw_reset(struct omap_dss_device *dssdev)
msleep(td->panel_config->sleep.hw_reset);
}
-static int taal_probe(struct omap_dss_device *dssdev)
+static int __init taal_probe(struct omap_dss_device *dssdev)
{
struct backlight_properties props;
struct taal_data *td;
@@ -1556,7 +1556,6 @@ static enum omap_dss_update_mode taal_get_update_mode(
}
static struct omap_dss_driver taal_driver = {
- .probe = taal_probe,
.remove = __exit_p(taal_remove),
.enable = taal_enable,
@@ -1593,7 +1592,7 @@ static struct omap_dss_driver taal_driver = {
static int __init taal_init(void)
{
- omap_dss_register_driver(&taal_driver);
+ omap_dss_register_driver_probe(&taal_driver, taal_probe);
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-04-01 10:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-01 10:00 [PATCH 0/5] OMAP: DSS: add __inits and __exits Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 1/5] OMAP: DSS2: make omap_dss_(un)register_device static Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 2/5] OMAP: DSS2: add __inits to omapdss driver Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 3/5] OMAP: DSS2: use __exit for selected panel drivers Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 4/5] OMAP: DSS2: Add omap_dss_register_driver_probe() Tomi Valkeinen
2011-04-01 10:00 ` [PATCH 5/5] OMAP: DSS2: use omap_dss_register_driver_probe() in selected drivers Tomi Valkeinen
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).