aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/omapfb/omapfb-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/omap2/omapfb/omapfb-sysfs.c')
-rw-r--r--drivers/video/omap2/omapfb/omapfb-sysfs.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb-sysfs.c b/drivers/video/omap2/omapfb/omapfb-sysfs.c
index 5179219128bd..dea1aa46a7db 100644
--- a/drivers/video/omap2/omapfb/omapfb-sysfs.c
+++ b/drivers/video/omap2/omapfb/omapfb-sysfs.c
@@ -64,7 +64,7 @@ static ssize_t store_rotate_type(struct device *dev,
64 if (rot_type == ofbi->rotation_type) 64 if (rot_type == ofbi->rotation_type)
65 goto out; 65 goto out;
66 66
67 if (ofbi->region.size) { 67 if (ofbi->region->size) {
68 r = -EBUSY; 68 r = -EBUSY;
69 goto out; 69 goto out;
70 } 70 }
@@ -408,7 +408,7 @@ static ssize_t show_size(struct device *dev,
408 struct fb_info *fbi = dev_get_drvdata(dev); 408 struct fb_info *fbi = dev_get_drvdata(dev);
409 struct omapfb_info *ofbi = FB2OFB(fbi); 409 struct omapfb_info *ofbi = FB2OFB(fbi);
410 410
411 return snprintf(buf, PAGE_SIZE, "%lu\n", ofbi->region.size); 411 return snprintf(buf, PAGE_SIZE, "%lu\n", ofbi->region->size);
412} 412}
413 413
414static ssize_t store_size(struct device *dev, struct device_attribute *attr, 414static ssize_t store_size(struct device *dev, struct device_attribute *attr,
@@ -416,6 +416,8 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr,
416{ 416{
417 struct fb_info *fbi = dev_get_drvdata(dev); 417 struct fb_info *fbi = dev_get_drvdata(dev);
418 struct omapfb_info *ofbi = FB2OFB(fbi); 418 struct omapfb_info *ofbi = FB2OFB(fbi);
419 struct omapfb2_device *fbdev = ofbi->fbdev;
420 struct omapfb2_mem_region *rg;
419 unsigned long size; 421 unsigned long size;
420 int r; 422 int r;
421 int i; 423 int i;
@@ -425,15 +427,30 @@ static ssize_t store_size(struct device *dev, struct device_attribute *attr,
425 if (!lock_fb_info(fbi)) 427 if (!lock_fb_info(fbi))
426 return -ENODEV; 428 return -ENODEV;
427 429
428 for (i = 0; i < ofbi->num_overlays; i++) { 430 rg = ofbi->region;
429 if (ofbi->overlays[i]->info.enabled) { 431
430 r = -EBUSY; 432 if (atomic_read(&rg->map_count)) {
431 goto out; 433 r = -EBUSY;
434 goto out;
435 }
436
437 for (i = 0; i < fbdev->num_fbs; i++) {
438 struct omapfb_info *ofbi2 = FB2OFB(fbdev->fbs[i]);
439 int j;
440
441 if (ofbi2->region != rg)
442 continue;
443
444 for (j = 0; j < ofbi2->num_overlays; j++) {
445 if (ofbi2->overlays[j]->info.enabled) {
446 r = -EBUSY;
447 goto out;
448 }
432 } 449 }
433 } 450 }
434 451
435 if (size != ofbi->region.size) { 452 if (size != ofbi->region->size) {
436 r = omapfb_realloc_fbmem(fbi, size, ofbi->region.type); 453 r = omapfb_realloc_fbmem(fbi, size, ofbi->region->type);
437 if (r) { 454 if (r) {
438 dev_err(dev, "realloc fbmem failed\n"); 455 dev_err(dev, "realloc fbmem failed\n");
439 goto out; 456 goto out;
@@ -453,7 +470,7 @@ static ssize_t show_phys(struct device *dev,
453 struct fb_info *fbi = dev_get_drvdata(dev); 470 struct fb_info *fbi = dev_get_drvdata(dev);
454 struct omapfb_info *ofbi = FB2OFB(fbi); 471 struct omapfb_info *ofbi = FB2OFB(fbi);
455 472
456 return snprintf(buf, PAGE_SIZE, "%0x\n", ofbi->region.paddr); 473 return snprintf(buf, PAGE_SIZE, "%0x\n", ofbi->region->paddr);
457} 474}
458 475
459static ssize_t show_virt(struct device *dev, 476static ssize_t show_virt(struct device *dev,
@@ -462,7 +479,7 @@ static ssize_t show_virt(struct device *dev,
462 struct fb_info *fbi = dev_get_drvdata(dev); 479 struct fb_info *fbi = dev_get_drvdata(dev);
463 struct omapfb_info *ofbi = FB2OFB(fbi); 480 struct omapfb_info *ofbi = FB2OFB(fbi);
464 481
465 return snprintf(buf, PAGE_SIZE, "%p\n", ofbi->region.vaddr); 482 return snprintf(buf, PAGE_SIZE, "%p\n", ofbi->region->vaddr);
466} 483}
467 484
468static struct device_attribute omapfb_attrs[] = { 485static struct device_attribute omapfb_attrs[] = {