aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/xilinxfb.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2009-06-17 02:30:02 -0400
committerGrant Likely <grant.likely@secretlab.ca>2009-06-17 02:30:02 -0400
commitaa296a891d1f3704d40127e998c31dfda531fca7 (patch)
treea08a4bb85861ec698bcbd9b234968aed43a4cc22 /drivers/video/xilinxfb.c
parent313485175da221c388f6a8ecf4c30062ba9bea17 (diff)
fbdev/xilinxfb: Fix improper casting and tighen up probe path
The xilinxfb driver is improperly casting a physical address to a u32, and the probe routine isn't as straight forward as it could be. (discovered by gcc spitting out warnings on most recent change to xilinxfb driver). This patch fixes the cast and simplifies the probe path. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Tested-by: John Linn <john.linn@xilinx.com>
Diffstat (limited to 'drivers/video/xilinxfb.c')
-rw-r--r--drivers/video/xilinxfb.c59
1 files changed, 23 insertions, 36 deletions
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index 7a868bd16e0e..ed7c8d0ddccb 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -124,7 +124,6 @@ struct xilinxfb_drvdata {
124 registers */ 124 registers */
125 125
126 dcr_host_t dcr_host; 126 dcr_host_t dcr_host;
127 unsigned int dcr_start;
128 unsigned int dcr_len; 127 unsigned int dcr_len;
129 128
130 void *fb_virt; /* virt. address of the frame buffer */ 129 void *fb_virt; /* virt. address of the frame buffer */
@@ -325,8 +324,8 @@ static int xilinxfb_assign(struct device *dev,
325 drvdata->regs); 324 drvdata->regs);
326 } 325 }
327 /* Put a banner in the log (for DEBUG) */ 326 /* Put a banner in the log (for DEBUG) */
328 dev_dbg(dev, "fb: phys=%p, virt=%p, size=%x\n", 327 dev_dbg(dev, "fb: phys=%llx, virt=%p, size=%x\n",
329 (void *)drvdata->fb_phys, drvdata->fb_virt, fbsize); 328 (unsigned long long)drvdata->fb_phys, drvdata->fb_virt, fbsize);
330 329
331 return 0; /* success */ 330 return 0; /* success */
332 331
@@ -404,9 +403,7 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match)
404 u32 tft_access; 403 u32 tft_access;
405 struct xilinxfb_platform_data pdata; 404 struct xilinxfb_platform_data pdata;
406 struct resource res; 405 struct resource res;
407 int size, rc; 406 int size, rc, start;
408 int start = 0, len = 0;
409 dcr_host_t dcr_host;
410 struct xilinxfb_drvdata *drvdata; 407 struct xilinxfb_drvdata *drvdata;
411 408
412 /* Copy with the default pdata (not a ptr reference!) */ 409 /* Copy with the default pdata (not a ptr reference!) */
@@ -414,35 +411,39 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match)
414 411
415 dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match); 412 dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match);
416 413
414 /* Allocate the driver data region */
415 drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
416 if (!drvdata) {
417 dev_err(&op->dev, "Couldn't allocate device private record\n");
418 return -ENOMEM;
419 }
420
417 /* 421 /*
418 * To check whether the core is connected directly to DCR or PLB 422 * To check whether the core is connected directly to DCR or PLB
419 * interface and initialize the tft_access accordingly. 423 * interface and initialize the tft_access accordingly.
420 */ 424 */
421 p = (u32 *)of_get_property(op->node, "xlnx,dcr-splb-slave-if", NULL); 425 p = (u32 *)of_get_property(op->node, "xlnx,dcr-splb-slave-if", NULL);
422 426 tft_access = p ? *p : 0;
423 if (p)
424 tft_access = *p;
425 else
426 tft_access = 0; /* For backward compatibility */
427 427
428 /* 428 /*
429 * Fill the resource structure if its direct PLB interface 429 * Fill the resource structure if its direct PLB interface
430 * otherwise fill the dcr_host structure. 430 * otherwise fill the dcr_host structure.
431 */ 431 */
432 if (tft_access) { 432 if (tft_access) {
433 drvdata->flags |= PLB_ACCESS_FLAG;
433 rc = of_address_to_resource(op->node, 0, &res); 434 rc = of_address_to_resource(op->node, 0, &res);
434 if (rc) { 435 if (rc) {
435 dev_err(&op->dev, "invalid address\n"); 436 dev_err(&op->dev, "invalid address\n");
436 return -ENODEV; 437 goto err;
437 } 438 }
438
439 } else { 439 } else {
440 res.start = 0;
440 start = dcr_resource_start(op->node, 0); 441 start = dcr_resource_start(op->node, 0);
441 len = dcr_resource_len(op->node, 0); 442 drvdata->dcr_len = dcr_resource_len(op->node, 0);
442 dcr_host = dcr_map(op->node, start, len); 443 drvdata->dcr_host = dcr_map(op->node, start, drvdata->dcr_len);
443 if (!DCR_MAP_OK(dcr_host)) { 444 if (!DCR_MAP_OK(drvdata->dcr_host)) {
444 dev_err(&op->dev, "invalid address\n"); 445 dev_err(&op->dev, "invalid DCR address\n");
445 return -ENODEV; 446 goto err;
446 } 447 }
447 } 448 }
448 449
@@ -467,26 +468,12 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match)
467 if (of_find_property(op->node, "rotate-display", NULL)) 468 if (of_find_property(op->node, "rotate-display", NULL))
468 pdata.rotate_screen = 1; 469 pdata.rotate_screen = 1;
469 470
470 /* Allocate the driver data region */
471 drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
472 if (!drvdata) {
473 dev_err(&op->dev, "Couldn't allocate device private record\n");
474 return -ENOMEM;
475 }
476 dev_set_drvdata(&op->dev, drvdata); 471 dev_set_drvdata(&op->dev, drvdata);
472 return xilinxfb_assign(&op->dev, drvdata, res.start, &pdata);
477 473
478 if (tft_access) 474 err:
479 drvdata->flags |= PLB_ACCESS_FLAG; 475 kfree(drvdata);
480 476 return -ENODEV;
481 /* Arguments are passed based on the interface */
482 if (drvdata->flags & PLB_ACCESS_FLAG) {
483 return xilinxfb_assign(&op->dev, drvdata, res.start, &pdata);
484 } else {
485 drvdata->dcr_start = start;
486 drvdata->dcr_len = len;
487 drvdata->dcr_host = dcr_host;
488 return xilinxfb_assign(&op->dev, drvdata, 0, &pdata);
489 }
490} 477}
491 478
492static int __devexit xilinxfb_of_remove(struct of_device *op) 479static int __devexit xilinxfb_of_remove(struct of_device *op)