summaryrefslogtreecommitdiff
path: root/drivers/video/imxfb.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-09 22:32:44 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-09 22:32:44 +0000
commit3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch)
treed8825be54cefb6ad6707478d719c8e30605bee7b /drivers/video/imxfb.c
parent00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff)
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually remove the use of the device_driver function pointer methods for platform device drivers. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/video/imxfb.c')
-rw-r--r--drivers/video/imxfb.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index e20b9f3a255f..5924cc225c95 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -423,18 +423,18 @@ static void imxfb_setup_gpio(struct imxfb_info *fbi)
* Power management hooks. Note that we won't be called from IRQ context,
* unlike the blank functions above, so we may sleep.
*/
-static int imxfb_suspend(struct device *dev, pm_message_t state)
+static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
{
- struct imxfb_info *fbi = dev_get_drvdata(dev);
+ struct imxfb_info *fbi = platform_get_drvdata(dev);
pr_debug("%s\n",__FUNCTION__);
imxfb_disable_controller(fbi);
return 0;
}
-static int imxfb_resume(struct device *dev)
+static int imxfb_resume(struct platform_device *dev)
{
- struct imxfb_info *fbi = dev_get_drvdata(dev);
+ struct imxfb_info *fbi = platform_get_drvdata(dev);
pr_debug("%s\n",__FUNCTION__);
imxfb_enable_controller(fbi);
@@ -538,9 +538,8 @@ static int __init imxfb_map_video_memory(struct fb_info *info)
return fbi->map_cpu ? 0 : -ENOMEM;
}
-static int __init imxfb_probe(struct device *dev)
+static int __init imxfb_probe(struct platform_device *pdev)
{
- struct platform_device *pdev = to_platform_device(dev);
struct imxfb_info *fbi;
struct fb_info *info;
struct imxfb_mach_info *inf;
@@ -553,21 +552,21 @@ static int __init imxfb_probe(struct device *dev)
if(!res)
return -ENODEV;
- inf = dev->platform_data;
+ inf = pdev->dev.platform_data;
if(!inf) {
dev_err(dev,"No platform_data available\n");
return -ENOMEM;
}
- info = framebuffer_alloc(sizeof(struct imxfb_info), dev);
+ info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev);
if(!info)
return -ENOMEM;
fbi = info->par;
- dev_set_drvdata(dev, info);
+ platform_set_drvdata(pdev, info);
- ret = imxfb_init_fbinfo(dev);
+ ret = imxfb_init_fbinfo(&pdev->dev);
if( ret < 0 )
goto failed_init;
@@ -621,22 +620,21 @@ failed_register:
fb_dealloc_cmap(&info->cmap);
failed_cmap:
if (!inf->fixed_screen_cpu)
- dma_free_writecombine(dev,fbi->map_size,fbi->map_cpu,
+ dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu,
fbi->map_dma);
failed_map:
kfree(info->pseudo_palette);
failed_regs:
release_mem_region(res->start, res->end - res->start);
failed_init:
- dev_set_drvdata(dev, NULL);
+ platform_set_drvdata(pdev, NULL);
framebuffer_release(info);
return ret;
}
-static int imxfb_remove(struct device *dev)
+static int imxfb_remove(struct platform_device *pdev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct fb_info *info = dev_get_drvdata(dev);
+ struct fb_info *info = platform_get_drvdata(pdev);
struct imxfb_info *fbi = info->par;
struct resource *res;
@@ -651,36 +649,37 @@ static int imxfb_remove(struct device *dev)
framebuffer_release(info);
release_mem_region(res->start, res->end - res->start + 1);
- dev_set_drvdata(dev, NULL);
+ platform_set_drvdata(pdev, NULL);
return 0;
}
-void imxfb_shutdown(struct device * dev)
+void imxfb_shutdown(struct platform_device * dev)
{
- struct fb_info *info = dev_get_drvdata(dev);
+ struct fb_info *info = platform_get_drvdata(dev);
struct imxfb_info *fbi = info->par;
imxfb_disable_controller(fbi);
}
-static struct device_driver imxfb_driver = {
- .name = "imx-fb",
- .bus = &platform_bus_type,
+static struct platform_driver imxfb_driver = {
.probe = imxfb_probe,
.suspend = imxfb_suspend,
.resume = imxfb_resume,
.remove = imxfb_remove,
.shutdown = imxfb_shutdown,
+ .driver = {
+ .name = "imx-fb",
+ },
};
int __init imxfb_init(void)
{
- return driver_register(&imxfb_driver);
+ return platform_driver_register(&imxfb_driver);
}
static void __exit imxfb_cleanup(void)
{
- driver_unregister(&imxfb_driver);
+ platform_driver_unregister(&imxfb_driver);
}
module_init(imxfb_init);