summaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/rfbi.c
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-10 13:58:29 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-18 16:15:05 +0300
commit5274484b821bb2cf34a697624ef14084c31b16ce (patch)
treea5b99b98eb685414b5ff87233da5556ce80ad2f6 /drivers/video/omap2/dss/rfbi.c
parent5eeb55f8703d2af3181599c085b21ce023a0f942 (diff)
downloadop-kernel-dev-5274484b821bb2cf34a697624ef14084c31b16ce.zip
op-kernel-dev-5274484b821bb2cf34a697624ef14084c31b16ce.tar.gz
OMAPDSS: alloc dssdevs dynamically
We currently create omap_dss_devices statically in board files, and use those devices directly in the omapdss driver. This model prevents us from having the platform data (which the dssdevs in board files practically are) as read-only, and it's also different than what we will use with device tree. This patch changes the model to be in line with DT model: we allocate the dssdevs dynamically, and initialize them according to the data in the board file's dssdev (basically we memcopy the dssdev fields). The allocation and registration is done in the following steps in the output drivers: - Use dss_alloc_and_init_device to allocate and initialize the device. The function uses kalloc and device_initialize to accomplish this. - Call dss_copy_device_pdata to copy the data from the board file's dssdev - Use dss_add_device to register the device. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/rfbi.c')
-rw-r--r--drivers/video/omap2/dss/rfbi.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 1127037..38d9b8e 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -970,25 +970,34 @@ static struct omap_dss_device * __init rfbi_find_dssdev(struct platform_device *
return def_dssdev;
}
-static void __init rfbi_probe_pdata(struct platform_device *pdev)
+static void __init rfbi_probe_pdata(struct platform_device *rfbidev)
{
+ struct omap_dss_device *plat_dssdev;
struct omap_dss_device *dssdev;
int r;
- dssdev = rfbi_find_dssdev(pdev);
+ plat_dssdev = rfbi_find_dssdev(rfbidev);
+ if (!plat_dssdev)
+ return;
+
+ dssdev = dss_alloc_and_init_device(&rfbidev->dev);
if (!dssdev)
return;
+ dss_copy_device_pdata(dssdev, plat_dssdev);
+
r = rfbi_init_display(dssdev);
if (r) {
DSSERR("device %s init failed: %d\n", dssdev->name, r);
+ dss_put_device(dssdev);
return;
}
- r = omap_dss_register_device(dssdev, &pdev->dev);
+ r = dss_add_device(dssdev);
if (r) {
DSSERR("device %s register failed: %d\n", dssdev->name, r);
+ dss_put_device(dssdev);
return;
}
}
@@ -1055,7 +1064,7 @@ err_runtime_get:
static int __exit omap_rfbihw_remove(struct platform_device *pdev)
{
- omap_dss_unregister_child_devices(&pdev->dev);
+ dss_unregister_child_devices(&pdev->dev);
pm_runtime_disable(&pdev->dev);
return 0;
}
OpenPOWER on IntegriCloud