aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/pxafb.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-09 17:32:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-09 17:32:44 -0500
commit3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch)
treed8825be54cefb6ad6707478d719c8e30605bee7b /drivers/video/pxafb.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/pxafb.c')
-rw-r--r--drivers/video/pxafb.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index f305a5b77b23..7b4cd250bec8 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -980,17 +980,17 @@ pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data)
980 * Power management hooks. Note that we won't be called from IRQ context, 980 * Power management hooks. Note that we won't be called from IRQ context,
981 * unlike the blank functions above, so we may sleep. 981 * unlike the blank functions above, so we may sleep.
982 */ 982 */
983static int pxafb_suspend(struct device *dev, pm_message_t state) 983static int pxafb_suspend(struct platform_device *dev, pm_message_t state)
984{ 984{
985 struct pxafb_info *fbi = dev_get_drvdata(dev); 985 struct pxafb_info *fbi = platform_get_drvdata(dev);
986 986
987 set_ctrlr_state(fbi, C_DISABLE_PM); 987 set_ctrlr_state(fbi, C_DISABLE_PM);
988 return 0; 988 return 0;
989} 989}
990 990
991static int pxafb_resume(struct device *dev) 991static int pxafb_resume(struct platform_device *dev)
992{ 992{
993 struct pxafb_info *fbi = dev_get_drvdata(dev); 993 struct pxafb_info *fbi = platform_get_drvdata(dev);
994 994
995 set_ctrlr_state(fbi, C_ENABLE_PM); 995 set_ctrlr_state(fbi, C_ENABLE_PM);
996 return 0; 996 return 0;
@@ -1268,7 +1268,7 @@ static int __init pxafb_parse_options(struct device *dev, char *options)
1268} 1268}
1269#endif 1269#endif
1270 1270
1271int __init pxafb_probe(struct device *dev) 1271int __init pxafb_probe(struct platform_device *dev)
1272{ 1272{
1273 struct pxafb_info *fbi; 1273 struct pxafb_info *fbi;
1274 struct pxafb_mach_info *inf; 1274 struct pxafb_mach_info *inf;
@@ -1276,14 +1276,14 @@ int __init pxafb_probe(struct device *dev)
1276 1276
1277 dev_dbg(dev, "pxafb_probe\n"); 1277 dev_dbg(dev, "pxafb_probe\n");
1278 1278
1279 inf = dev->platform_data; 1279 inf = dev->dev.platform_data;
1280 ret = -ENOMEM; 1280 ret = -ENOMEM;
1281 fbi = NULL; 1281 fbi = NULL;
1282 if (!inf) 1282 if (!inf)
1283 goto failed; 1283 goto failed;
1284 1284
1285#ifdef CONFIG_FB_PXA_PARAMETERS 1285#ifdef CONFIG_FB_PXA_PARAMETERS
1286 ret = pxafb_parse_options(dev, g_options); 1286 ret = pxafb_parse_options(&dev->dev, g_options);
1287 if (ret < 0) 1287 if (ret < 0)
1288 goto failed; 1288 goto failed;
1289#endif 1289#endif
@@ -1293,36 +1293,36 @@ int __init pxafb_probe(struct device *dev)
1293 * a warning is given. */ 1293 * a warning is given. */
1294 1294
1295 if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK) 1295 if (inf->lccr0 & LCCR0_INVALID_CONFIG_MASK)
1296 dev_warn(dev, "machine LCCR0 setting contains illegal bits: %08x\n", 1296 dev_warn(&dev->dev, "machine LCCR0 setting contains illegal bits: %08x\n",
1297 inf->lccr0 & LCCR0_INVALID_CONFIG_MASK); 1297 inf->lccr0 & LCCR0_INVALID_CONFIG_MASK);
1298 if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK) 1298 if (inf->lccr3 & LCCR3_INVALID_CONFIG_MASK)
1299 dev_warn(dev, "machine LCCR3 setting contains illegal bits: %08x\n", 1299 dev_warn(&dev->dev, "machine LCCR3 setting contains illegal bits: %08x\n",
1300 inf->lccr3 & LCCR3_INVALID_CONFIG_MASK); 1300 inf->lccr3 & LCCR3_INVALID_CONFIG_MASK);
1301 if (inf->lccr0 & LCCR0_DPD && 1301 if (inf->lccr0 & LCCR0_DPD &&
1302 ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas || 1302 ((inf->lccr0 & LCCR0_PAS) != LCCR0_Pas ||
1303 (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl || 1303 (inf->lccr0 & LCCR0_SDS) != LCCR0_Sngl ||
1304 (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono)) 1304 (inf->lccr0 & LCCR0_CMS) != LCCR0_Mono))
1305 dev_warn(dev, "Double Pixel Data (DPD) mode is only valid in passive mono" 1305 dev_warn(&dev->dev, "Double Pixel Data (DPD) mode is only valid in passive mono"
1306 " single panel mode\n"); 1306 " single panel mode\n");
1307 if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act && 1307 if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Act &&
1308 (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual) 1308 (inf->lccr0 & LCCR0_SDS) == LCCR0_Dual)
1309 dev_warn(dev, "Dual panel only valid in passive mode\n"); 1309 dev_warn(&dev->dev, "Dual panel only valid in passive mode\n");
1310 if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas && 1310 if ((inf->lccr0 & LCCR0_PAS) == LCCR0_Pas &&
1311 (inf->upper_margin || inf->lower_margin)) 1311 (inf->upper_margin || inf->lower_margin))
1312 dev_warn(dev, "Upper and lower margins must be 0 in passive mode\n"); 1312 dev_warn(&dev->dev, "Upper and lower margins must be 0 in passive mode\n");
1313#endif 1313#endif
1314 1314
1315 dev_dbg(dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp); 1315 dev_dbg(&dev->dev, "got a %dx%dx%d LCD\n",inf->xres, inf->yres, inf->bpp);
1316 if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) { 1316 if (inf->xres == 0 || inf->yres == 0 || inf->bpp == 0) {
1317 dev_err(dev, "Invalid resolution or bit depth\n"); 1317 dev_err(&dev->dev, "Invalid resolution or bit depth\n");
1318 ret = -EINVAL; 1318 ret = -EINVAL;
1319 goto failed; 1319 goto failed;
1320 } 1320 }
1321 pxafb_backlight_power = inf->pxafb_backlight_power; 1321 pxafb_backlight_power = inf->pxafb_backlight_power;
1322 pxafb_lcd_power = inf->pxafb_lcd_power; 1322 pxafb_lcd_power = inf->pxafb_lcd_power;
1323 fbi = pxafb_init_fbinfo(dev); 1323 fbi = pxafb_init_fbinfo(&dev->dev);
1324 if (!fbi) { 1324 if (!fbi) {
1325 dev_err(dev, "Failed to initialize framebuffer device\n"); 1325 dev_err(&dev->dev, "Failed to initialize framebuffer device\n");
1326 ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc 1326 ret = -ENOMEM; // only reason for pxafb_init_fbinfo to fail is kmalloc
1327 goto failed; 1327 goto failed;
1328 } 1328 }
@@ -1330,14 +1330,14 @@ int __init pxafb_probe(struct device *dev)
1330 /* Initialize video memory */ 1330 /* Initialize video memory */
1331 ret = pxafb_map_video_memory(fbi); 1331 ret = pxafb_map_video_memory(fbi);
1332 if (ret) { 1332 if (ret) {
1333 dev_err(dev, "Failed to allocate video RAM: %d\n", ret); 1333 dev_err(&dev->dev, "Failed to allocate video RAM: %d\n", ret);
1334 ret = -ENOMEM; 1334 ret = -ENOMEM;
1335 goto failed; 1335 goto failed;
1336 } 1336 }
1337 1337
1338 ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi); 1338 ret = request_irq(IRQ_LCD, pxafb_handle_irq, SA_INTERRUPT, "LCD", fbi);
1339 if (ret) { 1339 if (ret) {
1340 dev_err(dev, "request_irq failed: %d\n", ret); 1340 dev_err(&dev->dev, "request_irq failed: %d\n", ret);
1341 ret = -EBUSY; 1341 ret = -EBUSY;
1342 goto failed; 1342 goto failed;
1343 } 1343 }
@@ -1349,11 +1349,11 @@ int __init pxafb_probe(struct device *dev)
1349 pxafb_check_var(&fbi->fb.var, &fbi->fb); 1349 pxafb_check_var(&fbi->fb.var, &fbi->fb);
1350 pxafb_set_par(&fbi->fb); 1350 pxafb_set_par(&fbi->fb);
1351 1351
1352 dev_set_drvdata(dev, fbi); 1352 platform_set_drvdata(dev, fbi);
1353 1353
1354 ret = register_framebuffer(&fbi->fb); 1354 ret = register_framebuffer(&fbi->fb);
1355 if (ret < 0) { 1355 if (ret < 0) {
1356 dev_err(dev, "Failed to register framebuffer device: %d\n", ret); 1356 dev_err(&dev->dev, "Failed to register framebuffer device: %d\n", ret);
1357 goto failed; 1357 goto failed;
1358 } 1358 }
1359 1359
@@ -1376,19 +1376,20 @@ int __init pxafb_probe(struct device *dev)
1376 return 0; 1376 return 0;
1377 1377
1378failed: 1378failed:
1379 dev_set_drvdata(dev, NULL); 1379 platform_set_drvdata(dev, NULL);
1380 kfree(fbi); 1380 kfree(fbi);
1381 return ret; 1381 return ret;
1382} 1382}
1383 1383
1384static struct device_driver pxafb_driver = { 1384static struct platform_driver pxafb_driver = {
1385 .name = "pxa2xx-fb",
1386 .bus = &platform_bus_type,
1387 .probe = pxafb_probe, 1385 .probe = pxafb_probe,
1388#ifdef CONFIG_PM 1386#ifdef CONFIG_PM
1389 .suspend = pxafb_suspend, 1387 .suspend = pxafb_suspend,
1390 .resume = pxafb_resume, 1388 .resume = pxafb_resume,
1391#endif 1389#endif
1390 .driver = {
1391 .name = "pxa2xx-fb",
1392 },
1392}; 1393};
1393 1394
1394#ifndef MODULE 1395#ifndef MODULE
@@ -1415,7 +1416,7 @@ int __devinit pxafb_init(void)
1415 return -ENODEV; 1416 return -ENODEV;
1416 pxafb_setup(option); 1417 pxafb_setup(option);
1417#endif 1418#endif
1418 return driver_register(&pxafb_driver); 1419 return platform_driver_register(&pxafb_driver);
1419} 1420}
1420 1421
1421module_init(pxafb_init); 1422module_init(pxafb_init);