Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* Re: [PATCH] fb: only enable console lock in fb for VGA console
From: Jun Nie @ 2012-09-29 10:46 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <CAGA24M+PmObK3ZJWvtNhBzxO4WkGk_xyveQiZNtZe7xGdHrbFw@mail.gmail.com>

2012/9/29 Benjamin Herrenschmidt <benh@kernel.crashing.org>:
> On Sat, 2012-09-29 at 14:03 +0800, Jun Nie wrote:
>
>> Hi Ben,
>>     Yes. If framebuffer console is disabled, I do not see any need to
>> hold console lock in FB. Please help indicate the risk if any. Thanks!
>
> Because there is no other lock left in the entire fbdev layer.. a lot of
> fbdev drivers have no locking of their own and rely on the console
> semaphore in more than one way.
>
> Ben.
>
How about to add another fb_mutex? FB driver can only hold it when
framebuffer console is disabled, while hold both when fb console is
enabled.


>> Jun
>> >> Signed-off-by: Jun Nie <njun@marvell.com>
>> >> ---
>> >>  drivers/video/arkfb.c                  |   11 +++++------
>> >>  drivers/video/aty/aty128fb.c           |   11 +++++------
>> >>  drivers/video/aty/atyfb_base.c         |   11 +++++------
>> >>  drivers/video/aty/radeon_pm.c          |    9 ++++-----
>> >>  drivers/video/chipsfb.c                |    8 ++++----
>> >>  drivers/video/da8xx-fb.c               |    9 ++++-----
>> >>  drivers/video/fb-puv3.c                |    9 ++++-----
>> >>  drivers/video/fbmem.c                  |   28 ++++++++++++++++++++++------
>> >>  drivers/video/fbsysfs.c                |   21 ++++++++++-----------
>> >>  drivers/video/geode/gxfb_core.c        |    9 ++++-----
>> >>  drivers/video/geode/lxfb_core.c        |    8 ++++----
>> >>  drivers/video/i740fb.c                 |   11 +++++------
>> >>  drivers/video/i810/i810_main.c         |    9 ++++-----
>> >>  drivers/video/jz4740_fb.c              |    9 ++++-----
>> >>  drivers/video/mx3fb.c                  |    9 ++++-----
>> >>  drivers/video/nvidia/nvidia.c          |    9 ++++-----
>> >>  drivers/video/ps3fb.c                  |   15 +++++++--------
>> >>  drivers/video/pxafb.c                  |    5 ++---
>> >>  drivers/video/s3fb.c                   |   15 +++++++--------
>> >>  drivers/video/savage/savagefb_driver.c |    9 ++++-----
>> >>  drivers/video/sh_mobile_lcdcfb.c       |   13 ++++++-------
>> >>  drivers/video/sm501fb.c                |    9 ++++-----
>> >>  drivers/video/tmiofb.c                 |   11 +++++------
>> >>  drivers/video/via/viafbdev.c           |    8 ++++----
>> >>  drivers/video/vt8623fb.c               |   11 +++++------
>> >>  drivers/video/xen-fbfront.c            |    5 ++---
>> >>  include/linux/fb.h                     |    2 ++
>> >>  27 files changed, 140 insertions(+), 144 deletions(-)
>> >>
>> >> diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
>> >> index 555dd4c..774d902 100644
>> >> --- a/drivers/video/arkfb.c
>> >> +++ b/drivers/video/arkfb.c
>> >> @@ -23,7 +23,6 @@
>> >>  #include <linux/svga.h>
>> >>  #include <linux/init.h>
>> >>  #include <linux/pci.h>
>> >> -#include <linux/console.h> /* Why should fb driver call console
>> >> functions? because console_lock() */
>> >>  #include <video/vga.h>
>> >>
>> >>  #ifdef CONFIG_MTRR
>> >> @@ -1124,12 +1123,12 @@ static int ark_pci_suspend (struct pci_dev*
>> >> dev, pm_message_t state)
>> >>
>> >>       dev_info(info->device, "suspend\n");
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       mutex_lock(&(par->open_lock));
>> >>
>> >>       if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
>> >>               mutex_unlock(&(par->open_lock));
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               return 0;
>> >>       }
>> >>
>> >> @@ -1140,7 +1139,7 @@ static int ark_pci_suspend (struct pci_dev* dev,
>> >> pm_message_t state)
>> >>       pci_set_power_state(dev, pci_choose_state(dev, state));
>> >>
>> >>       mutex_unlock(&(par->open_lock));
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> @@ -1155,7 +1154,7 @@ static int ark_pci_resume (struct pci_dev* dev)
>> >>
>> >>       dev_info(info->device, "resume\n");
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       mutex_lock(&(par->open_lock));
>> >>
>> >>       if (par->ref_count = 0)
>> >> @@ -1174,7 +1173,7 @@ static int ark_pci_resume (struct pci_dev* dev)
>> >>
>> >>  fail:
>> >>       mutex_unlock(&(par->open_lock));
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       return 0;
>> >>  }
>> >>  #else
>> >> diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
>> >> index 747442d..1c6b80b 100644
>> >> --- a/drivers/video/aty/aty128fb.c
>> >> +++ b/drivers/video/aty/aty128fb.c
>> >> @@ -60,7 +60,6 @@
>> >>  #include <linux/init.h>
>> >>  #include <linux/pci.h>
>> >>  #include <linux/ioport.h>
>> >> -#include <linux/console.h>
>> >>  #include <linux/backlight.h>
>> >>  #include <asm/io.h>
>> >>
>> >> @@ -1884,7 +1883,7 @@ static void aty128_early_resume(void *data)
>> >>               return;
>> >>       pci_restore_state(par->pdev);
>> >>       aty128_do_resume(par->pdev);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>  }
>> >>  #endif /* CONFIG_PPC_PMAC */
>> >>
>> >> @@ -2461,7 +2460,7 @@ static int aty128_pci_suspend(struct pci_dev
>> >> *pdev, pm_message_t state)
>> >>
>> >>       printk(KERN_DEBUG "aty128fb: suspending...\n");
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>
>> >>       fb_set_suspend(info, 1);
>> >>
>> >> @@ -2493,7 +2492,7 @@ static int aty128_pci_suspend(struct pci_dev
>> >> *pdev, pm_message_t state)
>> >>       if (state.event != PM_EVENT_ON)
>> >>               aty128_set_suspend(par, 1);
>> >>
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       pdev->dev.power.power_state = state;
>> >>
>> >> @@ -2550,9 +2549,9 @@ static int aty128_pci_resume(struct pci_dev *pdev)
>> >>  {
>> >>       int rc;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       rc = aty128_do_resume(pdev);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return rc;
>> >>  }
>> >> diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
>> >> index 3f2e8c1..9bb15ab 100644
>> >> --- a/drivers/video/aty/atyfb_base.c
>> >> +++ b/drivers/video/aty/atyfb_base.c
>> >> @@ -58,7 +58,6 @@
>> >>  #include <linux/slab.h>
>> >>  #include <linux/vmalloc.h>
>> >>  #include <linux/delay.h>
>> >> -#include <linux/console.h>
>> >>  #include <linux/fb.h>
>> >>  #include <linux/init.h>
>> >>  #include <linux/pci.h>
>> >> @@ -2065,7 +2064,7 @@ static int atyfb_pci_suspend(struct pci_dev
>> >> *pdev, pm_message_t state)
>> >>       if (state.event = pdev->dev.power.power_state.event)
>> >>               return 0;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>
>> >>       fb_set_suspend(info, 1);
>> >>
>> >> @@ -2093,14 +2092,14 @@ static int atyfb_pci_suspend(struct pci_dev
>> >> *pdev, pm_message_t state)
>> >>               par->lock_blank = 0;
>> >>               atyfb_blank(FB_BLANK_UNBLANK, info);
>> >>               fb_set_suspend(info, 0);
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               return -EIO;
>> >>       }
>> >>  #else
>> >>       pci_set_power_state(pdev, pci_choose_state(pdev, state));
>> >>  #endif
>> >>
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       pdev->dev.power.power_state = state;
>> >>
>> >> @@ -2129,7 +2128,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
>> >>       if (pdev->dev.power.power_state.event = PM_EVENT_ON)
>> >>               return 0;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>
>> >>       /*
>> >>        * PCI state will have been restored by the core, so
>> >> @@ -2157,7 +2156,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
>> >>       par->lock_blank = 0;
>> >>       atyfb_blank(FB_BLANK_UNBLANK, info);
>> >>
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       pdev->dev.power.power_state = PMSG_ON;
>> >>
>> >> diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
>> >> index 92bda58..a2f07da 100644
>> >> --- a/drivers/video/aty/radeon_pm.c
>> >> +++ b/drivers/video/aty/radeon_pm.c
>> >> @@ -16,7 +16,6 @@
>> >>
>> >>  #include "radeonfb.h"
>> >>
>> >> -#include <linux/console.h>
>> >>  #include <linux/agp_backend.h>
>> >>
>> >>  #ifdef CONFIG_PPC_PMAC
>> >> @@ -2626,7 +2625,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev,
>> >> pm_message_t mesg)
>> >>               goto done;
>> >>       }
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>
>> >>       fb_set_suspend(info, 1);
>> >>
>> >> @@ -2690,7 +2689,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev,
>> >> pm_message_t mesg)
>> >>       if (rinfo->pm_mode & radeon_pm_d2)
>> >>               radeon_set_suspend(rinfo, 1);
>> >>
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>   done:
>> >>       pdev->dev.power.power_state = mesg;
>> >> @@ -2718,7 +2717,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
>> >>               if (!console_trylock())
>> >>                       return 0;
>> >>       } else
>> >> -             console_lock();
>> >> +             fb_console_lock();
>> >>
>> >>       printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n",
>> >>              pci_name(pdev), pdev->dev.power.power_state.event);
>> >> @@ -2783,7 +2782,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
>> >>       pdev->dev.power.power_state = PMSG_ON;
>> >>
>> >>   bail:
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return rc;
>> >>  }
>> >> diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
>> >> index cff742a..d50fa6b 100644
>> >> --- a/drivers/video/chipsfb.c
>> >> +++ b/drivers/video/chipsfb.c
>> >> @@ -460,10 +460,10 @@ static int chipsfb_pci_suspend(struct pci_dev
>> >> *pdev, pm_message_t state)
>> >>       if (!(state.event & PM_EVENT_SLEEP))
>> >>               goto done;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       chipsfb_blank(1, p);
>> >>       fb_set_suspend(p, 1);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>   done:
>> >>       pdev->dev.power.power_state = state;
>> >>       return 0;
>> >> @@ -473,10 +473,10 @@ static int chipsfb_pci_resume(struct pci_dev *pdev)
>> >>  {
>> >>          struct fb_info *p = pci_get_drvdata(pdev);
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(p, 0);
>> >>       chipsfb_blank(0, p);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       pdev->dev.power.power_state = PMSG_ON;
>> >>       return 0;
>> >> diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
>> >> index 7ae9d53..9a36bbc 100644
>> >> --- a/drivers/video/da8xx-fb.c
>> >> +++ b/drivers/video/da8xx-fb.c
>> >> @@ -29,7 +29,6 @@
>> >>  #include <linux/interrupt.h>
>> >>  #include <linux/clk.h>
>> >>  #include <linux/cpufreq.h>
>> >> -#include <linux/console.h>
>> >>  #include <linux/spinlock.h>
>> >>  #include <linux/slab.h>
>> >>  #include <linux/delay.h>
>> >> @@ -1406,14 +1405,14 @@ static int fb_suspend(struct platform_device
>> >> *dev, pm_message_t state)
>> >>       struct fb_info *info = platform_get_drvdata(dev);
>> >>       struct da8xx_fb_par *par = info->par;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       if (par->panel_power_ctrl)
>> >>               par->panel_power_ctrl(0);
>> >>
>> >>       fb_set_suspend(info, 1);
>> >>       lcd_disable_raster();
>> >>       clk_disable(par->lcdc_clk);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> @@ -1422,7 +1421,7 @@ static int fb_resume(struct platform_device *dev)
>> >>       struct fb_info *info = platform_get_drvdata(dev);
>> >>       struct da8xx_fb_par *par = info->par;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       clk_enable(par->lcdc_clk);
>> >>       lcd_enable_raster();
>> >>
>> >> @@ -1430,7 +1429,7 @@ static int fb_resume(struct platform_device *dev)
>> >>               par->panel_power_ctrl(1);
>> >>
>> >>       fb_set_suspend(info, 0);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
>> >> index 60a787f..87c8c4e 100644
>> >> --- a/drivers/video/fb-puv3.c
>> >> +++ b/drivers/video/fb-puv3.c
>> >> @@ -17,7 +17,6 @@
>> >>  #include <linux/clk.h>
>> >>  #include <linux/fb.h>
>> >>  #include <linux/init.h>
>> >> -#include <linux/console.h>
>> >>
>> >>  #include <asm/sizes.h>
>> >>  #include <mach/hardware.h>
>> >> @@ -759,7 +758,7 @@ static int unifb_resume(struct platform_device *dev)
>> >>       if (dev->dev.power.power_state.event = PM_EVENT_ON)
>> >>               return 0;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>
>> >>       if (dev->dev.power.power_state.event = PM_EVENT_SUSPEND) {
>> >>               writel(unifb_regs[0], UDE_FSA);
>> >> @@ -775,7 +774,7 @@ static int unifb_resume(struct platform_device *dev)
>> >>       }
>> >>       dev->dev.power.power_state = PMSG_ON;
>> >>
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return rc;
>> >>  }
>> >> @@ -804,11 +803,11 @@ static int unifb_suspend(struct platform_device
>> >> *dev, pm_message_t mesg)
>> >>               goto done;
>> >>       }
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>
>> >>       /* do nothing... */
>> >>
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>  done:
>> >>       dev->dev.power.power_state = mesg;
>> >> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
>> >> index 0dff12a..c2d4627 100644
>> >> --- a/drivers/video/fbmem.c
>> >> +++ b/drivers/video/fbmem.c
>> >> @@ -85,6 +85,22 @@ EXPORT_SYMBOL(lock_fb_info);
>> >>   * Helpers
>> >>   */
>> >>
>> >> +void fb_console_lock(void)
>> >> +{
>> >> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE
>> >> +     console_lock();
>> >> +#endif
>> >> +}
>> >> +EXPORT_SYMBOL(fb_console_lock);
>> >> +
>> >> +void fb_console_unlock(void)
>> >> +{
>> >> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE
>> >> +     console_unlock();
>> >> +#endif
>> >> +}
>> >> +EXPORT_SYMBOL(fb_console_unlock);
>> >> +
>> >>  int fb_get_color_depth(struct fb_var_screeninfo *var,
>> >>                      struct fb_fix_screeninfo *fix)
>> >>  {
>> >> @@ -1101,11 +1117,11 @@ static long do_fb_ioctl(struct fb_info *info,
>> >> unsigned int cmd,
>> >>                       return -EFAULT;
>> >>               if (!lock_fb_info(info))
>> >>                       return -ENODEV;
>> >> -             console_lock();
>> >> +             fb_console_lock();
>> >>               info->flags |= FBINFO_MISC_USEREVENT;
>> >>               ret = fb_set_var(info, &var);
>> >>               info->flags &= ~FBINFO_MISC_USEREVENT;
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               unlock_fb_info(info);
>> >>               if (!ret && copy_to_user(argp, &var, sizeof(var)))
>> >>                       ret = -EFAULT;
>> >> @@ -1137,9 +1153,9 @@ static long do_fb_ioctl(struct fb_info *info,
>> >> unsigned int cmd,
>> >>                       return -EFAULT;
>> >>               if (!lock_fb_info(info))
>> >>                       return -ENODEV;
>> >> -             console_lock();
>> >> +             fb_console_lock();
>> >>               ret = fb_pan_display(info, &var);
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               unlock_fb_info(info);
>> >>               if (ret = 0 && copy_to_user(argp, &var, sizeof(var)))
>> >>                       return -EFAULT;
>> >> @@ -1184,11 +1200,11 @@ static long do_fb_ioctl(struct fb_info *info,
>> >> unsigned int cmd,
>> >>       case FBIOBLANK:
>> >>               if (!lock_fb_info(info))
>> >>                       return -ENODEV;
>> >> -             console_lock();
>> >> +             fb_console_lock();
>> >>               info->flags |= FBINFO_MISC_USEREVENT;
>> >>               ret = fb_blank(info, arg);
>> >>               info->flags &= ~FBINFO_MISC_USEREVENT;
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               unlock_fb_info(info);
>> >>               break;
>> >>       default:
>> >> diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
>> >> index a55e366..976d8f5 100644
>> >> --- a/drivers/video/fbsysfs.c
>> >> +++ b/drivers/video/fbsysfs.c
>> >> @@ -18,7 +18,6 @@
>> >>  #include <linux/kernel.h>
>> >>  #include <linux/slab.h>
>> >>  #include <linux/fb.h>
>> >> -#include <linux/console.h>
>> >>  #include <linux/module.h>
>> >>
>> >>  #define FB_SYSFS_FLAG_ATTR 1
>> >> @@ -92,11 +91,11 @@ static int activate(struct fb_info *fb_info,
>> >> struct fb_var_screeninfo *var)
>> >>       int err;
>> >>
>> >>       var->activate |= FB_ACTIVATE_FORCE;
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_info->flags |= FBINFO_MISC_USEREVENT;
>> >>       err = fb_set_var(fb_info, var);
>> >>       fb_info->flags &= ~FBINFO_MISC_USEREVENT;
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       if (err)
>> >>               return err;
>> >>       return 0;
>> >> @@ -177,7 +176,7 @@ static ssize_t store_modes(struct device *device,
>> >>       if (i * sizeof(struct fb_videomode) != count)
>> >>               return -EINVAL;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       list_splice(&fb_info->modelist, &old_list);
>> >>       fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
>> >>                                &fb_info->modelist);
>> >> @@ -187,7 +186,7 @@ static ssize_t store_modes(struct device *device,
>> >>       } else
>> >>               fb_destroy_modelist(&old_list);
>> >>
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> @@ -303,11 +302,11 @@ static ssize_t store_blank(struct device *device,
>> >>       char *last = NULL;
>> >>       int err;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_info->flags |= FBINFO_MISC_USEREVENT;
>> >>       err = fb_blank(fb_info, simple_strtoul(buf, &last, 0));
>> >>       fb_info->flags &= ~FBINFO_MISC_USEREVENT;
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       if (err < 0)
>> >>               return err;
>> >>       return count;
>> >> @@ -366,9 +365,9 @@ static ssize_t store_pan(struct device *device,
>> >>               return -EINVAL;
>> >>       var.yoffset = simple_strtoul(last, &last, 0);
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       err = fb_pan_display(fb_info, &var);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       if (err < 0)
>> >>               return err;
>> >> @@ -403,9 +402,9 @@ static ssize_t store_fbstate(struct device *device,
>> >>
>> >>       if (!lock_fb_info(fb_info))
>> >>               return -ENODEV;
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(fb_info, (int)state);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       unlock_fb_info(fb_info);
>> >>
>> >>       return count;
>> >> diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
>> >> index b4f19db..ba7dd0a 100644
>> >> --- a/drivers/video/geode/gxfb_core.c
>> >> +++ b/drivers/video/geode/gxfb_core.c
>> >> @@ -27,7 +27,6 @@
>> >>  #include <linux/mm.h>
>> >>  #include <linux/delay.h>
>> >>  #include <linux/fb.h>
>> >> -#include <linux/console.h>
>> >>  #include <linux/suspend.h>
>> >>  #include <linux/init.h>
>> >>  #include <linux/pci.h>
>> >> @@ -344,10 +343,10 @@ static int gxfb_suspend(struct pci_dev *pdev,
>> >> pm_message_t state)
>> >>       struct fb_info *info = pci_get_drvdata(pdev);
>> >>
>> >>       if (state.event = PM_EVENT_SUSPEND) {
>> >> -             console_lock();
>> >> +             fb_console_lock();
>> >>               gx_powerdown(info);
>> >>               fb_set_suspend(info, 1);
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>       }
>> >>
>> >>       /* there's no point in setting PCI states; we emulate PCI, so
>> >> @@ -361,7 +360,7 @@ static int gxfb_resume(struct pci_dev *pdev)
>> >>       struct fb_info *info = pci_get_drvdata(pdev);
>> >>       int ret;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       ret = gx_powerup(info);
>> >>       if (ret) {
>> >>               printk(KERN_ERR "gxfb:  power up failed!\n");
>> >> @@ -369,7 +368,7 @@ static int gxfb_resume(struct pci_dev *pdev)
>> >>       }
>> >>
>> >>       fb_set_suspend(info, 0);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       return 0;
>> >>  }
>> >>  #endif
>> >> diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
>> >> index 416851c..5341bf1 100644
>> >> --- a/drivers/video/geode/lxfb_core.c
>> >> +++ b/drivers/video/geode/lxfb_core.c
>> >> @@ -465,10 +465,10 @@ static int lxfb_suspend(struct pci_dev *pdev,
>> >> pm_message_t state)
>> >>       struct fb_info *info = pci_get_drvdata(pdev);
>> >>
>> >>       if (state.event = PM_EVENT_SUSPEND) {
>> >> -             console_lock();
>> >> +             fb_console_lock();
>> >>               lx_powerdown(info);
>> >>               fb_set_suspend(info, 1);
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>       }
>> >>
>> >>       /* there's no point in setting PCI states; we emulate PCI, so
>> >> @@ -482,7 +482,7 @@ static int lxfb_resume(struct pci_dev *pdev)
>> >>       struct fb_info *info = pci_get_drvdata(pdev);
>> >>       int ret;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       ret = lx_powerup(info);
>> >>       if (ret) {
>> >>               printk(KERN_ERR "lxfb:  power up failed!\n");
>> >> @@ -490,7 +490,7 @@ static int lxfb_resume(struct pci_dev *pdev)
>> >>       }
>> >>
>> >>       fb_set_suspend(info, 0);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       return 0;
>> >>  }
>> >>  #else
>> >> diff --git a/drivers/video/i740fb.c b/drivers/video/i740fb.c
>> >> index ff3f880..b3fe538 100644
>> >> --- a/drivers/video/i740fb.c
>> >> +++ b/drivers/video/i740fb.c
>> >> @@ -24,7 +24,6 @@
>> >>  #include <linux/pci_ids.h>
>> >>  #include <linux/i2c.h>
>> >>  #include <linux/i2c-algo-bit.h>
>> >> -#include <linux/console.h>
>> >>  #include <video/vga.h>
>> >>
>> >>  #ifdef CONFIG_MTRR
>> >> @@ -1210,13 +1209,13 @@ static int i740fb_suspend(struct pci_dev *dev,
>> >> pm_message_t state)
>> >>       if (state.event = PM_EVENT_FREEZE || state.event = PM_EVENT_PRETHAW)
>> >>               return 0;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       mutex_lock(&(par->open_lock));
>> >>
>> >>       /* do nothing if framebuffer is not active */
>> >>       if (par->ref_count = 0) {
>> >>               mutex_unlock(&(par->open_lock));
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               return 0;
>> >>       }
>> >>
>> >> @@ -1227,7 +1226,7 @@ static int i740fb_suspend(struct pci_dev *dev,
>> >> pm_message_t state)
>> >>       pci_set_power_state(dev, pci_choose_state(dev, state));
>> >>
>> >>       mutex_unlock(&(par->open_lock));
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> @@ -1237,7 +1236,7 @@ static int i740fb_resume(struct pci_dev *dev)
>> >>       struct fb_info *info = pci_get_drvdata(dev);
>> >>       struct i740fb_par *par = info->par;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       mutex_lock(&(par->open_lock));
>> >>
>> >>       if (par->ref_count = 0)
>> >> @@ -1253,7 +1252,7 @@ static int i740fb_resume(struct pci_dev *dev)
>> >>
>> >>  fail:
>> >>       mutex_unlock(&(par->open_lock));
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       return 0;
>> >>  }
>> >>  #else
>> >> diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
>> >> index b83f361..84fe1ed 100644
>> >> --- a/drivers/video/i810/i810_main.c
>> >> +++ b/drivers/video/i810/i810_main.c
>> >> @@ -40,7 +40,6 @@
>> >>  #include <linux/pci_ids.h>
>> >>  #include <linux/resource.h>
>> >>  #include <linux/unistd.h>
>> >> -#include <linux/console.h>
>> >>
>> >>  #include <asm/io.h>
>> >>  #include <asm/div64.h>
>> >> @@ -1574,7 +1573,7 @@ static int i810fb_suspend(struct pci_dev *dev,
>> >> pm_message_t mesg)
>> >>               return 0;
>> >>       }
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(info, 1);
>> >>
>> >>       if (info->fbops->fb_sync)
>> >> @@ -1587,7 +1586,7 @@ static int i810fb_suspend(struct pci_dev *dev,
>> >> pm_message_t mesg)
>> >>       pci_save_state(dev);
>> >>       pci_disable_device(dev);
>> >>       pci_set_power_state(dev, pci_choose_state(dev, mesg));
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> @@ -1605,7 +1604,7 @@ static int i810fb_resume(struct pci_dev *dev)
>> >>               return 0;
>> >>       }
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       pci_set_power_state(dev, PCI_D0);
>> >>       pci_restore_state(dev);
>> >>
>> >> @@ -1621,7 +1620,7 @@ static int i810fb_resume(struct pci_dev *dev)
>> >>       fb_set_suspend (info, 0);
>> >>       info->fbops->fb_blank(VESA_NO_BLANKING, info);
>> >>  fail:
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       return 0;
>> >>  }
>> >>  /***********************************************************************
>> >> diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
>> >> index de36693..7e9301a 100644
>> >> --- a/drivers/video/jz4740_fb.c
>> >> +++ b/drivers/video/jz4740_fb.c
>> >> @@ -21,7 +21,6 @@
>> >>  #include <linux/clk.h>
>> >>  #include <linux/delay.h>
>> >>
>> >> -#include <linux/console.h>
>> >>  #include <linux/fb.h>
>> >>
>> >>  #include <linux/dma-mapping.h>
>> >> @@ -778,9 +777,9 @@ static int jzfb_suspend(struct device *dev)
>> >>  {
>> >>       struct jzfb *jzfb = dev_get_drvdata(dev);
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(jzfb->fb, 1);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       mutex_lock(&jzfb->lock);
>> >>       if (jzfb->is_enabled)
>> >> @@ -800,9 +799,9 @@ static int jzfb_resume(struct device *dev)
>> >>               jzfb_enable(jzfb);
>> >>       mutex_unlock(&jzfb->lock);
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(jzfb->fb, 0);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
>> >> index c89f8a8..da25fa1 100644
>> >> --- a/drivers/video/mx3fb.c
>> >> +++ b/drivers/video/mx3fb.c
>> >> @@ -23,7 +23,6 @@
>> >>  #include <linux/ioport.h>
>> >>  #include <linux/dma-mapping.h>
>> >>  #include <linux/dmaengine.h>
>> >> -#include <linux/console.h>
>> >>  #include <linux/clk.h>
>> >>  #include <linux/mutex.h>
>> >>
>> >> @@ -1204,9 +1203,9 @@ static int mx3fb_suspend(struct platform_device
>> >> *pdev, pm_message_t state)
>> >>       struct mx3fb_data *mx3fb = platform_get_drvdata(pdev);
>> >>       struct mx3fb_info *mx3_fbi = mx3fb->fbi->par;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(mx3fb->fbi, 1);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       if (mx3_fbi->blank = FB_BLANK_UNBLANK) {
>> >>               sdc_disable_channel(mx3_fbi);
>> >> @@ -1229,9 +1228,9 @@ static int mx3fb_resume(struct platform_device *pdev)
>> >>               sdc_set_brightness(mx3fb, mx3fb->backlight_level);
>> >>       }
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(mx3fb->fbi, 0);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
>> >> index fe13ac5..f47eb2a 100644
>> >> --- a/drivers/video/nvidia/nvidia.c
>> >> +++ b/drivers/video/nvidia/nvidia.c
>> >> @@ -19,7 +19,6 @@
>> >>  #include <linux/fb.h>
>> >>  #include <linux/init.h>
>> >>  #include <linux/pci.h>
>> >> -#include <linux/console.h>
>> >>  #include <linux/backlight.h>
>> >>  #ifdef CONFIG_MTRR
>> >>  #include <asm/mtrr.h>
>> >> @@ -1057,7 +1056,7 @@ static int nvidiafb_suspend(struct pci_dev *dev,
>> >> pm_message_t mesg)
>> >>
>> >>       if (mesg.event = PM_EVENT_PRETHAW)
>> >>               mesg.event = PM_EVENT_FREEZE;
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       par->pm_state = mesg.event;
>> >>
>> >>       if (mesg.event & PM_EVENT_SLEEP) {
>> >> @@ -1070,7 +1069,7 @@ static int nvidiafb_suspend(struct pci_dev *dev,
>> >> pm_message_t mesg)
>> >>       }
>> >>       dev->dev.power.power_state = mesg;
>> >>
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       return 0;
>> >>  }
>> >>
>> >> @@ -1079,7 +1078,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
>> >>       struct fb_info *info = pci_get_drvdata(dev);
>> >>       struct nvidia_par *par = info->par;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       pci_set_power_state(dev, PCI_D0);
>> >>
>> >>       if (par->pm_state != PM_EVENT_FREEZE) {
>> >> @@ -1097,7 +1096,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
>> >>       nvidiafb_blank(FB_BLANK_UNBLANK, info);
>> >>
>> >>  fail:
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       return 0;
>> >>  }
>> >>  #else
>> >> diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
>> >> index 213fbbc..cb2e174 100644
>> >> --- a/drivers/video/ps3fb.c
>> >> +++ b/drivers/video/ps3fb.c
>> >> @@ -23,7 +23,6 @@
>> >>  #include <linux/string.h>
>> >>  #include <linux/mm.h>
>> >>  #include <linux/interrupt.h>
>> >> -#include <linux/console.h>
>> >>  #include <linux/ioctl.h>
>> >>  #include <linux/kthread.h>
>> >>  #include <linux/freezer.h>
>> >> @@ -515,7 +514,7 @@ static int ps3fb_release(struct fb_info *info, int user)
>> >>                       atomic_set(&ps3fb.ext_flip, 0);
>> >>                       if (console_trylock()) {
>> >>                               ps3fb_sync(info, 0);    /* single buffer */
>> >> -                             console_unlock();
>> >> +                             fb_console_unlock();
>> >>                       }
>> >>               }
>> >>       }
>> >> @@ -830,14 +829,14 @@ static int ps3fb_ioctl(struct fb_info *info,
>> >> unsigned int cmd,
>> >>                       if (vmode) {
>> >>                               var = info->var;
>> >>                               fb_videomode_to_var(&var, vmode);
>> >> -                             console_lock();
>> >> +                             fb_console_lock();
>> >>                               info->flags |= FBINFO_MISC_USEREVENT;
>> >>                               /* Force, in case only special bits changed */
>> >>                               var.activate |= FB_ACTIVATE_FORCE;
>> >>                               par->new_mode_id = val;
>> >>                               retval = fb_set_var(info, &var);
>> >>                               info->flags &= ~FBINFO_MISC_USEREVENT;
>> >> -                             console_unlock();
>> >> +                             fb_console_unlock();
>> >>                       }
>> >>                       break;
>> >>               }
>> >> @@ -881,9 +880,9 @@ static int ps3fb_ioctl(struct fb_info *info,
>> >> unsigned int cmd,
>> >>                       break;
>> >>
>> >>               dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
>> >> -             console_lock();
>> >> +             fb_console_lock();
>> >>               retval = ps3fb_sync(info, val);
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               break;
>> >>
>> >>       default:
>> >> @@ -903,9 +902,9 @@ static int ps3fbd(void *arg)
>> >>               set_current_state(TASK_INTERRUPTIBLE);
>> >>               if (ps3fb.is_kicked) {
>> >>                       ps3fb.is_kicked = 0;
>> >> -                     console_lock();
>> >> +                     fb_console_lock();
>> >>                       ps3fb_sync(info, 0);    /* single buffer */
>> >> -                     console_unlock();
>> >> +                     fb_console_unlock();
>> >>               }
>> >>               schedule();
>> >>       }
>> >> diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
>> >> index 3f90255..a1af212 100644
>> >> --- a/drivers/video/pxafb.c
>> >> +++ b/drivers/video/pxafb.c
>> >> @@ -54,7 +54,6 @@
>> >>  #include <linux/mutex.h>
>> >>  #include <linux/kthread.h>
>> >>  #include <linux/freezer.h>
>> >> -#include <linux/console.h>
>> >>
>> >>  #include <mach/hardware.h>
>> >>  #include <asm/io.h>
>> >> @@ -733,9 +732,9 @@ static int overlayfb_open(struct fb_info *info, int user)
>> >>
>> >>       if (ofb->usage++ = 0) {
>> >>               /* unblank the base framebuffer */
>> >> -             console_lock();
>> >> +             fb_console_lock();
>> >>               fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>       }
>> >>
>> >>       return 0;
>> >> diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
>> >> index 1d00736..7759c82 100644
>> >> --- a/drivers/video/s3fb.c
>> >> +++ b/drivers/video/s3fb.c
>> >> @@ -22,7 +22,6 @@
>> >>  #include <linux/svga.h>
>> >>  #include <linux/init.h>
>> >>  #include <linux/pci.h>
>> >> -#include <linux/console.h> /* Why should fb driver call console
>> >> functions? because console_lock() */
>> >>  #include <video/vga.h>
>> >>
>> >>  #include <linux/i2c.h>
>> >> @@ -1445,12 +1444,12 @@ static int s3_pci_suspend(struct pci_dev* dev,
>> >> pm_message_t state)
>> >>
>> >>       dev_info(info->device, "suspend\n");
>> >>
>> >> -     console_lock();
>> >> +     fb_fb_console_lock();
>> >>       mutex_lock(&(par->open_lock));
>> >>
>> >>       if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
>> >>               mutex_unlock(&(par->open_lock));
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               return 0;
>> >>       }
>> >>
>> >> @@ -1461,7 +1460,7 @@ static int s3_pci_suspend(struct pci_dev* dev,
>> >> pm_message_t state)
>> >>       pci_set_power_state(dev, pci_choose_state(dev, state));
>> >>
>> >>       mutex_unlock(&(par->open_lock));
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> @@ -1477,12 +1476,12 @@ static int s3_pci_resume(struct pci_dev* dev)
>> >>
>> >>       dev_info(info->device, "resume\n");
>> >>
>> >> -     console_lock();
>> >> +     fb_fb_console_lock();
>> >>       mutex_lock(&(par->open_lock));
>> >>
>> >>       if (par->ref_count = 0) {
>> >>               mutex_unlock(&(par->open_lock));
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               return 0;
>> >>       }
>> >>
>> >> @@ -1491,7 +1490,7 @@ static int s3_pci_resume(struct pci_dev* dev)
>> >>       err = pci_enable_device(dev);
>> >>       if (err) {
>> >>               mutex_unlock(&(par->open_lock));
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               dev_err(info->device, "error %d enabling device for resume\n", err);
>> >>               return err;
>> >>       }
>> >> @@ -1501,7 +1500,7 @@ static int s3_pci_resume(struct pci_dev* dev)
>> >>       fb_set_suspend(info, 0);
>> >>
>> >>       mutex_unlock(&(par->open_lock));
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> diff --git a/drivers/video/savage/savagefb_driver.c
>> >> b/drivers/video/savage/savagefb_driver.c
>> >> index 0d0f52c..bf64221 100644
>> >> --- a/drivers/video/savage/savagefb_driver.c
>> >> +++ b/drivers/video/savage/savagefb_driver.c
>> >> @@ -51,7 +51,6 @@
>> >>  #include <linux/fb.h>
>> >>  #include <linux/pci.h>
>> >>  #include <linux/init.h>
>> >> -#include <linux/console.h>
>> >>
>> >>  #include <asm/io.h>
>> >>  #include <asm/irq.h>
>> >> @@ -2391,7 +2390,7 @@ static int savagefb_suspend(struct pci_dev *dev,
>> >> pm_message_t mesg)
>> >>       if (mesg.event = PM_EVENT_FREEZE)
>> >>               return 0;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(info, 1);
>> >>
>> >>       if (info->fbops->fb_sync)
>> >> @@ -2403,7 +2402,7 @@ static int savagefb_suspend(struct pci_dev *dev,
>> >> pm_message_t mesg)
>> >>       pci_save_state(dev);
>> >>       pci_disable_device(dev);
>> >>       pci_set_power_state(dev, pci_choose_state(dev, mesg));
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> @@ -2427,7 +2426,7 @@ static int savagefb_resume(struct pci_dev* dev)
>> >>               return 0;
>> >>       }
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>
>> >>       pci_set_power_state(dev, PCI_D0);
>> >>       pci_restore_state(dev);
>> >> @@ -2441,7 +2440,7 @@ static int savagefb_resume(struct pci_dev* dev)
>> >>       savagefb_set_par(info);
>> >>       fb_set_suspend(info, 0);
>> >>       savagefb_blank(FB_BLANK_UNBLANK, info);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
>> >> index 699487c..2bc1119 100644
>> >> --- a/drivers/video/sh_mobile_lcdcfb.c
>> >> +++ b/drivers/video/sh_mobile_lcdcfb.c
>> >> @@ -11,7 +11,6 @@
>> >>  #include <linux/atomic.h>
>> >>  #include <linux/backlight.h>
>> >>  #include <linux/clk.h>
>> >> -#include <linux/console.h>
>> >>  #include <linux/ctype.h>
>> >>  #include <linux/dma-mapping.h>
>> >>  #include <linux/delay.h>
>> >> @@ -575,7 +574,7 @@ static int sh_mobile_lcdc_display_notify(struct
>> >> sh_mobile_lcdc_chan *ch,
>> >>       case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT:
>> >>               /* HDMI plug in */
>> >>               if (lock_fb_info(info)) {
>> >> -                     console_lock();
>> >> +                     fb_console_lock();
>> >>
>> >>                       ch->display.width = monspec->max_x * 10;
>> >>                       ch->display.height = monspec->max_y * 10;
>> >> @@ -594,7 +593,7 @@ static int sh_mobile_lcdc_display_notify(struct
>> >> sh_mobile_lcdc_chan *ch,
>> >>                               fb_set_suspend(info, 0);
>> >>                       }
>> >>
>> >> -                     console_unlock();
>> >> +                     fb_console_unlock();
>> >>                       unlock_fb_info(info);
>> >>               }
>> >>               break;
>> >> @@ -602,9 +601,9 @@ static int sh_mobile_lcdc_display_notify(struct
>> >> sh_mobile_lcdc_chan *ch,
>> >>       case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT:
>> >>               /* HDMI disconnect */
>> >>               if (lock_fb_info(info)) {
>> >> -                     console_lock();
>> >> +                     fb_console_lock();
>> >>                       fb_set_suspend(info, 1);
>> >> -                     console_unlock();
>> >> +                     fb_console_unlock();
>> >>                       unlock_fb_info(info);
>> >>               }
>> >>               break;
>> >> @@ -1934,9 +1933,9 @@ static int sh_mobile_lcdc_release(struct fb_info
>> >> *info, int user)
>> >>
>> >>       /* Nothing to reconfigure, when called from fbcon */
>> >>       if (user) {
>> >> -             console_lock();
>> >> +             fb_console_lock();
>> >>               sh_mobile_fb_reconfig(info);
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>       }
>> >>
>> >>       mutex_unlock(&ch->open_lock);
>> >> diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
>> >> index 3690eff..536f922 100644
>> >> --- a/drivers/video/sm501fb.c
>> >> +++ b/drivers/video/sm501fb.c
>> >> @@ -28,7 +28,6 @@
>> >>  #include <linux/wait.h>
>> >>  #include <linux/platform_device.h>
>> >>  #include <linux/clk.h>
>> >> -#include <linux/console.h>
>> >>  #include <linux/io.h>
>> >>
>> >>  #include <asm/uaccess.h>
>> >> @@ -2104,9 +2103,9 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info,
>> >>
>> >>       /* tell console/fb driver we are suspending */
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(fbi, 1);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       /* backup copies in case chip is powered down over suspend */
>> >>
>> >> @@ -2163,9 +2162,9 @@ static void sm501fb_resume_fb(struct sm501fb_info *info,
>> >>               memcpy_toio(par->cursor.k_addr, par->store_cursor,
>> >>                           par->cursor.size);
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(fbi, 0);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       vfree(par->store_fb);
>> >>       vfree(par->store_cursor);
>> >> diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c
>> >> index 8e4a446..e266b6b 100644
>> >> --- a/drivers/video/tmiofb.c
>> >> +++ b/drivers/video/tmiofb.c
>> >> @@ -25,8 +25,7 @@
>> >>  #include <linux/fb.h>
>> >>  #include <linux/interrupt.h>
>> >>  #include <linux/delay.h>
>> >> -/* Why should fb driver call console functions? because console_lock() */
>> >> -#include <linux/console.h>
>> >> +/* Why should fb driver call console functions? because fb_console_lock() */
>> >>  #include <linux/mfd/core.h>
>> >>  #include <linux/mfd/tmio.h>
>> >>  #include <linux/uaccess.h>
>> >> @@ -938,7 +937,7 @@ static int tmiofb_suspend(struct platform_device
>> >> *dev, pm_message_t state)
>> >>       const struct mfd_cell *cell = mfd_get_cell(dev);
>> >>       int retval = 0;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>
>> >>       fb_set_suspend(info, 1);
>> >>
>> >> @@ -959,7 +958,7 @@ static int tmiofb_suspend(struct platform_device
>> >> *dev, pm_message_t state)
>> >>       if (cell->suspend)
>> >>               retval = cell->suspend(dev);
>> >>
>> >> -     console_unlock();
>> >> +     fb_fb_console_unlock();
>> >>
>> >>       return retval;
>> >>  }
>> >> @@ -970,7 +969,7 @@ static int tmiofb_resume(struct platform_device *dev)
>> >>       const struct mfd_cell *cell = mfd_get_cell(dev);
>> >>       int retval = 0;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>
>> >>       if (cell->resume) {
>> >>               retval = cell->resume(dev);
>> >> @@ -986,7 +985,7 @@ static int tmiofb_resume(struct platform_device *dev)
>> >>
>> >>       fb_set_suspend(info, 0);
>> >>  out:
>> >> -     console_unlock();
>> >> +     fb_fb_console_unlock();
>> >>       return retval;
>> >>  }
>> >>  #else
>> >> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
>> >> index c80e770..d36b173 100644
>> >> --- a/drivers/video/via/viafbdev.c
>> >> +++ b/drivers/video/via/viafbdev.c
>> >> @@ -1698,17 +1698,17 @@ static int parse_mode(const char *str, u32
>> >> devices, u32 *xres, u32 *yres)
>> >>  #ifdef CONFIG_PM
>> >>  static int viafb_suspend(void *unused)
>> >>  {
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       fb_set_suspend(viafbinfo, 1);
>> >>       viafb_sync(viafbinfo);
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >>
>> >>  static int viafb_resume(void *unused)
>> >>  {
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       if (viaparinfo->shared->vdev->engine_mmio)
>> >>               viafb_reset_engine(viaparinfo);
>> >>       viafb_set_par(viafbinfo);
>> >> @@ -1716,7 +1716,7 @@ static int viafb_resume(void *unused)
>> >>               viafb_set_par(viafbinfo1);
>> >>       fb_set_suspend(viafbinfo, 0);
>> >>
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       return 0;
>> >>  }
>> >>
>> >> diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
>> >> index 4e74d26..cb48d4d 100644
>> >> --- a/drivers/video/vt8623fb.c
>> >> +++ b/drivers/video/vt8623fb.c
>> >> @@ -23,7 +23,6 @@
>> >>  #include <linux/svga.h>
>> >>  #include <linux/init.h>
>> >>  #include <linux/pci.h>
>> >> -#include <linux/console.h> /* Why should fb driver call console
>> >> functions? because console_lock() */
>> >>  #include <video/vga.h>
>> >>
>> >>  #ifdef CONFIG_MTRR
>> >> @@ -845,12 +844,12 @@ static int vt8623_pci_suspend(struct pci_dev*
>> >> dev, pm_message_t state)
>> >>
>> >>       dev_info(info->device, "suspend\n");
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       mutex_lock(&(par->open_lock));
>> >>
>> >>       if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
>> >>               mutex_unlock(&(par->open_lock));
>> >> -             console_unlock();
>> >> +             fb_console_unlock();
>> >>               return 0;
>> >>       }
>> >>
>> >> @@ -861,7 +860,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev,
>> >> pm_message_t state)
>> >>       pci_set_power_state(dev, pci_choose_state(dev, state));
>> >>
>> >>       mutex_unlock(&(par->open_lock));
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> @@ -876,7 +875,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
>> >>
>> >>       dev_info(info->device, "resume\n");
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       mutex_lock(&(par->open_lock));
>> >>
>> >>       if (par->ref_count = 0)
>> >> @@ -895,7 +894,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
>> >>
>> >>  fail:
>> >>       mutex_unlock(&(par->open_lock));
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>
>> >>       return 0;
>> >>  }
>> >> diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
>> >> index b7f5173..770397e7 100644
>> >> --- a/drivers/video/xen-fbfront.c
>> >> +++ b/drivers/video/xen-fbfront.c
>> >> @@ -18,7 +18,6 @@
>> >>   * frame buffer.
>> >>   */
>> >>
>> >> -#include <linux/console.h>
>> >>  #include <linux/kernel.h>
>> >>  #include <linux/errno.h>
>> >>  #include <linux/fb.h>
>> >> @@ -495,12 +494,12 @@ xenfb_make_preferred_console(void)
>> >>       if (console_set_on_cmdline)
>> >>               return;
>> >>
>> >> -     console_lock();
>> >> +     fb_console_lock();
>> >>       for_each_console(c) {
>> >>               if (!strcmp(c->name, "tty") && c->index = 0)
>> >>                       break;
>> >>       }
>> >> -     console_unlock();
>> >> +     fb_console_unlock();
>> >>       if (c) {
>> >>               unregister_console(c);
>> >>               c->flags |= CON_CONSDEV;
>> >> diff --git a/include/linux/fb.h b/include/linux/fb.h
>> >> index ac3f1c6..7ae96ad 100644
>> >> --- a/include/linux/fb.h
>> >> +++ b/include/linux/fb.h
>> >> @@ -1021,6 +1021,8 @@ extern int fb_get_color_depth(struct
>> >> fb_var_screeninfo *var,
>> >>                             struct fb_fix_screeninfo *fix);
>> >>  extern int fb_get_options(char *name, char **option);
>> >>  extern int fb_new_modelist(struct fb_info *info);
>> >> +extern void fb_console_unlock(void);
>> >> +extern void fb_console_lock(void);
>> >>
>> >>  extern struct fb_info *registered_fb[FB_MAX];
>> >>  extern int num_registered_fb;
>> >
>> >
>
>

^ permalink raw reply

* Re: [PATCH] fb: only enable console lock in fb for VGA console
From: Benjamin Herrenschmidt @ 2012-09-29 10:43 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <CAGA24M+PmObK3ZJWvtNhBzxO4WkGk_xyveQiZNtZe7xGdHrbFw@mail.gmail.com>

On Sat, 2012-09-29 at 14:03 +0800, Jun Nie wrote:

> Hi Ben,
>     Yes. If framebuffer console is disabled, I do not see any need to
> hold console lock in FB. Please help indicate the risk if any. Thanks!

Because there is no other lock left in the entire fbdev layer.. a lot of
fbdev drivers have no locking of their own and rely on the console
semaphore in more than one way.

Ben.

> Jun
> >> Signed-off-by: Jun Nie <njun@marvell.com>
> >> ---
> >>  drivers/video/arkfb.c                  |   11 +++++------
> >>  drivers/video/aty/aty128fb.c           |   11 +++++------
> >>  drivers/video/aty/atyfb_base.c         |   11 +++++------
> >>  drivers/video/aty/radeon_pm.c          |    9 ++++-----
> >>  drivers/video/chipsfb.c                |    8 ++++----
> >>  drivers/video/da8xx-fb.c               |    9 ++++-----
> >>  drivers/video/fb-puv3.c                |    9 ++++-----
> >>  drivers/video/fbmem.c                  |   28 ++++++++++++++++++++++------
> >>  drivers/video/fbsysfs.c                |   21 ++++++++++-----------
> >>  drivers/video/geode/gxfb_core.c        |    9 ++++-----
> >>  drivers/video/geode/lxfb_core.c        |    8 ++++----
> >>  drivers/video/i740fb.c                 |   11 +++++------
> >>  drivers/video/i810/i810_main.c         |    9 ++++-----
> >>  drivers/video/jz4740_fb.c              |    9 ++++-----
> >>  drivers/video/mx3fb.c                  |    9 ++++-----
> >>  drivers/video/nvidia/nvidia.c          |    9 ++++-----
> >>  drivers/video/ps3fb.c                  |   15 +++++++--------
> >>  drivers/video/pxafb.c                  |    5 ++---
> >>  drivers/video/s3fb.c                   |   15 +++++++--------
> >>  drivers/video/savage/savagefb_driver.c |    9 ++++-----
> >>  drivers/video/sh_mobile_lcdcfb.c       |   13 ++++++-------
> >>  drivers/video/sm501fb.c                |    9 ++++-----
> >>  drivers/video/tmiofb.c                 |   11 +++++------
> >>  drivers/video/via/viafbdev.c           |    8 ++++----
> >>  drivers/video/vt8623fb.c               |   11 +++++------
> >>  drivers/video/xen-fbfront.c            |    5 ++---
> >>  include/linux/fb.h                     |    2 ++
> >>  27 files changed, 140 insertions(+), 144 deletions(-)
> >>
> >> diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
> >> index 555dd4c..774d902 100644
> >> --- a/drivers/video/arkfb.c
> >> +++ b/drivers/video/arkfb.c
> >> @@ -23,7 +23,6 @@
> >>  #include <linux/svga.h>
> >>  #include <linux/init.h>
> >>  #include <linux/pci.h>
> >> -#include <linux/console.h> /* Why should fb driver call console
> >> functions? because console_lock() */
> >>  #include <video/vga.h>
> >>
> >>  #ifdef CONFIG_MTRR
> >> @@ -1124,12 +1123,12 @@ static int ark_pci_suspend (struct pci_dev*
> >> dev, pm_message_t state)
> >>
> >>       dev_info(info->device, "suspend\n");
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       mutex_lock(&(par->open_lock));
> >>
> >>       if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
> >>               mutex_unlock(&(par->open_lock));
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               return 0;
> >>       }
> >>
> >> @@ -1140,7 +1139,7 @@ static int ark_pci_suspend (struct pci_dev* dev,
> >> pm_message_t state)
> >>       pci_set_power_state(dev, pci_choose_state(dev, state));
> >>
> >>       mutex_unlock(&(par->open_lock));
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> @@ -1155,7 +1154,7 @@ static int ark_pci_resume (struct pci_dev* dev)
> >>
> >>       dev_info(info->device, "resume\n");
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       mutex_lock(&(par->open_lock));
> >>
> >>       if (par->ref_count = 0)
> >> @@ -1174,7 +1173,7 @@ static int ark_pci_resume (struct pci_dev* dev)
> >>
> >>  fail:
> >>       mutex_unlock(&(par->open_lock));
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       return 0;
> >>  }
> >>  #else
> >> diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
> >> index 747442d..1c6b80b 100644
> >> --- a/drivers/video/aty/aty128fb.c
> >> +++ b/drivers/video/aty/aty128fb.c
> >> @@ -60,7 +60,6 @@
> >>  #include <linux/init.h>
> >>  #include <linux/pci.h>
> >>  #include <linux/ioport.h>
> >> -#include <linux/console.h>
> >>  #include <linux/backlight.h>
> >>  #include <asm/io.h>
> >>
> >> @@ -1884,7 +1883,7 @@ static void aty128_early_resume(void *data)
> >>               return;
> >>       pci_restore_state(par->pdev);
> >>       aty128_do_resume(par->pdev);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>  }
> >>  #endif /* CONFIG_PPC_PMAC */
> >>
> >> @@ -2461,7 +2460,7 @@ static int aty128_pci_suspend(struct pci_dev
> >> *pdev, pm_message_t state)
> >>
> >>       printk(KERN_DEBUG "aty128fb: suspending...\n");
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>
> >>       fb_set_suspend(info, 1);
> >>
> >> @@ -2493,7 +2492,7 @@ static int aty128_pci_suspend(struct pci_dev
> >> *pdev, pm_message_t state)
> >>       if (state.event != PM_EVENT_ON)
> >>               aty128_set_suspend(par, 1);
> >>
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       pdev->dev.power.power_state = state;
> >>
> >> @@ -2550,9 +2549,9 @@ static int aty128_pci_resume(struct pci_dev *pdev)
> >>  {
> >>       int rc;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       rc = aty128_do_resume(pdev);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return rc;
> >>  }
> >> diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
> >> index 3f2e8c1..9bb15ab 100644
> >> --- a/drivers/video/aty/atyfb_base.c
> >> +++ b/drivers/video/aty/atyfb_base.c
> >> @@ -58,7 +58,6 @@
> >>  #include <linux/slab.h>
> >>  #include <linux/vmalloc.h>
> >>  #include <linux/delay.h>
> >> -#include <linux/console.h>
> >>  #include <linux/fb.h>
> >>  #include <linux/init.h>
> >>  #include <linux/pci.h>
> >> @@ -2065,7 +2064,7 @@ static int atyfb_pci_suspend(struct pci_dev
> >> *pdev, pm_message_t state)
> >>       if (state.event = pdev->dev.power.power_state.event)
> >>               return 0;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>
> >>       fb_set_suspend(info, 1);
> >>
> >> @@ -2093,14 +2092,14 @@ static int atyfb_pci_suspend(struct pci_dev
> >> *pdev, pm_message_t state)
> >>               par->lock_blank = 0;
> >>               atyfb_blank(FB_BLANK_UNBLANK, info);
> >>               fb_set_suspend(info, 0);
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               return -EIO;
> >>       }
> >>  #else
> >>       pci_set_power_state(pdev, pci_choose_state(pdev, state));
> >>  #endif
> >>
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       pdev->dev.power.power_state = state;
> >>
> >> @@ -2129,7 +2128,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
> >>       if (pdev->dev.power.power_state.event = PM_EVENT_ON)
> >>               return 0;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>
> >>       /*
> >>        * PCI state will have been restored by the core, so
> >> @@ -2157,7 +2156,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
> >>       par->lock_blank = 0;
> >>       atyfb_blank(FB_BLANK_UNBLANK, info);
> >>
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       pdev->dev.power.power_state = PMSG_ON;
> >>
> >> diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
> >> index 92bda58..a2f07da 100644
> >> --- a/drivers/video/aty/radeon_pm.c
> >> +++ b/drivers/video/aty/radeon_pm.c
> >> @@ -16,7 +16,6 @@
> >>
> >>  #include "radeonfb.h"
> >>
> >> -#include <linux/console.h>
> >>  #include <linux/agp_backend.h>
> >>
> >>  #ifdef CONFIG_PPC_PMAC
> >> @@ -2626,7 +2625,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev,
> >> pm_message_t mesg)
> >>               goto done;
> >>       }
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>
> >>       fb_set_suspend(info, 1);
> >>
> >> @@ -2690,7 +2689,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev,
> >> pm_message_t mesg)
> >>       if (rinfo->pm_mode & radeon_pm_d2)
> >>               radeon_set_suspend(rinfo, 1);
> >>
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>   done:
> >>       pdev->dev.power.power_state = mesg;
> >> @@ -2718,7 +2717,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
> >>               if (!console_trylock())
> >>                       return 0;
> >>       } else
> >> -             console_lock();
> >> +             fb_console_lock();
> >>
> >>       printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n",
> >>              pci_name(pdev), pdev->dev.power.power_state.event);
> >> @@ -2783,7 +2782,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
> >>       pdev->dev.power.power_state = PMSG_ON;
> >>
> >>   bail:
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return rc;
> >>  }
> >> diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
> >> index cff742a..d50fa6b 100644
> >> --- a/drivers/video/chipsfb.c
> >> +++ b/drivers/video/chipsfb.c
> >> @@ -460,10 +460,10 @@ static int chipsfb_pci_suspend(struct pci_dev
> >> *pdev, pm_message_t state)
> >>       if (!(state.event & PM_EVENT_SLEEP))
> >>               goto done;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       chipsfb_blank(1, p);
> >>       fb_set_suspend(p, 1);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>   done:
> >>       pdev->dev.power.power_state = state;
> >>       return 0;
> >> @@ -473,10 +473,10 @@ static int chipsfb_pci_resume(struct pci_dev *pdev)
> >>  {
> >>          struct fb_info *p = pci_get_drvdata(pdev);
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(p, 0);
> >>       chipsfb_blank(0, p);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       pdev->dev.power.power_state = PMSG_ON;
> >>       return 0;
> >> diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
> >> index 7ae9d53..9a36bbc 100644
> >> --- a/drivers/video/da8xx-fb.c
> >> +++ b/drivers/video/da8xx-fb.c
> >> @@ -29,7 +29,6 @@
> >>  #include <linux/interrupt.h>
> >>  #include <linux/clk.h>
> >>  #include <linux/cpufreq.h>
> >> -#include <linux/console.h>
> >>  #include <linux/spinlock.h>
> >>  #include <linux/slab.h>
> >>  #include <linux/delay.h>
> >> @@ -1406,14 +1405,14 @@ static int fb_suspend(struct platform_device
> >> *dev, pm_message_t state)
> >>       struct fb_info *info = platform_get_drvdata(dev);
> >>       struct da8xx_fb_par *par = info->par;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       if (par->panel_power_ctrl)
> >>               par->panel_power_ctrl(0);
> >>
> >>       fb_set_suspend(info, 1);
> >>       lcd_disable_raster();
> >>       clk_disable(par->lcdc_clk);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> @@ -1422,7 +1421,7 @@ static int fb_resume(struct platform_device *dev)
> >>       struct fb_info *info = platform_get_drvdata(dev);
> >>       struct da8xx_fb_par *par = info->par;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       clk_enable(par->lcdc_clk);
> >>       lcd_enable_raster();
> >>
> >> @@ -1430,7 +1429,7 @@ static int fb_resume(struct platform_device *dev)
> >>               par->panel_power_ctrl(1);
> >>
> >>       fb_set_suspend(info, 0);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
> >> index 60a787f..87c8c4e 100644
> >> --- a/drivers/video/fb-puv3.c
> >> +++ b/drivers/video/fb-puv3.c
> >> @@ -17,7 +17,6 @@
> >>  #include <linux/clk.h>
> >>  #include <linux/fb.h>
> >>  #include <linux/init.h>
> >> -#include <linux/console.h>
> >>
> >>  #include <asm/sizes.h>
> >>  #include <mach/hardware.h>
> >> @@ -759,7 +758,7 @@ static int unifb_resume(struct platform_device *dev)
> >>       if (dev->dev.power.power_state.event = PM_EVENT_ON)
> >>               return 0;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>
> >>       if (dev->dev.power.power_state.event = PM_EVENT_SUSPEND) {
> >>               writel(unifb_regs[0], UDE_FSA);
> >> @@ -775,7 +774,7 @@ static int unifb_resume(struct platform_device *dev)
> >>       }
> >>       dev->dev.power.power_state = PMSG_ON;
> >>
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return rc;
> >>  }
> >> @@ -804,11 +803,11 @@ static int unifb_suspend(struct platform_device
> >> *dev, pm_message_t mesg)
> >>               goto done;
> >>       }
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>
> >>       /* do nothing... */
> >>
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>  done:
> >>       dev->dev.power.power_state = mesg;
> >> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
> >> index 0dff12a..c2d4627 100644
> >> --- a/drivers/video/fbmem.c
> >> +++ b/drivers/video/fbmem.c
> >> @@ -85,6 +85,22 @@ EXPORT_SYMBOL(lock_fb_info);
> >>   * Helpers
> >>   */
> >>
> >> +void fb_console_lock(void)
> >> +{
> >> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE
> >> +     console_lock();
> >> +#endif
> >> +}
> >> +EXPORT_SYMBOL(fb_console_lock);
> >> +
> >> +void fb_console_unlock(void)
> >> +{
> >> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE
> >> +     console_unlock();
> >> +#endif
> >> +}
> >> +EXPORT_SYMBOL(fb_console_unlock);
> >> +
> >>  int fb_get_color_depth(struct fb_var_screeninfo *var,
> >>                      struct fb_fix_screeninfo *fix)
> >>  {
> >> @@ -1101,11 +1117,11 @@ static long do_fb_ioctl(struct fb_info *info,
> >> unsigned int cmd,
> >>                       return -EFAULT;
> >>               if (!lock_fb_info(info))
> >>                       return -ENODEV;
> >> -             console_lock();
> >> +             fb_console_lock();
> >>               info->flags |= FBINFO_MISC_USEREVENT;
> >>               ret = fb_set_var(info, &var);
> >>               info->flags &= ~FBINFO_MISC_USEREVENT;
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               unlock_fb_info(info);
> >>               if (!ret && copy_to_user(argp, &var, sizeof(var)))
> >>                       ret = -EFAULT;
> >> @@ -1137,9 +1153,9 @@ static long do_fb_ioctl(struct fb_info *info,
> >> unsigned int cmd,
> >>                       return -EFAULT;
> >>               if (!lock_fb_info(info))
> >>                       return -ENODEV;
> >> -             console_lock();
> >> +             fb_console_lock();
> >>               ret = fb_pan_display(info, &var);
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               unlock_fb_info(info);
> >>               if (ret = 0 && copy_to_user(argp, &var, sizeof(var)))
> >>                       return -EFAULT;
> >> @@ -1184,11 +1200,11 @@ static long do_fb_ioctl(struct fb_info *info,
> >> unsigned int cmd,
> >>       case FBIOBLANK:
> >>               if (!lock_fb_info(info))
> >>                       return -ENODEV;
> >> -             console_lock();
> >> +             fb_console_lock();
> >>               info->flags |= FBINFO_MISC_USEREVENT;
> >>               ret = fb_blank(info, arg);
> >>               info->flags &= ~FBINFO_MISC_USEREVENT;
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               unlock_fb_info(info);
> >>               break;
> >>       default:
> >> diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
> >> index a55e366..976d8f5 100644
> >> --- a/drivers/video/fbsysfs.c
> >> +++ b/drivers/video/fbsysfs.c
> >> @@ -18,7 +18,6 @@
> >>  #include <linux/kernel.h>
> >>  #include <linux/slab.h>
> >>  #include <linux/fb.h>
> >> -#include <linux/console.h>
> >>  #include <linux/module.h>
> >>
> >>  #define FB_SYSFS_FLAG_ATTR 1
> >> @@ -92,11 +91,11 @@ static int activate(struct fb_info *fb_info,
> >> struct fb_var_screeninfo *var)
> >>       int err;
> >>
> >>       var->activate |= FB_ACTIVATE_FORCE;
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_info->flags |= FBINFO_MISC_USEREVENT;
> >>       err = fb_set_var(fb_info, var);
> >>       fb_info->flags &= ~FBINFO_MISC_USEREVENT;
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       if (err)
> >>               return err;
> >>       return 0;
> >> @@ -177,7 +176,7 @@ static ssize_t store_modes(struct device *device,
> >>       if (i * sizeof(struct fb_videomode) != count)
> >>               return -EINVAL;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       list_splice(&fb_info->modelist, &old_list);
> >>       fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
> >>                                &fb_info->modelist);
> >> @@ -187,7 +186,7 @@ static ssize_t store_modes(struct device *device,
> >>       } else
> >>               fb_destroy_modelist(&old_list);
> >>
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> @@ -303,11 +302,11 @@ static ssize_t store_blank(struct device *device,
> >>       char *last = NULL;
> >>       int err;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_info->flags |= FBINFO_MISC_USEREVENT;
> >>       err = fb_blank(fb_info, simple_strtoul(buf, &last, 0));
> >>       fb_info->flags &= ~FBINFO_MISC_USEREVENT;
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       if (err < 0)
> >>               return err;
> >>       return count;
> >> @@ -366,9 +365,9 @@ static ssize_t store_pan(struct device *device,
> >>               return -EINVAL;
> >>       var.yoffset = simple_strtoul(last, &last, 0);
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       err = fb_pan_display(fb_info, &var);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       if (err < 0)
> >>               return err;
> >> @@ -403,9 +402,9 @@ static ssize_t store_fbstate(struct device *device,
> >>
> >>       if (!lock_fb_info(fb_info))
> >>               return -ENODEV;
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(fb_info, (int)state);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       unlock_fb_info(fb_info);
> >>
> >>       return count;
> >> diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
> >> index b4f19db..ba7dd0a 100644
> >> --- a/drivers/video/geode/gxfb_core.c
> >> +++ b/drivers/video/geode/gxfb_core.c
> >> @@ -27,7 +27,6 @@
> >>  #include <linux/mm.h>
> >>  #include <linux/delay.h>
> >>  #include <linux/fb.h>
> >> -#include <linux/console.h>
> >>  #include <linux/suspend.h>
> >>  #include <linux/init.h>
> >>  #include <linux/pci.h>
> >> @@ -344,10 +343,10 @@ static int gxfb_suspend(struct pci_dev *pdev,
> >> pm_message_t state)
> >>       struct fb_info *info = pci_get_drvdata(pdev);
> >>
> >>       if (state.event = PM_EVENT_SUSPEND) {
> >> -             console_lock();
> >> +             fb_console_lock();
> >>               gx_powerdown(info);
> >>               fb_set_suspend(info, 1);
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>       }
> >>
> >>       /* there's no point in setting PCI states; we emulate PCI, so
> >> @@ -361,7 +360,7 @@ static int gxfb_resume(struct pci_dev *pdev)
> >>       struct fb_info *info = pci_get_drvdata(pdev);
> >>       int ret;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       ret = gx_powerup(info);
> >>       if (ret) {
> >>               printk(KERN_ERR "gxfb:  power up failed!\n");
> >> @@ -369,7 +368,7 @@ static int gxfb_resume(struct pci_dev *pdev)
> >>       }
> >>
> >>       fb_set_suspend(info, 0);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       return 0;
> >>  }
> >>  #endif
> >> diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
> >> index 416851c..5341bf1 100644
> >> --- a/drivers/video/geode/lxfb_core.c
> >> +++ b/drivers/video/geode/lxfb_core.c
> >> @@ -465,10 +465,10 @@ static int lxfb_suspend(struct pci_dev *pdev,
> >> pm_message_t state)
> >>       struct fb_info *info = pci_get_drvdata(pdev);
> >>
> >>       if (state.event = PM_EVENT_SUSPEND) {
> >> -             console_lock();
> >> +             fb_console_lock();
> >>               lx_powerdown(info);
> >>               fb_set_suspend(info, 1);
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>       }
> >>
> >>       /* there's no point in setting PCI states; we emulate PCI, so
> >> @@ -482,7 +482,7 @@ static int lxfb_resume(struct pci_dev *pdev)
> >>       struct fb_info *info = pci_get_drvdata(pdev);
> >>       int ret;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       ret = lx_powerup(info);
> >>       if (ret) {
> >>               printk(KERN_ERR "lxfb:  power up failed!\n");
> >> @@ -490,7 +490,7 @@ static int lxfb_resume(struct pci_dev *pdev)
> >>       }
> >>
> >>       fb_set_suspend(info, 0);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       return 0;
> >>  }
> >>  #else
> >> diff --git a/drivers/video/i740fb.c b/drivers/video/i740fb.c
> >> index ff3f880..b3fe538 100644
> >> --- a/drivers/video/i740fb.c
> >> +++ b/drivers/video/i740fb.c
> >> @@ -24,7 +24,6 @@
> >>  #include <linux/pci_ids.h>
> >>  #include <linux/i2c.h>
> >>  #include <linux/i2c-algo-bit.h>
> >> -#include <linux/console.h>
> >>  #include <video/vga.h>
> >>
> >>  #ifdef CONFIG_MTRR
> >> @@ -1210,13 +1209,13 @@ static int i740fb_suspend(struct pci_dev *dev,
> >> pm_message_t state)
> >>       if (state.event = PM_EVENT_FREEZE || state.event = PM_EVENT_PRETHAW)
> >>               return 0;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       mutex_lock(&(par->open_lock));
> >>
> >>       /* do nothing if framebuffer is not active */
> >>       if (par->ref_count = 0) {
> >>               mutex_unlock(&(par->open_lock));
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               return 0;
> >>       }
> >>
> >> @@ -1227,7 +1226,7 @@ static int i740fb_suspend(struct pci_dev *dev,
> >> pm_message_t state)
> >>       pci_set_power_state(dev, pci_choose_state(dev, state));
> >>
> >>       mutex_unlock(&(par->open_lock));
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> @@ -1237,7 +1236,7 @@ static int i740fb_resume(struct pci_dev *dev)
> >>       struct fb_info *info = pci_get_drvdata(dev);
> >>       struct i740fb_par *par = info->par;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       mutex_lock(&(par->open_lock));
> >>
> >>       if (par->ref_count = 0)
> >> @@ -1253,7 +1252,7 @@ static int i740fb_resume(struct pci_dev *dev)
> >>
> >>  fail:
> >>       mutex_unlock(&(par->open_lock));
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       return 0;
> >>  }
> >>  #else
> >> diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
> >> index b83f361..84fe1ed 100644
> >> --- a/drivers/video/i810/i810_main.c
> >> +++ b/drivers/video/i810/i810_main.c
> >> @@ -40,7 +40,6 @@
> >>  #include <linux/pci_ids.h>
> >>  #include <linux/resource.h>
> >>  #include <linux/unistd.h>
> >> -#include <linux/console.h>
> >>
> >>  #include <asm/io.h>
> >>  #include <asm/div64.h>
> >> @@ -1574,7 +1573,7 @@ static int i810fb_suspend(struct pci_dev *dev,
> >> pm_message_t mesg)
> >>               return 0;
> >>       }
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(info, 1);
> >>
> >>       if (info->fbops->fb_sync)
> >> @@ -1587,7 +1586,7 @@ static int i810fb_suspend(struct pci_dev *dev,
> >> pm_message_t mesg)
> >>       pci_save_state(dev);
> >>       pci_disable_device(dev);
> >>       pci_set_power_state(dev, pci_choose_state(dev, mesg));
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> @@ -1605,7 +1604,7 @@ static int i810fb_resume(struct pci_dev *dev)
> >>               return 0;
> >>       }
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       pci_set_power_state(dev, PCI_D0);
> >>       pci_restore_state(dev);
> >>
> >> @@ -1621,7 +1620,7 @@ static int i810fb_resume(struct pci_dev *dev)
> >>       fb_set_suspend (info, 0);
> >>       info->fbops->fb_blank(VESA_NO_BLANKING, info);
> >>  fail:
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       return 0;
> >>  }
> >>  /***********************************************************************
> >> diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
> >> index de36693..7e9301a 100644
> >> --- a/drivers/video/jz4740_fb.c
> >> +++ b/drivers/video/jz4740_fb.c
> >> @@ -21,7 +21,6 @@
> >>  #include <linux/clk.h>
> >>  #include <linux/delay.h>
> >>
> >> -#include <linux/console.h>
> >>  #include <linux/fb.h>
> >>
> >>  #include <linux/dma-mapping.h>
> >> @@ -778,9 +777,9 @@ static int jzfb_suspend(struct device *dev)
> >>  {
> >>       struct jzfb *jzfb = dev_get_drvdata(dev);
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(jzfb->fb, 1);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       mutex_lock(&jzfb->lock);
> >>       if (jzfb->is_enabled)
> >> @@ -800,9 +799,9 @@ static int jzfb_resume(struct device *dev)
> >>               jzfb_enable(jzfb);
> >>       mutex_unlock(&jzfb->lock);
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(jzfb->fb, 0);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
> >> index c89f8a8..da25fa1 100644
> >> --- a/drivers/video/mx3fb.c
> >> +++ b/drivers/video/mx3fb.c
> >> @@ -23,7 +23,6 @@
> >>  #include <linux/ioport.h>
> >>  #include <linux/dma-mapping.h>
> >>  #include <linux/dmaengine.h>
> >> -#include <linux/console.h>
> >>  #include <linux/clk.h>
> >>  #include <linux/mutex.h>
> >>
> >> @@ -1204,9 +1203,9 @@ static int mx3fb_suspend(struct platform_device
> >> *pdev, pm_message_t state)
> >>       struct mx3fb_data *mx3fb = platform_get_drvdata(pdev);
> >>       struct mx3fb_info *mx3_fbi = mx3fb->fbi->par;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(mx3fb->fbi, 1);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       if (mx3_fbi->blank = FB_BLANK_UNBLANK) {
> >>               sdc_disable_channel(mx3_fbi);
> >> @@ -1229,9 +1228,9 @@ static int mx3fb_resume(struct platform_device *pdev)
> >>               sdc_set_brightness(mx3fb, mx3fb->backlight_level);
> >>       }
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(mx3fb->fbi, 0);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
> >> index fe13ac5..f47eb2a 100644
> >> --- a/drivers/video/nvidia/nvidia.c
> >> +++ b/drivers/video/nvidia/nvidia.c
> >> @@ -19,7 +19,6 @@
> >>  #include <linux/fb.h>
> >>  #include <linux/init.h>
> >>  #include <linux/pci.h>
> >> -#include <linux/console.h>
> >>  #include <linux/backlight.h>
> >>  #ifdef CONFIG_MTRR
> >>  #include <asm/mtrr.h>
> >> @@ -1057,7 +1056,7 @@ static int nvidiafb_suspend(struct pci_dev *dev,
> >> pm_message_t mesg)
> >>
> >>       if (mesg.event = PM_EVENT_PRETHAW)
> >>               mesg.event = PM_EVENT_FREEZE;
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       par->pm_state = mesg.event;
> >>
> >>       if (mesg.event & PM_EVENT_SLEEP) {
> >> @@ -1070,7 +1069,7 @@ static int nvidiafb_suspend(struct pci_dev *dev,
> >> pm_message_t mesg)
> >>       }
> >>       dev->dev.power.power_state = mesg;
> >>
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       return 0;
> >>  }
> >>
> >> @@ -1079,7 +1078,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
> >>       struct fb_info *info = pci_get_drvdata(dev);
> >>       struct nvidia_par *par = info->par;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       pci_set_power_state(dev, PCI_D0);
> >>
> >>       if (par->pm_state != PM_EVENT_FREEZE) {
> >> @@ -1097,7 +1096,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
> >>       nvidiafb_blank(FB_BLANK_UNBLANK, info);
> >>
> >>  fail:
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       return 0;
> >>  }
> >>  #else
> >> diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
> >> index 213fbbc..cb2e174 100644
> >> --- a/drivers/video/ps3fb.c
> >> +++ b/drivers/video/ps3fb.c
> >> @@ -23,7 +23,6 @@
> >>  #include <linux/string.h>
> >>  #include <linux/mm.h>
> >>  #include <linux/interrupt.h>
> >> -#include <linux/console.h>
> >>  #include <linux/ioctl.h>
> >>  #include <linux/kthread.h>
> >>  #include <linux/freezer.h>
> >> @@ -515,7 +514,7 @@ static int ps3fb_release(struct fb_info *info, int user)
> >>                       atomic_set(&ps3fb.ext_flip, 0);
> >>                       if (console_trylock()) {
> >>                               ps3fb_sync(info, 0);    /* single buffer */
> >> -                             console_unlock();
> >> +                             fb_console_unlock();
> >>                       }
> >>               }
> >>       }
> >> @@ -830,14 +829,14 @@ static int ps3fb_ioctl(struct fb_info *info,
> >> unsigned int cmd,
> >>                       if (vmode) {
> >>                               var = info->var;
> >>                               fb_videomode_to_var(&var, vmode);
> >> -                             console_lock();
> >> +                             fb_console_lock();
> >>                               info->flags |= FBINFO_MISC_USEREVENT;
> >>                               /* Force, in case only special bits changed */
> >>                               var.activate |= FB_ACTIVATE_FORCE;
> >>                               par->new_mode_id = val;
> >>                               retval = fb_set_var(info, &var);
> >>                               info->flags &= ~FBINFO_MISC_USEREVENT;
> >> -                             console_unlock();
> >> +                             fb_console_unlock();
> >>                       }
> >>                       break;
> >>               }
> >> @@ -881,9 +880,9 @@ static int ps3fb_ioctl(struct fb_info *info,
> >> unsigned int cmd,
> >>                       break;
> >>
> >>               dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
> >> -             console_lock();
> >> +             fb_console_lock();
> >>               retval = ps3fb_sync(info, val);
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               break;
> >>
> >>       default:
> >> @@ -903,9 +902,9 @@ static int ps3fbd(void *arg)
> >>               set_current_state(TASK_INTERRUPTIBLE);
> >>               if (ps3fb.is_kicked) {
> >>                       ps3fb.is_kicked = 0;
> >> -                     console_lock();
> >> +                     fb_console_lock();
> >>                       ps3fb_sync(info, 0);    /* single buffer */
> >> -                     console_unlock();
> >> +                     fb_console_unlock();
> >>               }
> >>               schedule();
> >>       }
> >> diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
> >> index 3f90255..a1af212 100644
> >> --- a/drivers/video/pxafb.c
> >> +++ b/drivers/video/pxafb.c
> >> @@ -54,7 +54,6 @@
> >>  #include <linux/mutex.h>
> >>  #include <linux/kthread.h>
> >>  #include <linux/freezer.h>
> >> -#include <linux/console.h>
> >>
> >>  #include <mach/hardware.h>
> >>  #include <asm/io.h>
> >> @@ -733,9 +732,9 @@ static int overlayfb_open(struct fb_info *info, int user)
> >>
> >>       if (ofb->usage++ = 0) {
> >>               /* unblank the base framebuffer */
> >> -             console_lock();
> >> +             fb_console_lock();
> >>               fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>       }
> >>
> >>       return 0;
> >> diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
> >> index 1d00736..7759c82 100644
> >> --- a/drivers/video/s3fb.c
> >> +++ b/drivers/video/s3fb.c
> >> @@ -22,7 +22,6 @@
> >>  #include <linux/svga.h>
> >>  #include <linux/init.h>
> >>  #include <linux/pci.h>
> >> -#include <linux/console.h> /* Why should fb driver call console
> >> functions? because console_lock() */
> >>  #include <video/vga.h>
> >>
> >>  #include <linux/i2c.h>
> >> @@ -1445,12 +1444,12 @@ static int s3_pci_suspend(struct pci_dev* dev,
> >> pm_message_t state)
> >>
> >>       dev_info(info->device, "suspend\n");
> >>
> >> -     console_lock();
> >> +     fb_fb_console_lock();
> >>       mutex_lock(&(par->open_lock));
> >>
> >>       if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
> >>               mutex_unlock(&(par->open_lock));
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               return 0;
> >>       }
> >>
> >> @@ -1461,7 +1460,7 @@ static int s3_pci_suspend(struct pci_dev* dev,
> >> pm_message_t state)
> >>       pci_set_power_state(dev, pci_choose_state(dev, state));
> >>
> >>       mutex_unlock(&(par->open_lock));
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> @@ -1477,12 +1476,12 @@ static int s3_pci_resume(struct pci_dev* dev)
> >>
> >>       dev_info(info->device, "resume\n");
> >>
> >> -     console_lock();
> >> +     fb_fb_console_lock();
> >>       mutex_lock(&(par->open_lock));
> >>
> >>       if (par->ref_count = 0) {
> >>               mutex_unlock(&(par->open_lock));
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               return 0;
> >>       }
> >>
> >> @@ -1491,7 +1490,7 @@ static int s3_pci_resume(struct pci_dev* dev)
> >>       err = pci_enable_device(dev);
> >>       if (err) {
> >>               mutex_unlock(&(par->open_lock));
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               dev_err(info->device, "error %d enabling device for resume\n", err);
> >>               return err;
> >>       }
> >> @@ -1501,7 +1500,7 @@ static int s3_pci_resume(struct pci_dev* dev)
> >>       fb_set_suspend(info, 0);
> >>
> >>       mutex_unlock(&(par->open_lock));
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> diff --git a/drivers/video/savage/savagefb_driver.c
> >> b/drivers/video/savage/savagefb_driver.c
> >> index 0d0f52c..bf64221 100644
> >> --- a/drivers/video/savage/savagefb_driver.c
> >> +++ b/drivers/video/savage/savagefb_driver.c
> >> @@ -51,7 +51,6 @@
> >>  #include <linux/fb.h>
> >>  #include <linux/pci.h>
> >>  #include <linux/init.h>
> >> -#include <linux/console.h>
> >>
> >>  #include <asm/io.h>
> >>  #include <asm/irq.h>
> >> @@ -2391,7 +2390,7 @@ static int savagefb_suspend(struct pci_dev *dev,
> >> pm_message_t mesg)
> >>       if (mesg.event = PM_EVENT_FREEZE)
> >>               return 0;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(info, 1);
> >>
> >>       if (info->fbops->fb_sync)
> >> @@ -2403,7 +2402,7 @@ static int savagefb_suspend(struct pci_dev *dev,
> >> pm_message_t mesg)
> >>       pci_save_state(dev);
> >>       pci_disable_device(dev);
> >>       pci_set_power_state(dev, pci_choose_state(dev, mesg));
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> @@ -2427,7 +2426,7 @@ static int savagefb_resume(struct pci_dev* dev)
> >>               return 0;
> >>       }
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>
> >>       pci_set_power_state(dev, PCI_D0);
> >>       pci_restore_state(dev);
> >> @@ -2441,7 +2440,7 @@ static int savagefb_resume(struct pci_dev* dev)
> >>       savagefb_set_par(info);
> >>       fb_set_suspend(info, 0);
> >>       savagefb_blank(FB_BLANK_UNBLANK, info);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
> >> index 699487c..2bc1119 100644
> >> --- a/drivers/video/sh_mobile_lcdcfb.c
> >> +++ b/drivers/video/sh_mobile_lcdcfb.c
> >> @@ -11,7 +11,6 @@
> >>  #include <linux/atomic.h>
> >>  #include <linux/backlight.h>
> >>  #include <linux/clk.h>
> >> -#include <linux/console.h>
> >>  #include <linux/ctype.h>
> >>  #include <linux/dma-mapping.h>
> >>  #include <linux/delay.h>
> >> @@ -575,7 +574,7 @@ static int sh_mobile_lcdc_display_notify(struct
> >> sh_mobile_lcdc_chan *ch,
> >>       case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT:
> >>               /* HDMI plug in */
> >>               if (lock_fb_info(info)) {
> >> -                     console_lock();
> >> +                     fb_console_lock();
> >>
> >>                       ch->display.width = monspec->max_x * 10;
> >>                       ch->display.height = monspec->max_y * 10;
> >> @@ -594,7 +593,7 @@ static int sh_mobile_lcdc_display_notify(struct
> >> sh_mobile_lcdc_chan *ch,
> >>                               fb_set_suspend(info, 0);
> >>                       }
> >>
> >> -                     console_unlock();
> >> +                     fb_console_unlock();
> >>                       unlock_fb_info(info);
> >>               }
> >>               break;
> >> @@ -602,9 +601,9 @@ static int sh_mobile_lcdc_display_notify(struct
> >> sh_mobile_lcdc_chan *ch,
> >>       case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT:
> >>               /* HDMI disconnect */
> >>               if (lock_fb_info(info)) {
> >> -                     console_lock();
> >> +                     fb_console_lock();
> >>                       fb_set_suspend(info, 1);
> >> -                     console_unlock();
> >> +                     fb_console_unlock();
> >>                       unlock_fb_info(info);
> >>               }
> >>               break;
> >> @@ -1934,9 +1933,9 @@ static int sh_mobile_lcdc_release(struct fb_info
> >> *info, int user)
> >>
> >>       /* Nothing to reconfigure, when called from fbcon */
> >>       if (user) {
> >> -             console_lock();
> >> +             fb_console_lock();
> >>               sh_mobile_fb_reconfig(info);
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>       }
> >>
> >>       mutex_unlock(&ch->open_lock);
> >> diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
> >> index 3690eff..536f922 100644
> >> --- a/drivers/video/sm501fb.c
> >> +++ b/drivers/video/sm501fb.c
> >> @@ -28,7 +28,6 @@
> >>  #include <linux/wait.h>
> >>  #include <linux/platform_device.h>
> >>  #include <linux/clk.h>
> >> -#include <linux/console.h>
> >>  #include <linux/io.h>
> >>
> >>  #include <asm/uaccess.h>
> >> @@ -2104,9 +2103,9 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info,
> >>
> >>       /* tell console/fb driver we are suspending */
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(fbi, 1);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       /* backup copies in case chip is powered down over suspend */
> >>
> >> @@ -2163,9 +2162,9 @@ static void sm501fb_resume_fb(struct sm501fb_info *info,
> >>               memcpy_toio(par->cursor.k_addr, par->store_cursor,
> >>                           par->cursor.size);
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(fbi, 0);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       vfree(par->store_fb);
> >>       vfree(par->store_cursor);
> >> diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c
> >> index 8e4a446..e266b6b 100644
> >> --- a/drivers/video/tmiofb.c
> >> +++ b/drivers/video/tmiofb.c
> >> @@ -25,8 +25,7 @@
> >>  #include <linux/fb.h>
> >>  #include <linux/interrupt.h>
> >>  #include <linux/delay.h>
> >> -/* Why should fb driver call console functions? because console_lock() */
> >> -#include <linux/console.h>
> >> +/* Why should fb driver call console functions? because fb_console_lock() */
> >>  #include <linux/mfd/core.h>
> >>  #include <linux/mfd/tmio.h>
> >>  #include <linux/uaccess.h>
> >> @@ -938,7 +937,7 @@ static int tmiofb_suspend(struct platform_device
> >> *dev, pm_message_t state)
> >>       const struct mfd_cell *cell = mfd_get_cell(dev);
> >>       int retval = 0;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>
> >>       fb_set_suspend(info, 1);
> >>
> >> @@ -959,7 +958,7 @@ static int tmiofb_suspend(struct platform_device
> >> *dev, pm_message_t state)
> >>       if (cell->suspend)
> >>               retval = cell->suspend(dev);
> >>
> >> -     console_unlock();
> >> +     fb_fb_console_unlock();
> >>
> >>       return retval;
> >>  }
> >> @@ -970,7 +969,7 @@ static int tmiofb_resume(struct platform_device *dev)
> >>       const struct mfd_cell *cell = mfd_get_cell(dev);
> >>       int retval = 0;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>
> >>       if (cell->resume) {
> >>               retval = cell->resume(dev);
> >> @@ -986,7 +985,7 @@ static int tmiofb_resume(struct platform_device *dev)
> >>
> >>       fb_set_suspend(info, 0);
> >>  out:
> >> -     console_unlock();
> >> +     fb_fb_console_unlock();
> >>       return retval;
> >>  }
> >>  #else
> >> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> >> index c80e770..d36b173 100644
> >> --- a/drivers/video/via/viafbdev.c
> >> +++ b/drivers/video/via/viafbdev.c
> >> @@ -1698,17 +1698,17 @@ static int parse_mode(const char *str, u32
> >> devices, u32 *xres, u32 *yres)
> >>  #ifdef CONFIG_PM
> >>  static int viafb_suspend(void *unused)
> >>  {
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       fb_set_suspend(viafbinfo, 1);
> >>       viafb_sync(viafbinfo);
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >>
> >>  static int viafb_resume(void *unused)
> >>  {
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       if (viaparinfo->shared->vdev->engine_mmio)
> >>               viafb_reset_engine(viaparinfo);
> >>       viafb_set_par(viafbinfo);
> >> @@ -1716,7 +1716,7 @@ static int viafb_resume(void *unused)
> >>               viafb_set_par(viafbinfo1);
> >>       fb_set_suspend(viafbinfo, 0);
> >>
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       return 0;
> >>  }
> >>
> >> diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
> >> index 4e74d26..cb48d4d 100644
> >> --- a/drivers/video/vt8623fb.c
> >> +++ b/drivers/video/vt8623fb.c
> >> @@ -23,7 +23,6 @@
> >>  #include <linux/svga.h>
> >>  #include <linux/init.h>
> >>  #include <linux/pci.h>
> >> -#include <linux/console.h> /* Why should fb driver call console
> >> functions? because console_lock() */
> >>  #include <video/vga.h>
> >>
> >>  #ifdef CONFIG_MTRR
> >> @@ -845,12 +844,12 @@ static int vt8623_pci_suspend(struct pci_dev*
> >> dev, pm_message_t state)
> >>
> >>       dev_info(info->device, "suspend\n");
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       mutex_lock(&(par->open_lock));
> >>
> >>       if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
> >>               mutex_unlock(&(par->open_lock));
> >> -             console_unlock();
> >> +             fb_console_unlock();
> >>               return 0;
> >>       }
> >>
> >> @@ -861,7 +860,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev,
> >> pm_message_t state)
> >>       pci_set_power_state(dev, pci_choose_state(dev, state));
> >>
> >>       mutex_unlock(&(par->open_lock));
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> @@ -876,7 +875,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
> >>
> >>       dev_info(info->device, "resume\n");
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       mutex_lock(&(par->open_lock));
> >>
> >>       if (par->ref_count = 0)
> >> @@ -895,7 +894,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
> >>
> >>  fail:
> >>       mutex_unlock(&(par->open_lock));
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>
> >>       return 0;
> >>  }
> >> diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
> >> index b7f5173..770397e7 100644
> >> --- a/drivers/video/xen-fbfront.c
> >> +++ b/drivers/video/xen-fbfront.c
> >> @@ -18,7 +18,6 @@
> >>   * frame buffer.
> >>   */
> >>
> >> -#include <linux/console.h>
> >>  #include <linux/kernel.h>
> >>  #include <linux/errno.h>
> >>  #include <linux/fb.h>
> >> @@ -495,12 +494,12 @@ xenfb_make_preferred_console(void)
> >>       if (console_set_on_cmdline)
> >>               return;
> >>
> >> -     console_lock();
> >> +     fb_console_lock();
> >>       for_each_console(c) {
> >>               if (!strcmp(c->name, "tty") && c->index = 0)
> >>                       break;
> >>       }
> >> -     console_unlock();
> >> +     fb_console_unlock();
> >>       if (c) {
> >>               unregister_console(c);
> >>               c->flags |= CON_CONSDEV;
> >> diff --git a/include/linux/fb.h b/include/linux/fb.h
> >> index ac3f1c6..7ae96ad 100644
> >> --- a/include/linux/fb.h
> >> +++ b/include/linux/fb.h
> >> @@ -1021,6 +1021,8 @@ extern int fb_get_color_depth(struct
> >> fb_var_screeninfo *var,
> >>                             struct fb_fix_screeninfo *fix);
> >>  extern int fb_get_options(char *name, char **option);
> >>  extern int fb_new_modelist(struct fb_info *info);
> >> +extern void fb_console_unlock(void);
> >> +extern void fb_console_lock(void);
> >>
> >>  extern struct fb_info *registered_fb[FB_MAX];
> >>  extern int num_registered_fb;
> >
> >



^ permalink raw reply

* Re: [PATCH] fb: only enable console lock in fb for VGA console
From: Jun Nie @ 2012-09-29  8:11 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <CAGA24M+PmObK3ZJWvtNhBzxO4WkGk_xyveQiZNtZe7xGdHrbFw@mail.gmail.com>

2012/9/29 Geert Uytterhoeven <geert@linux-m68k.org>:
> On Sat, Sep 29, 2012 at 7:29 AM, Jun Nie <niej0001@gmail.com> wrote:
>> If VGA console is not enable, we do not have to
>      ^^^
> Frame buffer console?
>
Yes, I mean framebuffer console. I add VGA console for I see it in the
drivers/video/console/Kconfig. If you guys feel confused by VGA
console, I will change it to framebuffer console.
Jun

>> involve console lock/unlock in FB framework to avoid
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

^ permalink raw reply

* Re: [PATCH] fb: only enable console lock in fb for VGA console
From: Geert Uytterhoeven @ 2012-09-29  7:37 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <CAGA24M+PmObK3ZJWvtNhBzxO4WkGk_xyveQiZNtZe7xGdHrbFw@mail.gmail.com>

On Sat, Sep 29, 2012 at 7:29 AM, Jun Nie <niej0001@gmail.com> wrote:
> If VGA console is not enable, we do not have to
     ^^^
Frame buffer console?

> involve console lock/unlock in FB framework to avoid

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* Re: [PATCH] fb: only enable console lock in fb for VGA console
From: Jun Nie @ 2012-09-29  6:03 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <CAGA24M+PmObK3ZJWvtNhBzxO4WkGk_xyveQiZNtZe7xGdHrbFw@mail.gmail.com>

2012/9/29 Benjamin Herrenschmidt <benh@kernel.crashing.org>:
> On Sat, 2012-09-29 at 13:29 +0800, Jun Nie wrote:
>> If VGA console is not enable, we do not have to
>> involve console lock/unlock in FB framework to avoid
>> hold the lock unnecessarily. Otherwise, UART console
>> output may be blocked by FB pan_display etc operations,
>> which hold the console lock. This may block the
>> panic log out on UART, where the lock may never be
>> released by FB.
>
> And you end up removing all locking from the entire fbdev layer ... did
> you actually think about what you were doing here ?
>
> Ben.
>
Hi Ben,
    Yes. If framebuffer console is disabled, I do not see any need to
hold console lock in FB. Please help indicate the risk if any. Thanks!

Jun
>> Signed-off-by: Jun Nie <njun@marvell.com>
>> ---
>>  drivers/video/arkfb.c                  |   11 +++++------
>>  drivers/video/aty/aty128fb.c           |   11 +++++------
>>  drivers/video/aty/atyfb_base.c         |   11 +++++------
>>  drivers/video/aty/radeon_pm.c          |    9 ++++-----
>>  drivers/video/chipsfb.c                |    8 ++++----
>>  drivers/video/da8xx-fb.c               |    9 ++++-----
>>  drivers/video/fb-puv3.c                |    9 ++++-----
>>  drivers/video/fbmem.c                  |   28 ++++++++++++++++++++++------
>>  drivers/video/fbsysfs.c                |   21 ++++++++++-----------
>>  drivers/video/geode/gxfb_core.c        |    9 ++++-----
>>  drivers/video/geode/lxfb_core.c        |    8 ++++----
>>  drivers/video/i740fb.c                 |   11 +++++------
>>  drivers/video/i810/i810_main.c         |    9 ++++-----
>>  drivers/video/jz4740_fb.c              |    9 ++++-----
>>  drivers/video/mx3fb.c                  |    9 ++++-----
>>  drivers/video/nvidia/nvidia.c          |    9 ++++-----
>>  drivers/video/ps3fb.c                  |   15 +++++++--------
>>  drivers/video/pxafb.c                  |    5 ++---
>>  drivers/video/s3fb.c                   |   15 +++++++--------
>>  drivers/video/savage/savagefb_driver.c |    9 ++++-----
>>  drivers/video/sh_mobile_lcdcfb.c       |   13 ++++++-------
>>  drivers/video/sm501fb.c                |    9 ++++-----
>>  drivers/video/tmiofb.c                 |   11 +++++------
>>  drivers/video/via/viafbdev.c           |    8 ++++----
>>  drivers/video/vt8623fb.c               |   11 +++++------
>>  drivers/video/xen-fbfront.c            |    5 ++---
>>  include/linux/fb.h                     |    2 ++
>>  27 files changed, 140 insertions(+), 144 deletions(-)
>>
>> diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
>> index 555dd4c..774d902 100644
>> --- a/drivers/video/arkfb.c
>> +++ b/drivers/video/arkfb.c
>> @@ -23,7 +23,6 @@
>>  #include <linux/svga.h>
>>  #include <linux/init.h>
>>  #include <linux/pci.h>
>> -#include <linux/console.h> /* Why should fb driver call console
>> functions? because console_lock() */
>>  #include <video/vga.h>
>>
>>  #ifdef CONFIG_MTRR
>> @@ -1124,12 +1123,12 @@ static int ark_pci_suspend (struct pci_dev*
>> dev, pm_message_t state)
>>
>>       dev_info(info->device, "suspend\n");
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       mutex_lock(&(par->open_lock));
>>
>>       if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
>>               mutex_unlock(&(par->open_lock));
>> -             console_unlock();
>> +             fb_console_unlock();
>>               return 0;
>>       }
>>
>> @@ -1140,7 +1139,7 @@ static int ark_pci_suspend (struct pci_dev* dev,
>> pm_message_t state)
>>       pci_set_power_state(dev, pci_choose_state(dev, state));
>>
>>       mutex_unlock(&(par->open_lock));
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> @@ -1155,7 +1154,7 @@ static int ark_pci_resume (struct pci_dev* dev)
>>
>>       dev_info(info->device, "resume\n");
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       mutex_lock(&(par->open_lock));
>>
>>       if (par->ref_count = 0)
>> @@ -1174,7 +1173,7 @@ static int ark_pci_resume (struct pci_dev* dev)
>>
>>  fail:
>>       mutex_unlock(&(par->open_lock));
>> -     console_unlock();
>> +     fb_console_unlock();
>>       return 0;
>>  }
>>  #else
>> diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
>> index 747442d..1c6b80b 100644
>> --- a/drivers/video/aty/aty128fb.c
>> +++ b/drivers/video/aty/aty128fb.c
>> @@ -60,7 +60,6 @@
>>  #include <linux/init.h>
>>  #include <linux/pci.h>
>>  #include <linux/ioport.h>
>> -#include <linux/console.h>
>>  #include <linux/backlight.h>
>>  #include <asm/io.h>
>>
>> @@ -1884,7 +1883,7 @@ static void aty128_early_resume(void *data)
>>               return;
>>       pci_restore_state(par->pdev);
>>       aty128_do_resume(par->pdev);
>> -     console_unlock();
>> +     fb_console_unlock();
>>  }
>>  #endif /* CONFIG_PPC_PMAC */
>>
>> @@ -2461,7 +2460,7 @@ static int aty128_pci_suspend(struct pci_dev
>> *pdev, pm_message_t state)
>>
>>       printk(KERN_DEBUG "aty128fb: suspending...\n");
>>
>> -     console_lock();
>> +     fb_console_lock();
>>
>>       fb_set_suspend(info, 1);
>>
>> @@ -2493,7 +2492,7 @@ static int aty128_pci_suspend(struct pci_dev
>> *pdev, pm_message_t state)
>>       if (state.event != PM_EVENT_ON)
>>               aty128_set_suspend(par, 1);
>>
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       pdev->dev.power.power_state = state;
>>
>> @@ -2550,9 +2549,9 @@ static int aty128_pci_resume(struct pci_dev *pdev)
>>  {
>>       int rc;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       rc = aty128_do_resume(pdev);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return rc;
>>  }
>> diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
>> index 3f2e8c1..9bb15ab 100644
>> --- a/drivers/video/aty/atyfb_base.c
>> +++ b/drivers/video/aty/atyfb_base.c
>> @@ -58,7 +58,6 @@
>>  #include <linux/slab.h>
>>  #include <linux/vmalloc.h>
>>  #include <linux/delay.h>
>> -#include <linux/console.h>
>>  #include <linux/fb.h>
>>  #include <linux/init.h>
>>  #include <linux/pci.h>
>> @@ -2065,7 +2064,7 @@ static int atyfb_pci_suspend(struct pci_dev
>> *pdev, pm_message_t state)
>>       if (state.event = pdev->dev.power.power_state.event)
>>               return 0;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>
>>       fb_set_suspend(info, 1);
>>
>> @@ -2093,14 +2092,14 @@ static int atyfb_pci_suspend(struct pci_dev
>> *pdev, pm_message_t state)
>>               par->lock_blank = 0;
>>               atyfb_blank(FB_BLANK_UNBLANK, info);
>>               fb_set_suspend(info, 0);
>> -             console_unlock();
>> +             fb_console_unlock();
>>               return -EIO;
>>       }
>>  #else
>>       pci_set_power_state(pdev, pci_choose_state(pdev, state));
>>  #endif
>>
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       pdev->dev.power.power_state = state;
>>
>> @@ -2129,7 +2128,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
>>       if (pdev->dev.power.power_state.event = PM_EVENT_ON)
>>               return 0;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>
>>       /*
>>        * PCI state will have been restored by the core, so
>> @@ -2157,7 +2156,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
>>       par->lock_blank = 0;
>>       atyfb_blank(FB_BLANK_UNBLANK, info);
>>
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       pdev->dev.power.power_state = PMSG_ON;
>>
>> diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
>> index 92bda58..a2f07da 100644
>> --- a/drivers/video/aty/radeon_pm.c
>> +++ b/drivers/video/aty/radeon_pm.c
>> @@ -16,7 +16,6 @@
>>
>>  #include "radeonfb.h"
>>
>> -#include <linux/console.h>
>>  #include <linux/agp_backend.h>
>>
>>  #ifdef CONFIG_PPC_PMAC
>> @@ -2626,7 +2625,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev,
>> pm_message_t mesg)
>>               goto done;
>>       }
>>
>> -     console_lock();
>> +     fb_console_lock();
>>
>>       fb_set_suspend(info, 1);
>>
>> @@ -2690,7 +2689,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev,
>> pm_message_t mesg)
>>       if (rinfo->pm_mode & radeon_pm_d2)
>>               radeon_set_suspend(rinfo, 1);
>>
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>   done:
>>       pdev->dev.power.power_state = mesg;
>> @@ -2718,7 +2717,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
>>               if (!console_trylock())
>>                       return 0;
>>       } else
>> -             console_lock();
>> +             fb_console_lock();
>>
>>       printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n",
>>              pci_name(pdev), pdev->dev.power.power_state.event);
>> @@ -2783,7 +2782,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
>>       pdev->dev.power.power_state = PMSG_ON;
>>
>>   bail:
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return rc;
>>  }
>> diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
>> index cff742a..d50fa6b 100644
>> --- a/drivers/video/chipsfb.c
>> +++ b/drivers/video/chipsfb.c
>> @@ -460,10 +460,10 @@ static int chipsfb_pci_suspend(struct pci_dev
>> *pdev, pm_message_t state)
>>       if (!(state.event & PM_EVENT_SLEEP))
>>               goto done;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       chipsfb_blank(1, p);
>>       fb_set_suspend(p, 1);
>> -     console_unlock();
>> +     fb_console_unlock();
>>   done:
>>       pdev->dev.power.power_state = state;
>>       return 0;
>> @@ -473,10 +473,10 @@ static int chipsfb_pci_resume(struct pci_dev *pdev)
>>  {
>>          struct fb_info *p = pci_get_drvdata(pdev);
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(p, 0);
>>       chipsfb_blank(0, p);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       pdev->dev.power.power_state = PMSG_ON;
>>       return 0;
>> diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
>> index 7ae9d53..9a36bbc 100644
>> --- a/drivers/video/da8xx-fb.c
>> +++ b/drivers/video/da8xx-fb.c
>> @@ -29,7 +29,6 @@
>>  #include <linux/interrupt.h>
>>  #include <linux/clk.h>
>>  #include <linux/cpufreq.h>
>> -#include <linux/console.h>
>>  #include <linux/spinlock.h>
>>  #include <linux/slab.h>
>>  #include <linux/delay.h>
>> @@ -1406,14 +1405,14 @@ static int fb_suspend(struct platform_device
>> *dev, pm_message_t state)
>>       struct fb_info *info = platform_get_drvdata(dev);
>>       struct da8xx_fb_par *par = info->par;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       if (par->panel_power_ctrl)
>>               par->panel_power_ctrl(0);
>>
>>       fb_set_suspend(info, 1);
>>       lcd_disable_raster();
>>       clk_disable(par->lcdc_clk);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> @@ -1422,7 +1421,7 @@ static int fb_resume(struct platform_device *dev)
>>       struct fb_info *info = platform_get_drvdata(dev);
>>       struct da8xx_fb_par *par = info->par;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       clk_enable(par->lcdc_clk);
>>       lcd_enable_raster();
>>
>> @@ -1430,7 +1429,7 @@ static int fb_resume(struct platform_device *dev)
>>               par->panel_power_ctrl(1);
>>
>>       fb_set_suspend(info, 0);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
>> index 60a787f..87c8c4e 100644
>> --- a/drivers/video/fb-puv3.c
>> +++ b/drivers/video/fb-puv3.c
>> @@ -17,7 +17,6 @@
>>  #include <linux/clk.h>
>>  #include <linux/fb.h>
>>  #include <linux/init.h>
>> -#include <linux/console.h>
>>
>>  #include <asm/sizes.h>
>>  #include <mach/hardware.h>
>> @@ -759,7 +758,7 @@ static int unifb_resume(struct platform_device *dev)
>>       if (dev->dev.power.power_state.event = PM_EVENT_ON)
>>               return 0;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>
>>       if (dev->dev.power.power_state.event = PM_EVENT_SUSPEND) {
>>               writel(unifb_regs[0], UDE_FSA);
>> @@ -775,7 +774,7 @@ static int unifb_resume(struct platform_device *dev)
>>       }
>>       dev->dev.power.power_state = PMSG_ON;
>>
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return rc;
>>  }
>> @@ -804,11 +803,11 @@ static int unifb_suspend(struct platform_device
>> *dev, pm_message_t mesg)
>>               goto done;
>>       }
>>
>> -     console_lock();
>> +     fb_console_lock();
>>
>>       /* do nothing... */
>>
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>  done:
>>       dev->dev.power.power_state = mesg;
>> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
>> index 0dff12a..c2d4627 100644
>> --- a/drivers/video/fbmem.c
>> +++ b/drivers/video/fbmem.c
>> @@ -85,6 +85,22 @@ EXPORT_SYMBOL(lock_fb_info);
>>   * Helpers
>>   */
>>
>> +void fb_console_lock(void)
>> +{
>> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE
>> +     console_lock();
>> +#endif
>> +}
>> +EXPORT_SYMBOL(fb_console_lock);
>> +
>> +void fb_console_unlock(void)
>> +{
>> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE
>> +     console_unlock();
>> +#endif
>> +}
>> +EXPORT_SYMBOL(fb_console_unlock);
>> +
>>  int fb_get_color_depth(struct fb_var_screeninfo *var,
>>                      struct fb_fix_screeninfo *fix)
>>  {
>> @@ -1101,11 +1117,11 @@ static long do_fb_ioctl(struct fb_info *info,
>> unsigned int cmd,
>>                       return -EFAULT;
>>               if (!lock_fb_info(info))
>>                       return -ENODEV;
>> -             console_lock();
>> +             fb_console_lock();
>>               info->flags |= FBINFO_MISC_USEREVENT;
>>               ret = fb_set_var(info, &var);
>>               info->flags &= ~FBINFO_MISC_USEREVENT;
>> -             console_unlock();
>> +             fb_console_unlock();
>>               unlock_fb_info(info);
>>               if (!ret && copy_to_user(argp, &var, sizeof(var)))
>>                       ret = -EFAULT;
>> @@ -1137,9 +1153,9 @@ static long do_fb_ioctl(struct fb_info *info,
>> unsigned int cmd,
>>                       return -EFAULT;
>>               if (!lock_fb_info(info))
>>                       return -ENODEV;
>> -             console_lock();
>> +             fb_console_lock();
>>               ret = fb_pan_display(info, &var);
>> -             console_unlock();
>> +             fb_console_unlock();
>>               unlock_fb_info(info);
>>               if (ret = 0 && copy_to_user(argp, &var, sizeof(var)))
>>                       return -EFAULT;
>> @@ -1184,11 +1200,11 @@ static long do_fb_ioctl(struct fb_info *info,
>> unsigned int cmd,
>>       case FBIOBLANK:
>>               if (!lock_fb_info(info))
>>                       return -ENODEV;
>> -             console_lock();
>> +             fb_console_lock();
>>               info->flags |= FBINFO_MISC_USEREVENT;
>>               ret = fb_blank(info, arg);
>>               info->flags &= ~FBINFO_MISC_USEREVENT;
>> -             console_unlock();
>> +             fb_console_unlock();
>>               unlock_fb_info(info);
>>               break;
>>       default:
>> diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
>> index a55e366..976d8f5 100644
>> --- a/drivers/video/fbsysfs.c
>> +++ b/drivers/video/fbsysfs.c
>> @@ -18,7 +18,6 @@
>>  #include <linux/kernel.h>
>>  #include <linux/slab.h>
>>  #include <linux/fb.h>
>> -#include <linux/console.h>
>>  #include <linux/module.h>
>>
>>  #define FB_SYSFS_FLAG_ATTR 1
>> @@ -92,11 +91,11 @@ static int activate(struct fb_info *fb_info,
>> struct fb_var_screeninfo *var)
>>       int err;
>>
>>       var->activate |= FB_ACTIVATE_FORCE;
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_info->flags |= FBINFO_MISC_USEREVENT;
>>       err = fb_set_var(fb_info, var);
>>       fb_info->flags &= ~FBINFO_MISC_USEREVENT;
>> -     console_unlock();
>> +     fb_console_unlock();
>>       if (err)
>>               return err;
>>       return 0;
>> @@ -177,7 +176,7 @@ static ssize_t store_modes(struct device *device,
>>       if (i * sizeof(struct fb_videomode) != count)
>>               return -EINVAL;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       list_splice(&fb_info->modelist, &old_list);
>>       fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
>>                                &fb_info->modelist);
>> @@ -187,7 +186,7 @@ static ssize_t store_modes(struct device *device,
>>       } else
>>               fb_destroy_modelist(&old_list);
>>
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> @@ -303,11 +302,11 @@ static ssize_t store_blank(struct device *device,
>>       char *last = NULL;
>>       int err;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_info->flags |= FBINFO_MISC_USEREVENT;
>>       err = fb_blank(fb_info, simple_strtoul(buf, &last, 0));
>>       fb_info->flags &= ~FBINFO_MISC_USEREVENT;
>> -     console_unlock();
>> +     fb_console_unlock();
>>       if (err < 0)
>>               return err;
>>       return count;
>> @@ -366,9 +365,9 @@ static ssize_t store_pan(struct device *device,
>>               return -EINVAL;
>>       var.yoffset = simple_strtoul(last, &last, 0);
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       err = fb_pan_display(fb_info, &var);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       if (err < 0)
>>               return err;
>> @@ -403,9 +402,9 @@ static ssize_t store_fbstate(struct device *device,
>>
>>       if (!lock_fb_info(fb_info))
>>               return -ENODEV;
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(fb_info, (int)state);
>> -     console_unlock();
>> +     fb_console_unlock();
>>       unlock_fb_info(fb_info);
>>
>>       return count;
>> diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
>> index b4f19db..ba7dd0a 100644
>> --- a/drivers/video/geode/gxfb_core.c
>> +++ b/drivers/video/geode/gxfb_core.c
>> @@ -27,7 +27,6 @@
>>  #include <linux/mm.h>
>>  #include <linux/delay.h>
>>  #include <linux/fb.h>
>> -#include <linux/console.h>
>>  #include <linux/suspend.h>
>>  #include <linux/init.h>
>>  #include <linux/pci.h>
>> @@ -344,10 +343,10 @@ static int gxfb_suspend(struct pci_dev *pdev,
>> pm_message_t state)
>>       struct fb_info *info = pci_get_drvdata(pdev);
>>
>>       if (state.event = PM_EVENT_SUSPEND) {
>> -             console_lock();
>> +             fb_console_lock();
>>               gx_powerdown(info);
>>               fb_set_suspend(info, 1);
>> -             console_unlock();
>> +             fb_console_unlock();
>>       }
>>
>>       /* there's no point in setting PCI states; we emulate PCI, so
>> @@ -361,7 +360,7 @@ static int gxfb_resume(struct pci_dev *pdev)
>>       struct fb_info *info = pci_get_drvdata(pdev);
>>       int ret;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       ret = gx_powerup(info);
>>       if (ret) {
>>               printk(KERN_ERR "gxfb:  power up failed!\n");
>> @@ -369,7 +368,7 @@ static int gxfb_resume(struct pci_dev *pdev)
>>       }
>>
>>       fb_set_suspend(info, 0);
>> -     console_unlock();
>> +     fb_console_unlock();
>>       return 0;
>>  }
>>  #endif
>> diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
>> index 416851c..5341bf1 100644
>> --- a/drivers/video/geode/lxfb_core.c
>> +++ b/drivers/video/geode/lxfb_core.c
>> @@ -465,10 +465,10 @@ static int lxfb_suspend(struct pci_dev *pdev,
>> pm_message_t state)
>>       struct fb_info *info = pci_get_drvdata(pdev);
>>
>>       if (state.event = PM_EVENT_SUSPEND) {
>> -             console_lock();
>> +             fb_console_lock();
>>               lx_powerdown(info);
>>               fb_set_suspend(info, 1);
>> -             console_unlock();
>> +             fb_console_unlock();
>>       }
>>
>>       /* there's no point in setting PCI states; we emulate PCI, so
>> @@ -482,7 +482,7 @@ static int lxfb_resume(struct pci_dev *pdev)
>>       struct fb_info *info = pci_get_drvdata(pdev);
>>       int ret;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       ret = lx_powerup(info);
>>       if (ret) {
>>               printk(KERN_ERR "lxfb:  power up failed!\n");
>> @@ -490,7 +490,7 @@ static int lxfb_resume(struct pci_dev *pdev)
>>       }
>>
>>       fb_set_suspend(info, 0);
>> -     console_unlock();
>> +     fb_console_unlock();
>>       return 0;
>>  }
>>  #else
>> diff --git a/drivers/video/i740fb.c b/drivers/video/i740fb.c
>> index ff3f880..b3fe538 100644
>> --- a/drivers/video/i740fb.c
>> +++ b/drivers/video/i740fb.c
>> @@ -24,7 +24,6 @@
>>  #include <linux/pci_ids.h>
>>  #include <linux/i2c.h>
>>  #include <linux/i2c-algo-bit.h>
>> -#include <linux/console.h>
>>  #include <video/vga.h>
>>
>>  #ifdef CONFIG_MTRR
>> @@ -1210,13 +1209,13 @@ static int i740fb_suspend(struct pci_dev *dev,
>> pm_message_t state)
>>       if (state.event = PM_EVENT_FREEZE || state.event = PM_EVENT_PRETHAW)
>>               return 0;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       mutex_lock(&(par->open_lock));
>>
>>       /* do nothing if framebuffer is not active */
>>       if (par->ref_count = 0) {
>>               mutex_unlock(&(par->open_lock));
>> -             console_unlock();
>> +             fb_console_unlock();
>>               return 0;
>>       }
>>
>> @@ -1227,7 +1226,7 @@ static int i740fb_suspend(struct pci_dev *dev,
>> pm_message_t state)
>>       pci_set_power_state(dev, pci_choose_state(dev, state));
>>
>>       mutex_unlock(&(par->open_lock));
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> @@ -1237,7 +1236,7 @@ static int i740fb_resume(struct pci_dev *dev)
>>       struct fb_info *info = pci_get_drvdata(dev);
>>       struct i740fb_par *par = info->par;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       mutex_lock(&(par->open_lock));
>>
>>       if (par->ref_count = 0)
>> @@ -1253,7 +1252,7 @@ static int i740fb_resume(struct pci_dev *dev)
>>
>>  fail:
>>       mutex_unlock(&(par->open_lock));
>> -     console_unlock();
>> +     fb_console_unlock();
>>       return 0;
>>  }
>>  #else
>> diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
>> index b83f361..84fe1ed 100644
>> --- a/drivers/video/i810/i810_main.c
>> +++ b/drivers/video/i810/i810_main.c
>> @@ -40,7 +40,6 @@
>>  #include <linux/pci_ids.h>
>>  #include <linux/resource.h>
>>  #include <linux/unistd.h>
>> -#include <linux/console.h>
>>
>>  #include <asm/io.h>
>>  #include <asm/div64.h>
>> @@ -1574,7 +1573,7 @@ static int i810fb_suspend(struct pci_dev *dev,
>> pm_message_t mesg)
>>               return 0;
>>       }
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(info, 1);
>>
>>       if (info->fbops->fb_sync)
>> @@ -1587,7 +1586,7 @@ static int i810fb_suspend(struct pci_dev *dev,
>> pm_message_t mesg)
>>       pci_save_state(dev);
>>       pci_disable_device(dev);
>>       pci_set_power_state(dev, pci_choose_state(dev, mesg));
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> @@ -1605,7 +1604,7 @@ static int i810fb_resume(struct pci_dev *dev)
>>               return 0;
>>       }
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       pci_set_power_state(dev, PCI_D0);
>>       pci_restore_state(dev);
>>
>> @@ -1621,7 +1620,7 @@ static int i810fb_resume(struct pci_dev *dev)
>>       fb_set_suspend (info, 0);
>>       info->fbops->fb_blank(VESA_NO_BLANKING, info);
>>  fail:
>> -     console_unlock();
>> +     fb_console_unlock();
>>       return 0;
>>  }
>>  /***********************************************************************
>> diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
>> index de36693..7e9301a 100644
>> --- a/drivers/video/jz4740_fb.c
>> +++ b/drivers/video/jz4740_fb.c
>> @@ -21,7 +21,6 @@
>>  #include <linux/clk.h>
>>  #include <linux/delay.h>
>>
>> -#include <linux/console.h>
>>  #include <linux/fb.h>
>>
>>  #include <linux/dma-mapping.h>
>> @@ -778,9 +777,9 @@ static int jzfb_suspend(struct device *dev)
>>  {
>>       struct jzfb *jzfb = dev_get_drvdata(dev);
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(jzfb->fb, 1);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       mutex_lock(&jzfb->lock);
>>       if (jzfb->is_enabled)
>> @@ -800,9 +799,9 @@ static int jzfb_resume(struct device *dev)
>>               jzfb_enable(jzfb);
>>       mutex_unlock(&jzfb->lock);
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(jzfb->fb, 0);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
>> index c89f8a8..da25fa1 100644
>> --- a/drivers/video/mx3fb.c
>> +++ b/drivers/video/mx3fb.c
>> @@ -23,7 +23,6 @@
>>  #include <linux/ioport.h>
>>  #include <linux/dma-mapping.h>
>>  #include <linux/dmaengine.h>
>> -#include <linux/console.h>
>>  #include <linux/clk.h>
>>  #include <linux/mutex.h>
>>
>> @@ -1204,9 +1203,9 @@ static int mx3fb_suspend(struct platform_device
>> *pdev, pm_message_t state)
>>       struct mx3fb_data *mx3fb = platform_get_drvdata(pdev);
>>       struct mx3fb_info *mx3_fbi = mx3fb->fbi->par;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(mx3fb->fbi, 1);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       if (mx3_fbi->blank = FB_BLANK_UNBLANK) {
>>               sdc_disable_channel(mx3_fbi);
>> @@ -1229,9 +1228,9 @@ static int mx3fb_resume(struct platform_device *pdev)
>>               sdc_set_brightness(mx3fb, mx3fb->backlight_level);
>>       }
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(mx3fb->fbi, 0);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
>> index fe13ac5..f47eb2a 100644
>> --- a/drivers/video/nvidia/nvidia.c
>> +++ b/drivers/video/nvidia/nvidia.c
>> @@ -19,7 +19,6 @@
>>  #include <linux/fb.h>
>>  #include <linux/init.h>
>>  #include <linux/pci.h>
>> -#include <linux/console.h>
>>  #include <linux/backlight.h>
>>  #ifdef CONFIG_MTRR
>>  #include <asm/mtrr.h>
>> @@ -1057,7 +1056,7 @@ static int nvidiafb_suspend(struct pci_dev *dev,
>> pm_message_t mesg)
>>
>>       if (mesg.event = PM_EVENT_PRETHAW)
>>               mesg.event = PM_EVENT_FREEZE;
>> -     console_lock();
>> +     fb_console_lock();
>>       par->pm_state = mesg.event;
>>
>>       if (mesg.event & PM_EVENT_SLEEP) {
>> @@ -1070,7 +1069,7 @@ static int nvidiafb_suspend(struct pci_dev *dev,
>> pm_message_t mesg)
>>       }
>>       dev->dev.power.power_state = mesg;
>>
>> -     console_unlock();
>> +     fb_console_unlock();
>>       return 0;
>>  }
>>
>> @@ -1079,7 +1078,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
>>       struct fb_info *info = pci_get_drvdata(dev);
>>       struct nvidia_par *par = info->par;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       pci_set_power_state(dev, PCI_D0);
>>
>>       if (par->pm_state != PM_EVENT_FREEZE) {
>> @@ -1097,7 +1096,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
>>       nvidiafb_blank(FB_BLANK_UNBLANK, info);
>>
>>  fail:
>> -     console_unlock();
>> +     fb_console_unlock();
>>       return 0;
>>  }
>>  #else
>> diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
>> index 213fbbc..cb2e174 100644
>> --- a/drivers/video/ps3fb.c
>> +++ b/drivers/video/ps3fb.c
>> @@ -23,7 +23,6 @@
>>  #include <linux/string.h>
>>  #include <linux/mm.h>
>>  #include <linux/interrupt.h>
>> -#include <linux/console.h>
>>  #include <linux/ioctl.h>
>>  #include <linux/kthread.h>
>>  #include <linux/freezer.h>
>> @@ -515,7 +514,7 @@ static int ps3fb_release(struct fb_info *info, int user)
>>                       atomic_set(&ps3fb.ext_flip, 0);
>>                       if (console_trylock()) {
>>                               ps3fb_sync(info, 0);    /* single buffer */
>> -                             console_unlock();
>> +                             fb_console_unlock();
>>                       }
>>               }
>>       }
>> @@ -830,14 +829,14 @@ static int ps3fb_ioctl(struct fb_info *info,
>> unsigned int cmd,
>>                       if (vmode) {
>>                               var = info->var;
>>                               fb_videomode_to_var(&var, vmode);
>> -                             console_lock();
>> +                             fb_console_lock();
>>                               info->flags |= FBINFO_MISC_USEREVENT;
>>                               /* Force, in case only special bits changed */
>>                               var.activate |= FB_ACTIVATE_FORCE;
>>                               par->new_mode_id = val;
>>                               retval = fb_set_var(info, &var);
>>                               info->flags &= ~FBINFO_MISC_USEREVENT;
>> -                             console_unlock();
>> +                             fb_console_unlock();
>>                       }
>>                       break;
>>               }
>> @@ -881,9 +880,9 @@ static int ps3fb_ioctl(struct fb_info *info,
>> unsigned int cmd,
>>                       break;
>>
>>               dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
>> -             console_lock();
>> +             fb_console_lock();
>>               retval = ps3fb_sync(info, val);
>> -             console_unlock();
>> +             fb_console_unlock();
>>               break;
>>
>>       default:
>> @@ -903,9 +902,9 @@ static int ps3fbd(void *arg)
>>               set_current_state(TASK_INTERRUPTIBLE);
>>               if (ps3fb.is_kicked) {
>>                       ps3fb.is_kicked = 0;
>> -                     console_lock();
>> +                     fb_console_lock();
>>                       ps3fb_sync(info, 0);    /* single buffer */
>> -                     console_unlock();
>> +                     fb_console_unlock();
>>               }
>>               schedule();
>>       }
>> diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
>> index 3f90255..a1af212 100644
>> --- a/drivers/video/pxafb.c
>> +++ b/drivers/video/pxafb.c
>> @@ -54,7 +54,6 @@
>>  #include <linux/mutex.h>
>>  #include <linux/kthread.h>
>>  #include <linux/freezer.h>
>> -#include <linux/console.h>
>>
>>  #include <mach/hardware.h>
>>  #include <asm/io.h>
>> @@ -733,9 +732,9 @@ static int overlayfb_open(struct fb_info *info, int user)
>>
>>       if (ofb->usage++ = 0) {
>>               /* unblank the base framebuffer */
>> -             console_lock();
>> +             fb_console_lock();
>>               fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
>> -             console_unlock();
>> +             fb_console_unlock();
>>       }
>>
>>       return 0;
>> diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
>> index 1d00736..7759c82 100644
>> --- a/drivers/video/s3fb.c
>> +++ b/drivers/video/s3fb.c
>> @@ -22,7 +22,6 @@
>>  #include <linux/svga.h>
>>  #include <linux/init.h>
>>  #include <linux/pci.h>
>> -#include <linux/console.h> /* Why should fb driver call console
>> functions? because console_lock() */
>>  #include <video/vga.h>
>>
>>  #include <linux/i2c.h>
>> @@ -1445,12 +1444,12 @@ static int s3_pci_suspend(struct pci_dev* dev,
>> pm_message_t state)
>>
>>       dev_info(info->device, "suspend\n");
>>
>> -     console_lock();
>> +     fb_fb_console_lock();
>>       mutex_lock(&(par->open_lock));
>>
>>       if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
>>               mutex_unlock(&(par->open_lock));
>> -             console_unlock();
>> +             fb_console_unlock();
>>               return 0;
>>       }
>>
>> @@ -1461,7 +1460,7 @@ static int s3_pci_suspend(struct pci_dev* dev,
>> pm_message_t state)
>>       pci_set_power_state(dev, pci_choose_state(dev, state));
>>
>>       mutex_unlock(&(par->open_lock));
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> @@ -1477,12 +1476,12 @@ static int s3_pci_resume(struct pci_dev* dev)
>>
>>       dev_info(info->device, "resume\n");
>>
>> -     console_lock();
>> +     fb_fb_console_lock();
>>       mutex_lock(&(par->open_lock));
>>
>>       if (par->ref_count = 0) {
>>               mutex_unlock(&(par->open_lock));
>> -             console_unlock();
>> +             fb_console_unlock();
>>               return 0;
>>       }
>>
>> @@ -1491,7 +1490,7 @@ static int s3_pci_resume(struct pci_dev* dev)
>>       err = pci_enable_device(dev);
>>       if (err) {
>>               mutex_unlock(&(par->open_lock));
>> -             console_unlock();
>> +             fb_console_unlock();
>>               dev_err(info->device, "error %d enabling device for resume\n", err);
>>               return err;
>>       }
>> @@ -1501,7 +1500,7 @@ static int s3_pci_resume(struct pci_dev* dev)
>>       fb_set_suspend(info, 0);
>>
>>       mutex_unlock(&(par->open_lock));
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> diff --git a/drivers/video/savage/savagefb_driver.c
>> b/drivers/video/savage/savagefb_driver.c
>> index 0d0f52c..bf64221 100644
>> --- a/drivers/video/savage/savagefb_driver.c
>> +++ b/drivers/video/savage/savagefb_driver.c
>> @@ -51,7 +51,6 @@
>>  #include <linux/fb.h>
>>  #include <linux/pci.h>
>>  #include <linux/init.h>
>> -#include <linux/console.h>
>>
>>  #include <asm/io.h>
>>  #include <asm/irq.h>
>> @@ -2391,7 +2390,7 @@ static int savagefb_suspend(struct pci_dev *dev,
>> pm_message_t mesg)
>>       if (mesg.event = PM_EVENT_FREEZE)
>>               return 0;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(info, 1);
>>
>>       if (info->fbops->fb_sync)
>> @@ -2403,7 +2402,7 @@ static int savagefb_suspend(struct pci_dev *dev,
>> pm_message_t mesg)
>>       pci_save_state(dev);
>>       pci_disable_device(dev);
>>       pci_set_power_state(dev, pci_choose_state(dev, mesg));
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> @@ -2427,7 +2426,7 @@ static int savagefb_resume(struct pci_dev* dev)
>>               return 0;
>>       }
>>
>> -     console_lock();
>> +     fb_console_lock();
>>
>>       pci_set_power_state(dev, PCI_D0);
>>       pci_restore_state(dev);
>> @@ -2441,7 +2440,7 @@ static int savagefb_resume(struct pci_dev* dev)
>>       savagefb_set_par(info);
>>       fb_set_suspend(info, 0);
>>       savagefb_blank(FB_BLANK_UNBLANK, info);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
>> index 699487c..2bc1119 100644
>> --- a/drivers/video/sh_mobile_lcdcfb.c
>> +++ b/drivers/video/sh_mobile_lcdcfb.c
>> @@ -11,7 +11,6 @@
>>  #include <linux/atomic.h>
>>  #include <linux/backlight.h>
>>  #include <linux/clk.h>
>> -#include <linux/console.h>
>>  #include <linux/ctype.h>
>>  #include <linux/dma-mapping.h>
>>  #include <linux/delay.h>
>> @@ -575,7 +574,7 @@ static int sh_mobile_lcdc_display_notify(struct
>> sh_mobile_lcdc_chan *ch,
>>       case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT:
>>               /* HDMI plug in */
>>               if (lock_fb_info(info)) {
>> -                     console_lock();
>> +                     fb_console_lock();
>>
>>                       ch->display.width = monspec->max_x * 10;
>>                       ch->display.height = monspec->max_y * 10;
>> @@ -594,7 +593,7 @@ static int sh_mobile_lcdc_display_notify(struct
>> sh_mobile_lcdc_chan *ch,
>>                               fb_set_suspend(info, 0);
>>                       }
>>
>> -                     console_unlock();
>> +                     fb_console_unlock();
>>                       unlock_fb_info(info);
>>               }
>>               break;
>> @@ -602,9 +601,9 @@ static int sh_mobile_lcdc_display_notify(struct
>> sh_mobile_lcdc_chan *ch,
>>       case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT:
>>               /* HDMI disconnect */
>>               if (lock_fb_info(info)) {
>> -                     console_lock();
>> +                     fb_console_lock();
>>                       fb_set_suspend(info, 1);
>> -                     console_unlock();
>> +                     fb_console_unlock();
>>                       unlock_fb_info(info);
>>               }
>>               break;
>> @@ -1934,9 +1933,9 @@ static int sh_mobile_lcdc_release(struct fb_info
>> *info, int user)
>>
>>       /* Nothing to reconfigure, when called from fbcon */
>>       if (user) {
>> -             console_lock();
>> +             fb_console_lock();
>>               sh_mobile_fb_reconfig(info);
>> -             console_unlock();
>> +             fb_console_unlock();
>>       }
>>
>>       mutex_unlock(&ch->open_lock);
>> diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
>> index 3690eff..536f922 100644
>> --- a/drivers/video/sm501fb.c
>> +++ b/drivers/video/sm501fb.c
>> @@ -28,7 +28,6 @@
>>  #include <linux/wait.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/clk.h>
>> -#include <linux/console.h>
>>  #include <linux/io.h>
>>
>>  #include <asm/uaccess.h>
>> @@ -2104,9 +2103,9 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info,
>>
>>       /* tell console/fb driver we are suspending */
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(fbi, 1);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       /* backup copies in case chip is powered down over suspend */
>>
>> @@ -2163,9 +2162,9 @@ static void sm501fb_resume_fb(struct sm501fb_info *info,
>>               memcpy_toio(par->cursor.k_addr, par->store_cursor,
>>                           par->cursor.size);
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(fbi, 0);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       vfree(par->store_fb);
>>       vfree(par->store_cursor);
>> diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c
>> index 8e4a446..e266b6b 100644
>> --- a/drivers/video/tmiofb.c
>> +++ b/drivers/video/tmiofb.c
>> @@ -25,8 +25,7 @@
>>  #include <linux/fb.h>
>>  #include <linux/interrupt.h>
>>  #include <linux/delay.h>
>> -/* Why should fb driver call console functions? because console_lock() */
>> -#include <linux/console.h>
>> +/* Why should fb driver call console functions? because fb_console_lock() */
>>  #include <linux/mfd/core.h>
>>  #include <linux/mfd/tmio.h>
>>  #include <linux/uaccess.h>
>> @@ -938,7 +937,7 @@ static int tmiofb_suspend(struct platform_device
>> *dev, pm_message_t state)
>>       const struct mfd_cell *cell = mfd_get_cell(dev);
>>       int retval = 0;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>
>>       fb_set_suspend(info, 1);
>>
>> @@ -959,7 +958,7 @@ static int tmiofb_suspend(struct platform_device
>> *dev, pm_message_t state)
>>       if (cell->suspend)
>>               retval = cell->suspend(dev);
>>
>> -     console_unlock();
>> +     fb_fb_console_unlock();
>>
>>       return retval;
>>  }
>> @@ -970,7 +969,7 @@ static int tmiofb_resume(struct platform_device *dev)
>>       const struct mfd_cell *cell = mfd_get_cell(dev);
>>       int retval = 0;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>
>>       if (cell->resume) {
>>               retval = cell->resume(dev);
>> @@ -986,7 +985,7 @@ static int tmiofb_resume(struct platform_device *dev)
>>
>>       fb_set_suspend(info, 0);
>>  out:
>> -     console_unlock();
>> +     fb_fb_console_unlock();
>>       return retval;
>>  }
>>  #else
>> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
>> index c80e770..d36b173 100644
>> --- a/drivers/video/via/viafbdev.c
>> +++ b/drivers/video/via/viafbdev.c
>> @@ -1698,17 +1698,17 @@ static int parse_mode(const char *str, u32
>> devices, u32 *xres, u32 *yres)
>>  #ifdef CONFIG_PM
>>  static int viafb_suspend(void *unused)
>>  {
>> -     console_lock();
>> +     fb_console_lock();
>>       fb_set_suspend(viafbinfo, 1);
>>       viafb_sync(viafbinfo);
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>>
>>  static int viafb_resume(void *unused)
>>  {
>> -     console_lock();
>> +     fb_console_lock();
>>       if (viaparinfo->shared->vdev->engine_mmio)
>>               viafb_reset_engine(viaparinfo);
>>       viafb_set_par(viafbinfo);
>> @@ -1716,7 +1716,7 @@ static int viafb_resume(void *unused)
>>               viafb_set_par(viafbinfo1);
>>       fb_set_suspend(viafbinfo, 0);
>>
>> -     console_unlock();
>> +     fb_console_unlock();
>>       return 0;
>>  }
>>
>> diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
>> index 4e74d26..cb48d4d 100644
>> --- a/drivers/video/vt8623fb.c
>> +++ b/drivers/video/vt8623fb.c
>> @@ -23,7 +23,6 @@
>>  #include <linux/svga.h>
>>  #include <linux/init.h>
>>  #include <linux/pci.h>
>> -#include <linux/console.h> /* Why should fb driver call console
>> functions? because console_lock() */
>>  #include <video/vga.h>
>>
>>  #ifdef CONFIG_MTRR
>> @@ -845,12 +844,12 @@ static int vt8623_pci_suspend(struct pci_dev*
>> dev, pm_message_t state)
>>
>>       dev_info(info->device, "suspend\n");
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       mutex_lock(&(par->open_lock));
>>
>>       if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
>>               mutex_unlock(&(par->open_lock));
>> -             console_unlock();
>> +             fb_console_unlock();
>>               return 0;
>>       }
>>
>> @@ -861,7 +860,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev,
>> pm_message_t state)
>>       pci_set_power_state(dev, pci_choose_state(dev, state));
>>
>>       mutex_unlock(&(par->open_lock));
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> @@ -876,7 +875,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
>>
>>       dev_info(info->device, "resume\n");
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       mutex_lock(&(par->open_lock));
>>
>>       if (par->ref_count = 0)
>> @@ -895,7 +894,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
>>
>>  fail:
>>       mutex_unlock(&(par->open_lock));
>> -     console_unlock();
>> +     fb_console_unlock();
>>
>>       return 0;
>>  }
>> diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
>> index b7f5173..770397e7 100644
>> --- a/drivers/video/xen-fbfront.c
>> +++ b/drivers/video/xen-fbfront.c
>> @@ -18,7 +18,6 @@
>>   * frame buffer.
>>   */
>>
>> -#include <linux/console.h>
>>  #include <linux/kernel.h>
>>  #include <linux/errno.h>
>>  #include <linux/fb.h>
>> @@ -495,12 +494,12 @@ xenfb_make_preferred_console(void)
>>       if (console_set_on_cmdline)
>>               return;
>>
>> -     console_lock();
>> +     fb_console_lock();
>>       for_each_console(c) {
>>               if (!strcmp(c->name, "tty") && c->index = 0)
>>                       break;
>>       }
>> -     console_unlock();
>> +     fb_console_unlock();
>>       if (c) {
>>               unregister_console(c);
>>               c->flags |= CON_CONSDEV;
>> diff --git a/include/linux/fb.h b/include/linux/fb.h
>> index ac3f1c6..7ae96ad 100644
>> --- a/include/linux/fb.h
>> +++ b/include/linux/fb.h
>> @@ -1021,6 +1021,8 @@ extern int fb_get_color_depth(struct
>> fb_var_screeninfo *var,
>>                             struct fb_fix_screeninfo *fix);
>>  extern int fb_get_options(char *name, char **option);
>>  extern int fb_new_modelist(struct fb_info *info);
>> +extern void fb_console_unlock(void);
>> +extern void fb_console_lock(void);
>>
>>  extern struct fb_info *registered_fb[FB_MAX];
>>  extern int num_registered_fb;
>
>

^ permalink raw reply

* Re: [PATCH] fb: only enable console lock in fb for VGA console
From: Benjamin Herrenschmidt @ 2012-09-29  5:58 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <CAGA24M+PmObK3ZJWvtNhBzxO4WkGk_xyveQiZNtZe7xGdHrbFw@mail.gmail.com>

On Sat, 2012-09-29 at 13:29 +0800, Jun Nie wrote:
> If VGA console is not enable, we do not have to
> involve console lock/unlock in FB framework to avoid
> hold the lock unnecessarily. Otherwise, UART console
> output may be blocked by FB pan_display etc operations,
> which hold the console lock. This may block the
> panic log out on UART, where the lock may never be
> released by FB.

And you end up removing all locking from the entire fbdev layer ... did
you actually think about what you were doing here ?

Ben.

> Signed-off-by: Jun Nie <njun@marvell.com>
> ---
>  drivers/video/arkfb.c                  |   11 +++++------
>  drivers/video/aty/aty128fb.c           |   11 +++++------
>  drivers/video/aty/atyfb_base.c         |   11 +++++------
>  drivers/video/aty/radeon_pm.c          |    9 ++++-----
>  drivers/video/chipsfb.c                |    8 ++++----
>  drivers/video/da8xx-fb.c               |    9 ++++-----
>  drivers/video/fb-puv3.c                |    9 ++++-----
>  drivers/video/fbmem.c                  |   28 ++++++++++++++++++++++------
>  drivers/video/fbsysfs.c                |   21 ++++++++++-----------
>  drivers/video/geode/gxfb_core.c        |    9 ++++-----
>  drivers/video/geode/lxfb_core.c        |    8 ++++----
>  drivers/video/i740fb.c                 |   11 +++++------
>  drivers/video/i810/i810_main.c         |    9 ++++-----
>  drivers/video/jz4740_fb.c              |    9 ++++-----
>  drivers/video/mx3fb.c                  |    9 ++++-----
>  drivers/video/nvidia/nvidia.c          |    9 ++++-----
>  drivers/video/ps3fb.c                  |   15 +++++++--------
>  drivers/video/pxafb.c                  |    5 ++---
>  drivers/video/s3fb.c                   |   15 +++++++--------
>  drivers/video/savage/savagefb_driver.c |    9 ++++-----
>  drivers/video/sh_mobile_lcdcfb.c       |   13 ++++++-------
>  drivers/video/sm501fb.c                |    9 ++++-----
>  drivers/video/tmiofb.c                 |   11 +++++------
>  drivers/video/via/viafbdev.c           |    8 ++++----
>  drivers/video/vt8623fb.c               |   11 +++++------
>  drivers/video/xen-fbfront.c            |    5 ++---
>  include/linux/fb.h                     |    2 ++
>  27 files changed, 140 insertions(+), 144 deletions(-)
> 
> diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
> index 555dd4c..774d902 100644
> --- a/drivers/video/arkfb.c
> +++ b/drivers/video/arkfb.c
> @@ -23,7 +23,6 @@
>  #include <linux/svga.h>
>  #include <linux/init.h>
>  #include <linux/pci.h>
> -#include <linux/console.h> /* Why should fb driver call console
> functions? because console_lock() */
>  #include <video/vga.h>
> 
>  #ifdef CONFIG_MTRR
> @@ -1124,12 +1123,12 @@ static int ark_pci_suspend (struct pci_dev*
> dev, pm_message_t state)
> 
>  	dev_info(info->device, "suspend\n");
> 
> -	console_lock();
> +	fb_console_lock();
>  	mutex_lock(&(par->open_lock));
> 
>  	if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
>  		mutex_unlock(&(par->open_lock));
> -		console_unlock();
> +		fb_console_unlock();
>  		return 0;
>  	}
> 
> @@ -1140,7 +1139,7 @@ static int ark_pci_suspend (struct pci_dev* dev,
> pm_message_t state)
>  	pci_set_power_state(dev, pci_choose_state(dev, state));
> 
>  	mutex_unlock(&(par->open_lock));
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> @@ -1155,7 +1154,7 @@ static int ark_pci_resume (struct pci_dev* dev)
> 
>  	dev_info(info->device, "resume\n");
> 
> -	console_lock();
> +	fb_console_lock();
>  	mutex_lock(&(par->open_lock));
> 
>  	if (par->ref_count = 0)
> @@ -1174,7 +1173,7 @@ static int ark_pci_resume (struct pci_dev* dev)
> 
>  fail:
>  	mutex_unlock(&(par->open_lock));
> -	console_unlock();
> +	fb_console_unlock();
>  	return 0;
>  }
>  #else
> diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
> index 747442d..1c6b80b 100644
> --- a/drivers/video/aty/aty128fb.c
> +++ b/drivers/video/aty/aty128fb.c
> @@ -60,7 +60,6 @@
>  #include <linux/init.h>
>  #include <linux/pci.h>
>  #include <linux/ioport.h>
> -#include <linux/console.h>
>  #include <linux/backlight.h>
>  #include <asm/io.h>
> 
> @@ -1884,7 +1883,7 @@ static void aty128_early_resume(void *data)
>  		return;
>  	pci_restore_state(par->pdev);
>  	aty128_do_resume(par->pdev);
> -	console_unlock();
> +	fb_console_unlock();
>  }
>  #endif /* CONFIG_PPC_PMAC */
> 
> @@ -2461,7 +2460,7 @@ static int aty128_pci_suspend(struct pci_dev
> *pdev, pm_message_t state)
> 
>  	printk(KERN_DEBUG "aty128fb: suspending...\n");
>  	
> -	console_lock();
> +	fb_console_lock();
> 
>  	fb_set_suspend(info, 1);
> 
> @@ -2493,7 +2492,7 @@ static int aty128_pci_suspend(struct pci_dev
> *pdev, pm_message_t state)
>  	if (state.event != PM_EVENT_ON)
>  		aty128_set_suspend(par, 1);
> 
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	pdev->dev.power.power_state = state;
> 
> @@ -2550,9 +2549,9 @@ static int aty128_pci_resume(struct pci_dev *pdev)
>  {
>  	int rc;
> 
> -	console_lock();
> +	fb_console_lock();
>  	rc = aty128_do_resume(pdev);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return rc;
>  }
> diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
> index 3f2e8c1..9bb15ab 100644
> --- a/drivers/video/aty/atyfb_base.c
> +++ b/drivers/video/aty/atyfb_base.c
> @@ -58,7 +58,6 @@
>  #include <linux/slab.h>
>  #include <linux/vmalloc.h>
>  #include <linux/delay.h>
> -#include <linux/console.h>
>  #include <linux/fb.h>
>  #include <linux/init.h>
>  #include <linux/pci.h>
> @@ -2065,7 +2064,7 @@ static int atyfb_pci_suspend(struct pci_dev
> *pdev, pm_message_t state)
>  	if (state.event = pdev->dev.power.power_state.event)
>  		return 0;
> 
> -	console_lock();
> +	fb_console_lock();
> 
>  	fb_set_suspend(info, 1);
> 
> @@ -2093,14 +2092,14 @@ static int atyfb_pci_suspend(struct pci_dev
> *pdev, pm_message_t state)
>  		par->lock_blank = 0;
>  		atyfb_blank(FB_BLANK_UNBLANK, info);
>  		fb_set_suspend(info, 0);
> -		console_unlock();
> +		fb_console_unlock();
>  		return -EIO;
>  	}
>  #else
>  	pci_set_power_state(pdev, pci_choose_state(pdev, state));
>  #endif
> 
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	pdev->dev.power.power_state = state;
> 
> @@ -2129,7 +2128,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
>  	if (pdev->dev.power.power_state.event = PM_EVENT_ON)
>  		return 0;
> 
> -	console_lock();
> +	fb_console_lock();
> 
>  	/*
>  	 * PCI state will have been restored by the core, so
> @@ -2157,7 +2156,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
>  	par->lock_blank = 0;
>  	atyfb_blank(FB_BLANK_UNBLANK, info);
> 
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	pdev->dev.power.power_state = PMSG_ON;
> 
> diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
> index 92bda58..a2f07da 100644
> --- a/drivers/video/aty/radeon_pm.c
> +++ b/drivers/video/aty/radeon_pm.c
> @@ -16,7 +16,6 @@
> 
>  #include "radeonfb.h"
> 
> -#include <linux/console.h>
>  #include <linux/agp_backend.h>
> 
>  #ifdef CONFIG_PPC_PMAC
> @@ -2626,7 +2625,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev,
> pm_message_t mesg)
>  		goto done;
>  	}
> 
> -	console_lock();
> +	fb_console_lock();
> 
>  	fb_set_suspend(info, 1);
> 
> @@ -2690,7 +2689,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev,
> pm_message_t mesg)
>  	if (rinfo->pm_mode & radeon_pm_d2)
>  		radeon_set_suspend(rinfo, 1);
> 
> -	console_unlock();
> +	fb_console_unlock();
> 
>   done:
>  	pdev->dev.power.power_state = mesg;
> @@ -2718,7 +2717,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
>  		if (!console_trylock())
>  			return 0;
>  	} else
> -		console_lock();
> +		fb_console_lock();
> 
>  	printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n",
>  	       pci_name(pdev), pdev->dev.power.power_state.event);
> @@ -2783,7 +2782,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
>  	pdev->dev.power.power_state = PMSG_ON;
> 
>   bail:
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return rc;
>  }
> diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
> index cff742a..d50fa6b 100644
> --- a/drivers/video/chipsfb.c
> +++ b/drivers/video/chipsfb.c
> @@ -460,10 +460,10 @@ static int chipsfb_pci_suspend(struct pci_dev
> *pdev, pm_message_t state)
>  	if (!(state.event & PM_EVENT_SLEEP))
>  		goto done;
> 
> -	console_lock();
> +	fb_console_lock();
>  	chipsfb_blank(1, p);
>  	fb_set_suspend(p, 1);
> -	console_unlock();
> +	fb_console_unlock();
>   done:
>  	pdev->dev.power.power_state = state;
>  	return 0;
> @@ -473,10 +473,10 @@ static int chipsfb_pci_resume(struct pci_dev *pdev)
>  {
>          struct fb_info *p = pci_get_drvdata(pdev);
> 
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(p, 0);
>  	chipsfb_blank(0, p);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	pdev->dev.power.power_state = PMSG_ON;
>  	return 0;
> diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
> index 7ae9d53..9a36bbc 100644
> --- a/drivers/video/da8xx-fb.c
> +++ b/drivers/video/da8xx-fb.c
> @@ -29,7 +29,6 @@
>  #include <linux/interrupt.h>
>  #include <linux/clk.h>
>  #include <linux/cpufreq.h>
> -#include <linux/console.h>
>  #include <linux/spinlock.h>
>  #include <linux/slab.h>
>  #include <linux/delay.h>
> @@ -1406,14 +1405,14 @@ static int fb_suspend(struct platform_device
> *dev, pm_message_t state)
>  	struct fb_info *info = platform_get_drvdata(dev);
>  	struct da8xx_fb_par *par = info->par;
> 
> -	console_lock();
> +	fb_console_lock();
>  	if (par->panel_power_ctrl)
>  		par->panel_power_ctrl(0);
> 
>  	fb_set_suspend(info, 1);
>  	lcd_disable_raster();
>  	clk_disable(par->lcdc_clk);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> @@ -1422,7 +1421,7 @@ static int fb_resume(struct platform_device *dev)
>  	struct fb_info *info = platform_get_drvdata(dev);
>  	struct da8xx_fb_par *par = info->par;
> 
> -	console_lock();
> +	fb_console_lock();
>  	clk_enable(par->lcdc_clk);
>  	lcd_enable_raster();
> 
> @@ -1430,7 +1429,7 @@ static int fb_resume(struct platform_device *dev)
>  		par->panel_power_ctrl(1);
> 
>  	fb_set_suspend(info, 0);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
> index 60a787f..87c8c4e 100644
> --- a/drivers/video/fb-puv3.c
> +++ b/drivers/video/fb-puv3.c
> @@ -17,7 +17,6 @@
>  #include <linux/clk.h>
>  #include <linux/fb.h>
>  #include <linux/init.h>
> -#include <linux/console.h>
> 
>  #include <asm/sizes.h>
>  #include <mach/hardware.h>
> @@ -759,7 +758,7 @@ static int unifb_resume(struct platform_device *dev)
>  	if (dev->dev.power.power_state.event = PM_EVENT_ON)
>  		return 0;
> 
> -	console_lock();
> +	fb_console_lock();
> 
>  	if (dev->dev.power.power_state.event = PM_EVENT_SUSPEND) {
>  		writel(unifb_regs[0], UDE_FSA);
> @@ -775,7 +774,7 @@ static int unifb_resume(struct platform_device *dev)
>  	}
>  	dev->dev.power.power_state = PMSG_ON;
> 
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return rc;
>  }
> @@ -804,11 +803,11 @@ static int unifb_suspend(struct platform_device
> *dev, pm_message_t mesg)
>  		goto done;
>  	}
> 
> -	console_lock();
> +	fb_console_lock();
> 
>  	/* do nothing... */
> 
> -	console_unlock();
> +	fb_console_unlock();
> 
>  done:
>  	dev->dev.power.power_state = mesg;
> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
> index 0dff12a..c2d4627 100644
> --- a/drivers/video/fbmem.c
> +++ b/drivers/video/fbmem.c
> @@ -85,6 +85,22 @@ EXPORT_SYMBOL(lock_fb_info);
>   * Helpers
>   */
> 
> +void fb_console_lock(void)
> +{
> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE
> +	console_lock();
> +#endif
> +}
> +EXPORT_SYMBOL(fb_console_lock);
> +
> +void fb_console_unlock(void)
> +{
> +#ifdef CONFIG_FRAMEBUFFER_CONSOLE
> +	console_unlock();
> +#endif
> +}
> +EXPORT_SYMBOL(fb_console_unlock);
> +
>  int fb_get_color_depth(struct fb_var_screeninfo *var,
>  		       struct fb_fix_screeninfo *fix)
>  {
> @@ -1101,11 +1117,11 @@ static long do_fb_ioctl(struct fb_info *info,
> unsigned int cmd,
>  			return -EFAULT;
>  		if (!lock_fb_info(info))
>  			return -ENODEV;
> -		console_lock();
> +		fb_console_lock();
>  		info->flags |= FBINFO_MISC_USEREVENT;
>  		ret = fb_set_var(info, &var);
>  		info->flags &= ~FBINFO_MISC_USEREVENT;
> -		console_unlock();
> +		fb_console_unlock();
>  		unlock_fb_info(info);
>  		if (!ret && copy_to_user(argp, &var, sizeof(var)))
>  			ret = -EFAULT;
> @@ -1137,9 +1153,9 @@ static long do_fb_ioctl(struct fb_info *info,
> unsigned int cmd,
>  			return -EFAULT;
>  		if (!lock_fb_info(info))
>  			return -ENODEV;
> -		console_lock();
> +		fb_console_lock();
>  		ret = fb_pan_display(info, &var);
> -		console_unlock();
> +		fb_console_unlock();
>  		unlock_fb_info(info);
>  		if (ret = 0 && copy_to_user(argp, &var, sizeof(var)))
>  			return -EFAULT;
> @@ -1184,11 +1200,11 @@ static long do_fb_ioctl(struct fb_info *info,
> unsigned int cmd,
>  	case FBIOBLANK:
>  		if (!lock_fb_info(info))
>  			return -ENODEV;
> -		console_lock();
> +		fb_console_lock();
>  		info->flags |= FBINFO_MISC_USEREVENT;
>  		ret = fb_blank(info, arg);
>  		info->flags &= ~FBINFO_MISC_USEREVENT;
> -		console_unlock();
> +		fb_console_unlock();
>  		unlock_fb_info(info);
>  		break;
>  	default:
> diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
> index a55e366..976d8f5 100644
> --- a/drivers/video/fbsysfs.c
> +++ b/drivers/video/fbsysfs.c
> @@ -18,7 +18,6 @@
>  #include <linux/kernel.h>
>  #include <linux/slab.h>
>  #include <linux/fb.h>
> -#include <linux/console.h>
>  #include <linux/module.h>
> 
>  #define FB_SYSFS_FLAG_ATTR 1
> @@ -92,11 +91,11 @@ static int activate(struct fb_info *fb_info,
> struct fb_var_screeninfo *var)
>  	int err;
> 
>  	var->activate |= FB_ACTIVATE_FORCE;
> -	console_lock();
> +	fb_console_lock();
>  	fb_info->flags |= FBINFO_MISC_USEREVENT;
>  	err = fb_set_var(fb_info, var);
>  	fb_info->flags &= ~FBINFO_MISC_USEREVENT;
> -	console_unlock();
> +	fb_console_unlock();
>  	if (err)
>  		return err;
>  	return 0;
> @@ -177,7 +176,7 @@ static ssize_t store_modes(struct device *device,
>  	if (i * sizeof(struct fb_videomode) != count)
>  		return -EINVAL;
> 
> -	console_lock();
> +	fb_console_lock();
>  	list_splice(&fb_info->modelist, &old_list);
>  	fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
>  				 &fb_info->modelist);
> @@ -187,7 +186,7 @@ static ssize_t store_modes(struct device *device,
>  	} else
>  		fb_destroy_modelist(&old_list);
> 
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> @@ -303,11 +302,11 @@ static ssize_t store_blank(struct device *device,
>  	char *last = NULL;
>  	int err;
> 
> -	console_lock();
> +	fb_console_lock();
>  	fb_info->flags |= FBINFO_MISC_USEREVENT;
>  	err = fb_blank(fb_info, simple_strtoul(buf, &last, 0));
>  	fb_info->flags &= ~FBINFO_MISC_USEREVENT;
> -	console_unlock();
> +	fb_console_unlock();
>  	if (err < 0)
>  		return err;
>  	return count;
> @@ -366,9 +365,9 @@ static ssize_t store_pan(struct device *device,
>  		return -EINVAL;
>  	var.yoffset = simple_strtoul(last, &last, 0);
> 
> -	console_lock();
> +	fb_console_lock();
>  	err = fb_pan_display(fb_info, &var);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	if (err < 0)
>  		return err;
> @@ -403,9 +402,9 @@ static ssize_t store_fbstate(struct device *device,
> 
>  	if (!lock_fb_info(fb_info))
>  		return -ENODEV;
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(fb_info, (int)state);
> -	console_unlock();
> +	fb_console_unlock();
>  	unlock_fb_info(fb_info);
> 
>  	return count;
> diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
> index b4f19db..ba7dd0a 100644
> --- a/drivers/video/geode/gxfb_core.c
> +++ b/drivers/video/geode/gxfb_core.c
> @@ -27,7 +27,6 @@
>  #include <linux/mm.h>
>  #include <linux/delay.h>
>  #include <linux/fb.h>
> -#include <linux/console.h>
>  #include <linux/suspend.h>
>  #include <linux/init.h>
>  #include <linux/pci.h>
> @@ -344,10 +343,10 @@ static int gxfb_suspend(struct pci_dev *pdev,
> pm_message_t state)
>  	struct fb_info *info = pci_get_drvdata(pdev);
> 
>  	if (state.event = PM_EVENT_SUSPEND) {
> -		console_lock();
> +		fb_console_lock();
>  		gx_powerdown(info);
>  		fb_set_suspend(info, 1);
> -		console_unlock();
> +		fb_console_unlock();
>  	}
> 
>  	/* there's no point in setting PCI states; we emulate PCI, so
> @@ -361,7 +360,7 @@ static int gxfb_resume(struct pci_dev *pdev)
>  	struct fb_info *info = pci_get_drvdata(pdev);
>  	int ret;
> 
> -	console_lock();
> +	fb_console_lock();
>  	ret = gx_powerup(info);
>  	if (ret) {
>  		printk(KERN_ERR "gxfb:  power up failed!\n");
> @@ -369,7 +368,7 @@ static int gxfb_resume(struct pci_dev *pdev)
>  	}
> 
>  	fb_set_suspend(info, 0);
> -	console_unlock();
> +	fb_console_unlock();
>  	return 0;
>  }
>  #endif
> diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
> index 416851c..5341bf1 100644
> --- a/drivers/video/geode/lxfb_core.c
> +++ b/drivers/video/geode/lxfb_core.c
> @@ -465,10 +465,10 @@ static int lxfb_suspend(struct pci_dev *pdev,
> pm_message_t state)
>  	struct fb_info *info = pci_get_drvdata(pdev);
> 
>  	if (state.event = PM_EVENT_SUSPEND) {
> -		console_lock();
> +		fb_console_lock();
>  		lx_powerdown(info);
>  		fb_set_suspend(info, 1);
> -		console_unlock();
> +		fb_console_unlock();
>  	}
> 
>  	/* there's no point in setting PCI states; we emulate PCI, so
> @@ -482,7 +482,7 @@ static int lxfb_resume(struct pci_dev *pdev)
>  	struct fb_info *info = pci_get_drvdata(pdev);
>  	int ret;
> 
> -	console_lock();
> +	fb_console_lock();
>  	ret = lx_powerup(info);
>  	if (ret) {
>  		printk(KERN_ERR "lxfb:  power up failed!\n");
> @@ -490,7 +490,7 @@ static int lxfb_resume(struct pci_dev *pdev)
>  	}
> 
>  	fb_set_suspend(info, 0);
> -	console_unlock();
> +	fb_console_unlock();
>  	return 0;
>  }
>  #else
> diff --git a/drivers/video/i740fb.c b/drivers/video/i740fb.c
> index ff3f880..b3fe538 100644
> --- a/drivers/video/i740fb.c
> +++ b/drivers/video/i740fb.c
> @@ -24,7 +24,6 @@
>  #include <linux/pci_ids.h>
>  #include <linux/i2c.h>
>  #include <linux/i2c-algo-bit.h>
> -#include <linux/console.h>
>  #include <video/vga.h>
> 
>  #ifdef CONFIG_MTRR
> @@ -1210,13 +1209,13 @@ static int i740fb_suspend(struct pci_dev *dev,
> pm_message_t state)
>  	if (state.event = PM_EVENT_FREEZE || state.event = PM_EVENT_PRETHAW)
>  		return 0;
> 
> -	console_lock();
> +	fb_console_lock();
>  	mutex_lock(&(par->open_lock));
> 
>  	/* do nothing if framebuffer is not active */
>  	if (par->ref_count = 0) {
>  		mutex_unlock(&(par->open_lock));
> -		console_unlock();
> +		fb_console_unlock();
>  		return 0;
>  	}
> 
> @@ -1227,7 +1226,7 @@ static int i740fb_suspend(struct pci_dev *dev,
> pm_message_t state)
>  	pci_set_power_state(dev, pci_choose_state(dev, state));
> 
>  	mutex_unlock(&(par->open_lock));
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> @@ -1237,7 +1236,7 @@ static int i740fb_resume(struct pci_dev *dev)
>  	struct fb_info *info = pci_get_drvdata(dev);
>  	struct i740fb_par *par = info->par;
> 
> -	console_lock();
> +	fb_console_lock();
>  	mutex_lock(&(par->open_lock));
> 
>  	if (par->ref_count = 0)
> @@ -1253,7 +1252,7 @@ static int i740fb_resume(struct pci_dev *dev)
> 
>  fail:
>  	mutex_unlock(&(par->open_lock));
> -	console_unlock();
> +	fb_console_unlock();
>  	return 0;
>  }
>  #else
> diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
> index b83f361..84fe1ed 100644
> --- a/drivers/video/i810/i810_main.c
> +++ b/drivers/video/i810/i810_main.c
> @@ -40,7 +40,6 @@
>  #include <linux/pci_ids.h>
>  #include <linux/resource.h>
>  #include <linux/unistd.h>
> -#include <linux/console.h>
> 
>  #include <asm/io.h>
>  #include <asm/div64.h>
> @@ -1574,7 +1573,7 @@ static int i810fb_suspend(struct pci_dev *dev,
> pm_message_t mesg)
>  		return 0;
>  	}
> 
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(info, 1);
> 
>  	if (info->fbops->fb_sync)
> @@ -1587,7 +1586,7 @@ static int i810fb_suspend(struct pci_dev *dev,
> pm_message_t mesg)
>  	pci_save_state(dev);
>  	pci_disable_device(dev);
>  	pci_set_power_state(dev, pci_choose_state(dev, mesg));
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> @@ -1605,7 +1604,7 @@ static int i810fb_resume(struct pci_dev *dev)
>  		return 0;
>  	}
> 
> -	console_lock();
> +	fb_console_lock();
>  	pci_set_power_state(dev, PCI_D0);
>  	pci_restore_state(dev);
> 
> @@ -1621,7 +1620,7 @@ static int i810fb_resume(struct pci_dev *dev)
>  	fb_set_suspend (info, 0);
>  	info->fbops->fb_blank(VESA_NO_BLANKING, info);
>  fail:
> -	console_unlock();
> +	fb_console_unlock();
>  	return 0;
>  }
>  /***********************************************************************
> diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
> index de36693..7e9301a 100644
> --- a/drivers/video/jz4740_fb.c
> +++ b/drivers/video/jz4740_fb.c
> @@ -21,7 +21,6 @@
>  #include <linux/clk.h>
>  #include <linux/delay.h>
> 
> -#include <linux/console.h>
>  #include <linux/fb.h>
> 
>  #include <linux/dma-mapping.h>
> @@ -778,9 +777,9 @@ static int jzfb_suspend(struct device *dev)
>  {
>  	struct jzfb *jzfb = dev_get_drvdata(dev);
> 
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(jzfb->fb, 1);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	mutex_lock(&jzfb->lock);
>  	if (jzfb->is_enabled)
> @@ -800,9 +799,9 @@ static int jzfb_resume(struct device *dev)
>  		jzfb_enable(jzfb);
>  	mutex_unlock(&jzfb->lock);
> 
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(jzfb->fb, 0);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
> index c89f8a8..da25fa1 100644
> --- a/drivers/video/mx3fb.c
> +++ b/drivers/video/mx3fb.c
> @@ -23,7 +23,6 @@
>  #include <linux/ioport.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/dmaengine.h>
> -#include <linux/console.h>
>  #include <linux/clk.h>
>  #include <linux/mutex.h>
> 
> @@ -1204,9 +1203,9 @@ static int mx3fb_suspend(struct platform_device
> *pdev, pm_message_t state)
>  	struct mx3fb_data *mx3fb = platform_get_drvdata(pdev);
>  	struct mx3fb_info *mx3_fbi = mx3fb->fbi->par;
> 
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(mx3fb->fbi, 1);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	if (mx3_fbi->blank = FB_BLANK_UNBLANK) {
>  		sdc_disable_channel(mx3_fbi);
> @@ -1229,9 +1228,9 @@ static int mx3fb_resume(struct platform_device *pdev)
>  		sdc_set_brightness(mx3fb, mx3fb->backlight_level);
>  	}
> 
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(mx3fb->fbi, 0);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
> index fe13ac5..f47eb2a 100644
> --- a/drivers/video/nvidia/nvidia.c
> +++ b/drivers/video/nvidia/nvidia.c
> @@ -19,7 +19,6 @@
>  #include <linux/fb.h>
>  #include <linux/init.h>
>  #include <linux/pci.h>
> -#include <linux/console.h>
>  #include <linux/backlight.h>
>  #ifdef CONFIG_MTRR
>  #include <asm/mtrr.h>
> @@ -1057,7 +1056,7 @@ static int nvidiafb_suspend(struct pci_dev *dev,
> pm_message_t mesg)
> 
>  	if (mesg.event = PM_EVENT_PRETHAW)
>  		mesg.event = PM_EVENT_FREEZE;
> -	console_lock();
> +	fb_console_lock();
>  	par->pm_state = mesg.event;
> 
>  	if (mesg.event & PM_EVENT_SLEEP) {
> @@ -1070,7 +1069,7 @@ static int nvidiafb_suspend(struct pci_dev *dev,
> pm_message_t mesg)
>  	}
>  	dev->dev.power.power_state = mesg;
> 
> -	console_unlock();
> +	fb_console_unlock();
>  	return 0;
>  }
> 
> @@ -1079,7 +1078,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
>  	struct fb_info *info = pci_get_drvdata(dev);
>  	struct nvidia_par *par = info->par;
> 
> -	console_lock();
> +	fb_console_lock();
>  	pci_set_power_state(dev, PCI_D0);
> 
>  	if (par->pm_state != PM_EVENT_FREEZE) {
> @@ -1097,7 +1096,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
>  	nvidiafb_blank(FB_BLANK_UNBLANK, info);
> 
>  fail:
> -	console_unlock();
> +	fb_console_unlock();
>  	return 0;
>  }
>  #else
> diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
> index 213fbbc..cb2e174 100644
> --- a/drivers/video/ps3fb.c
> +++ b/drivers/video/ps3fb.c
> @@ -23,7 +23,6 @@
>  #include <linux/string.h>
>  #include <linux/mm.h>
>  #include <linux/interrupt.h>
> -#include <linux/console.h>
>  #include <linux/ioctl.h>
>  #include <linux/kthread.h>
>  #include <linux/freezer.h>
> @@ -515,7 +514,7 @@ static int ps3fb_release(struct fb_info *info, int user)
>  			atomic_set(&ps3fb.ext_flip, 0);
>  			if (console_trylock()) {
>  				ps3fb_sync(info, 0);	/* single buffer */
> -				console_unlock();
> +				fb_console_unlock();
>  			}
>  		}
>  	}
> @@ -830,14 +829,14 @@ static int ps3fb_ioctl(struct fb_info *info,
> unsigned int cmd,
>  			if (vmode) {
>  				var = info->var;
>  				fb_videomode_to_var(&var, vmode);
> -				console_lock();
> +				fb_console_lock();
>  				info->flags |= FBINFO_MISC_USEREVENT;
>  				/* Force, in case only special bits changed */
>  				var.activate |= FB_ACTIVATE_FORCE;
>  				par->new_mode_id = val;
>  				retval = fb_set_var(info, &var);
>  				info->flags &= ~FBINFO_MISC_USEREVENT;
> -				console_unlock();
> +				fb_console_unlock();
>  			}
>  			break;
>  		}
> @@ -881,9 +880,9 @@ static int ps3fb_ioctl(struct fb_info *info,
> unsigned int cmd,
>  			break;
> 
>  		dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
> -		console_lock();
> +		fb_console_lock();
>  		retval = ps3fb_sync(info, val);
> -		console_unlock();
> +		fb_console_unlock();
>  		break;
> 
>  	default:
> @@ -903,9 +902,9 @@ static int ps3fbd(void *arg)
>  		set_current_state(TASK_INTERRUPTIBLE);
>  		if (ps3fb.is_kicked) {
>  			ps3fb.is_kicked = 0;
> -			console_lock();
> +			fb_console_lock();
>  			ps3fb_sync(info, 0);	/* single buffer */
> -			console_unlock();
> +			fb_console_unlock();
>  		}
>  		schedule();
>  	}
> diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
> index 3f90255..a1af212 100644
> --- a/drivers/video/pxafb.c
> +++ b/drivers/video/pxafb.c
> @@ -54,7 +54,6 @@
>  #include <linux/mutex.h>
>  #include <linux/kthread.h>
>  #include <linux/freezer.h>
> -#include <linux/console.h>
> 
>  #include <mach/hardware.h>
>  #include <asm/io.h>
> @@ -733,9 +732,9 @@ static int overlayfb_open(struct fb_info *info, int user)
> 
>  	if (ofb->usage++ = 0) {
>  		/* unblank the base framebuffer */
> -		console_lock();
> +		fb_console_lock();
>  		fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
> -		console_unlock();
> +		fb_console_unlock();
>  	}
> 
>  	return 0;
> diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
> index 1d00736..7759c82 100644
> --- a/drivers/video/s3fb.c
> +++ b/drivers/video/s3fb.c
> @@ -22,7 +22,6 @@
>  #include <linux/svga.h>
>  #include <linux/init.h>
>  #include <linux/pci.h>
> -#include <linux/console.h> /* Why should fb driver call console
> functions? because console_lock() */
>  #include <video/vga.h>
> 
>  #include <linux/i2c.h>
> @@ -1445,12 +1444,12 @@ static int s3_pci_suspend(struct pci_dev* dev,
> pm_message_t state)
> 
>  	dev_info(info->device, "suspend\n");
> 
> -	console_lock();
> +	fb_fb_console_lock();
>  	mutex_lock(&(par->open_lock));
> 
>  	if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
>  		mutex_unlock(&(par->open_lock));
> -		console_unlock();
> +		fb_console_unlock();
>  		return 0;
>  	}
> 
> @@ -1461,7 +1460,7 @@ static int s3_pci_suspend(struct pci_dev* dev,
> pm_message_t state)
>  	pci_set_power_state(dev, pci_choose_state(dev, state));
> 
>  	mutex_unlock(&(par->open_lock));
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> @@ -1477,12 +1476,12 @@ static int s3_pci_resume(struct pci_dev* dev)
> 
>  	dev_info(info->device, "resume\n");
> 
> -	console_lock();
> +	fb_fb_console_lock();
>  	mutex_lock(&(par->open_lock));
> 
>  	if (par->ref_count = 0) {
>  		mutex_unlock(&(par->open_lock));
> -		console_unlock();
> +		fb_console_unlock();
>  		return 0;
>  	}
> 
> @@ -1491,7 +1490,7 @@ static int s3_pci_resume(struct pci_dev* dev)
>  	err = pci_enable_device(dev);
>  	if (err) {
>  		mutex_unlock(&(par->open_lock));
> -		console_unlock();
> +		fb_console_unlock();
>  		dev_err(info->device, "error %d enabling device for resume\n", err);
>  		return err;
>  	}
> @@ -1501,7 +1500,7 @@ static int s3_pci_resume(struct pci_dev* dev)
>  	fb_set_suspend(info, 0);
> 
>  	mutex_unlock(&(par->open_lock));
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> diff --git a/drivers/video/savage/savagefb_driver.c
> b/drivers/video/savage/savagefb_driver.c
> index 0d0f52c..bf64221 100644
> --- a/drivers/video/savage/savagefb_driver.c
> +++ b/drivers/video/savage/savagefb_driver.c
> @@ -51,7 +51,6 @@
>  #include <linux/fb.h>
>  #include <linux/pci.h>
>  #include <linux/init.h>
> -#include <linux/console.h>
> 
>  #include <asm/io.h>
>  #include <asm/irq.h>
> @@ -2391,7 +2390,7 @@ static int savagefb_suspend(struct pci_dev *dev,
> pm_message_t mesg)
>  	if (mesg.event = PM_EVENT_FREEZE)
>  		return 0;
> 
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(info, 1);
> 
>  	if (info->fbops->fb_sync)
> @@ -2403,7 +2402,7 @@ static int savagefb_suspend(struct pci_dev *dev,
> pm_message_t mesg)
>  	pci_save_state(dev);
>  	pci_disable_device(dev);
>  	pci_set_power_state(dev, pci_choose_state(dev, mesg));
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> @@ -2427,7 +2426,7 @@ static int savagefb_resume(struct pci_dev* dev)
>  		return 0;
>  	}
> 
> -	console_lock();
> +	fb_console_lock();
> 
>  	pci_set_power_state(dev, PCI_D0);
>  	pci_restore_state(dev);
> @@ -2441,7 +2440,7 @@ static int savagefb_resume(struct pci_dev* dev)
>  	savagefb_set_par(info);
>  	fb_set_suspend(info, 0);
>  	savagefb_blank(FB_BLANK_UNBLANK, info);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
> index 699487c..2bc1119 100644
> --- a/drivers/video/sh_mobile_lcdcfb.c
> +++ b/drivers/video/sh_mobile_lcdcfb.c
> @@ -11,7 +11,6 @@
>  #include <linux/atomic.h>
>  #include <linux/backlight.h>
>  #include <linux/clk.h>
> -#include <linux/console.h>
>  #include <linux/ctype.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/delay.h>
> @@ -575,7 +574,7 @@ static int sh_mobile_lcdc_display_notify(struct
> sh_mobile_lcdc_chan *ch,
>  	case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT:
>  		/* HDMI plug in */
>  		if (lock_fb_info(info)) {
> -			console_lock();
> +			fb_console_lock();
> 
>  			ch->display.width = monspec->max_x * 10;
>  			ch->display.height = monspec->max_y * 10;
> @@ -594,7 +593,7 @@ static int sh_mobile_lcdc_display_notify(struct
> sh_mobile_lcdc_chan *ch,
>  				fb_set_suspend(info, 0);
>  			}
> 
> -			console_unlock();
> +			fb_console_unlock();
>  			unlock_fb_info(info);
>  		}
>  		break;
> @@ -602,9 +601,9 @@ static int sh_mobile_lcdc_display_notify(struct
> sh_mobile_lcdc_chan *ch,
>  	case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT:
>  		/* HDMI disconnect */
>  		if (lock_fb_info(info)) {
> -			console_lock();
> +			fb_console_lock();
>  			fb_set_suspend(info, 1);
> -			console_unlock();
> +			fb_console_unlock();
>  			unlock_fb_info(info);
>  		}
>  		break;
> @@ -1934,9 +1933,9 @@ static int sh_mobile_lcdc_release(struct fb_info
> *info, int user)
> 
>  	/* Nothing to reconfigure, when called from fbcon */
>  	if (user) {
> -		console_lock();
> +		fb_console_lock();
>  		sh_mobile_fb_reconfig(info);
> -		console_unlock();
> +		fb_console_unlock();
>  	}
> 
>  	mutex_unlock(&ch->open_lock);
> diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
> index 3690eff..536f922 100644
> --- a/drivers/video/sm501fb.c
> +++ b/drivers/video/sm501fb.c
> @@ -28,7 +28,6 @@
>  #include <linux/wait.h>
>  #include <linux/platform_device.h>
>  #include <linux/clk.h>
> -#include <linux/console.h>
>  #include <linux/io.h>
> 
>  #include <asm/uaccess.h>
> @@ -2104,9 +2103,9 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info,
> 
>  	/* tell console/fb driver we are suspending */
> 
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(fbi, 1);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	/* backup copies in case chip is powered down over suspend */
> 
> @@ -2163,9 +2162,9 @@ static void sm501fb_resume_fb(struct sm501fb_info *info,
>  		memcpy_toio(par->cursor.k_addr, par->store_cursor,
>  			    par->cursor.size);
> 
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(fbi, 0);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	vfree(par->store_fb);
>  	vfree(par->store_cursor);
> diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c
> index 8e4a446..e266b6b 100644
> --- a/drivers/video/tmiofb.c
> +++ b/drivers/video/tmiofb.c
> @@ -25,8 +25,7 @@
>  #include <linux/fb.h>
>  #include <linux/interrupt.h>
>  #include <linux/delay.h>
> -/* Why should fb driver call console functions? because console_lock() */
> -#include <linux/console.h>
> +/* Why should fb driver call console functions? because fb_console_lock() */
>  #include <linux/mfd/core.h>
>  #include <linux/mfd/tmio.h>
>  #include <linux/uaccess.h>
> @@ -938,7 +937,7 @@ static int tmiofb_suspend(struct platform_device
> *dev, pm_message_t state)
>  	const struct mfd_cell *cell = mfd_get_cell(dev);
>  	int retval = 0;
> 
> -	console_lock();
> +	fb_console_lock();
> 
>  	fb_set_suspend(info, 1);
> 
> @@ -959,7 +958,7 @@ static int tmiofb_suspend(struct platform_device
> *dev, pm_message_t state)
>  	if (cell->suspend)
>  		retval = cell->suspend(dev);
> 
> -	console_unlock();
> +	fb_fb_console_unlock();
> 
>  	return retval;
>  }
> @@ -970,7 +969,7 @@ static int tmiofb_resume(struct platform_device *dev)
>  	const struct mfd_cell *cell = mfd_get_cell(dev);
>  	int retval = 0;
> 
> -	console_lock();
> +	fb_console_lock();
> 
>  	if (cell->resume) {
>  		retval = cell->resume(dev);
> @@ -986,7 +985,7 @@ static int tmiofb_resume(struct platform_device *dev)
> 
>  	fb_set_suspend(info, 0);
>  out:
> -	console_unlock();
> +	fb_fb_console_unlock();
>  	return retval;
>  }
>  #else
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index c80e770..d36b173 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -1698,17 +1698,17 @@ static int parse_mode(const char *str, u32
> devices, u32 *xres, u32 *yres)
>  #ifdef CONFIG_PM
>  static int viafb_suspend(void *unused)
>  {
> -	console_lock();
> +	fb_console_lock();
>  	fb_set_suspend(viafbinfo, 1);
>  	viafb_sync(viafbinfo);
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> 
>  static int viafb_resume(void *unused)
>  {
> -	console_lock();
> +	fb_console_lock();
>  	if (viaparinfo->shared->vdev->engine_mmio)
>  		viafb_reset_engine(viaparinfo);
>  	viafb_set_par(viafbinfo);
> @@ -1716,7 +1716,7 @@ static int viafb_resume(void *unused)
>  		viafb_set_par(viafbinfo1);
>  	fb_set_suspend(viafbinfo, 0);
> 
> -	console_unlock();
> +	fb_console_unlock();
>  	return 0;
>  }
> 
> diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
> index 4e74d26..cb48d4d 100644
> --- a/drivers/video/vt8623fb.c
> +++ b/drivers/video/vt8623fb.c
> @@ -23,7 +23,6 @@
>  #include <linux/svga.h>
>  #include <linux/init.h>
>  #include <linux/pci.h>
> -#include <linux/console.h> /* Why should fb driver call console
> functions? because console_lock() */
>  #include <video/vga.h>
> 
>  #ifdef CONFIG_MTRR
> @@ -845,12 +844,12 @@ static int vt8623_pci_suspend(struct pci_dev*
> dev, pm_message_t state)
> 
>  	dev_info(info->device, "suspend\n");
> 
> -	console_lock();
> +	fb_console_lock();
>  	mutex_lock(&(par->open_lock));
> 
>  	if ((state.event = PM_EVENT_FREEZE) || (par->ref_count = 0)) {
>  		mutex_unlock(&(par->open_lock));
> -		console_unlock();
> +		fb_console_unlock();
>  		return 0;
>  	}
> 
> @@ -861,7 +860,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev,
> pm_message_t state)
>  	pci_set_power_state(dev, pci_choose_state(dev, state));
> 
>  	mutex_unlock(&(par->open_lock));
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> @@ -876,7 +875,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
> 
>  	dev_info(info->device, "resume\n");
> 
> -	console_lock();
> +	fb_console_lock();
>  	mutex_lock(&(par->open_lock));
> 
>  	if (par->ref_count = 0)
> @@ -895,7 +894,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
> 
>  fail:
>  	mutex_unlock(&(par->open_lock));
> -	console_unlock();
> +	fb_console_unlock();
> 
>  	return 0;
>  }
> diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
> index b7f5173..770397e7 100644
> --- a/drivers/video/xen-fbfront.c
> +++ b/drivers/video/xen-fbfront.c
> @@ -18,7 +18,6 @@
>   * frame buffer.
>   */
> 
> -#include <linux/console.h>
>  #include <linux/kernel.h>
>  #include <linux/errno.h>
>  #include <linux/fb.h>
> @@ -495,12 +494,12 @@ xenfb_make_preferred_console(void)
>  	if (console_set_on_cmdline)
>  		return;
> 
> -	console_lock();
> +	fb_console_lock();
>  	for_each_console(c) {
>  		if (!strcmp(c->name, "tty") && c->index = 0)
>  			break;
>  	}
> -	console_unlock();
> +	fb_console_unlock();
>  	if (c) {
>  		unregister_console(c);
>  		c->flags |= CON_CONSDEV;
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index ac3f1c6..7ae96ad 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -1021,6 +1021,8 @@ extern int fb_get_color_depth(struct
> fb_var_screeninfo *var,
>  			      struct fb_fix_screeninfo *fix);
>  extern int fb_get_options(char *name, char **option);
>  extern int fb_new_modelist(struct fb_info *info);
> +extern void fb_console_unlock(void);
> +extern void fb_console_lock(void);
> 
>  extern struct fb_info *registered_fb[FB_MAX];
>  extern int num_registered_fb;



^ permalink raw reply

* Re: [PATCHv3 1/4] video: mmp display subsystem
From: Zhou Zhu @ 2012-09-29  5:34 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1347007704-27645-1-git-send-email-zzhu3@marvell.com>

Hi, Florian,
Would you please help to review my patches? Thanks!

On Fri, Sep 21, 2012 at 3:50 PM, Zhou Zhu <zzhu84@gmail.com> wrote:
> Hi, Florian,
> Would you please help to apply these patches?
> Looks they have already been submitted for a long time, and no more
> review comments recently.
> Thank you for your help!
>
>> On Fri, Sep 7, 2012 at 4:48 PM, Zhou Zhu <zzhu3@marvell.com> wrote:
>>> Added mmp display subsystem to support Marvell MMP display controllers.
>>>
>>> This subsystem contains 4 parts:
>>> --fb folder
>>> --core.c
>>> --hw folder
>>> --panel folder
>>>
>>> 1. fb folder contains implementation of fb.
>>> fb get path and ovly from common interface and operates on these structures.
>>>
>>> 2. core.c provides common interface for a hardware abstraction.
>>> Major parts of this interface are:
>>> a) Path: path is a output device connected to a panel or HDMI TV.
>>> Main operations of the path is set/get timing/output color.
>>> fb operates output device through path structure.
>>> b) Ovly: Ovly is a buffer shown on the path.
>>> Ovly describes frame buffer and its source/destination size, offset, input
>>> color, buffer address, z-order, and so on.
>>> Each fb device maps to one ovly.
>>>
>>> 3. hw folder contains implementation of hardware operations defined by core.c.
>>> It registers paths for fb use.
>>>
>>> 4. panel folder contains implementation of panels.
>>> It's connected to path. Panel drivers would also regiester panels and linked
>>> to path when probe.
>>>
>>> Signed-off-by: Zhou Zhu <zzhu3@marvell.com>
>>> Signed-off-by: Lisa Du <cldu@marvell.com>
>>
>> Thanks,
>> -Zhou
>
> --
> Thanks,
> -Zhou

-- 
Thanks,
-Zhou

^ permalink raw reply

* [PATCH] fb: only enable console lock in fb for VGA console
From: Jun Nie @ 2012-09-29  5:29 UTC (permalink / raw)
  To: linux-fbdev

[-- Attachment #1: Type: text/plain, Size: 35152 bytes --]

If VGA console is not enable, we do not have to
involve console lock/unlock in FB framework to avoid
hold the lock unnecessarily. Otherwise, UART console
output may be blocked by FB pan_display etc operations,
which hold the console lock. This may block the
panic log out on UART, where the lock may never be
released by FB.

Signed-off-by: Jun Nie <njun@marvell.com>
---
 drivers/video/arkfb.c                  |   11 +++++------
 drivers/video/aty/aty128fb.c           |   11 +++++------
 drivers/video/aty/atyfb_base.c         |   11 +++++------
 drivers/video/aty/radeon_pm.c          |    9 ++++-----
 drivers/video/chipsfb.c                |    8 ++++----
 drivers/video/da8xx-fb.c               |    9 ++++-----
 drivers/video/fb-puv3.c                |    9 ++++-----
 drivers/video/fbmem.c                  |   28 ++++++++++++++++++++++------
 drivers/video/fbsysfs.c                |   21 ++++++++++-----------
 drivers/video/geode/gxfb_core.c        |    9 ++++-----
 drivers/video/geode/lxfb_core.c        |    8 ++++----
 drivers/video/i740fb.c                 |   11 +++++------
 drivers/video/i810/i810_main.c         |    9 ++++-----
 drivers/video/jz4740_fb.c              |    9 ++++-----
 drivers/video/mx3fb.c                  |    9 ++++-----
 drivers/video/nvidia/nvidia.c          |    9 ++++-----
 drivers/video/ps3fb.c                  |   15 +++++++--------
 drivers/video/pxafb.c                  |    5 ++---
 drivers/video/s3fb.c                   |   15 +++++++--------
 drivers/video/savage/savagefb_driver.c |    9 ++++-----
 drivers/video/sh_mobile_lcdcfb.c       |   13 ++++++-------
 drivers/video/sm501fb.c                |    9 ++++-----
 drivers/video/tmiofb.c                 |   11 +++++------
 drivers/video/via/viafbdev.c           |    8 ++++----
 drivers/video/vt8623fb.c               |   11 +++++------
 drivers/video/xen-fbfront.c            |    5 ++---
 include/linux/fb.h                     |    2 ++
 27 files changed, 140 insertions(+), 144 deletions(-)

diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
index 555dd4c..774d902 100644
--- a/drivers/video/arkfb.c
+++ b/drivers/video/arkfb.c
@@ -23,7 +23,6 @@
 #include <linux/svga.h>
 #include <linux/init.h>
 #include <linux/pci.h>
-#include <linux/console.h> /* Why should fb driver call console
functions? because console_lock() */
 #include <video/vga.h>

 #ifdef CONFIG_MTRR
@@ -1124,12 +1123,12 @@ static int ark_pci_suspend (struct pci_dev*
dev, pm_message_t state)

 	dev_info(info->device, "suspend\n");

-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));

 	if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		return 0;
 	}

@@ -1140,7 +1139,7 @@ static int ark_pci_suspend (struct pci_dev* dev,
pm_message_t state)
 	pci_set_power_state(dev, pci_choose_state(dev, state));

 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
@@ -1155,7 +1154,7 @@ static int ark_pci_resume (struct pci_dev* dev)

 	dev_info(info->device, "resume\n");

-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));

 	if (par->ref_count == 0)
@@ -1174,7 +1173,7 @@ static int ark_pci_resume (struct pci_dev* dev)

 fail:
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 #else
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 747442d..1c6b80b 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -60,7 +60,6 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/ioport.h>
-#include <linux/console.h>
 #include <linux/backlight.h>
 #include <asm/io.h>

@@ -1884,7 +1883,7 @@ static void aty128_early_resume(void *data)
 		return;
 	pci_restore_state(par->pdev);
 	aty128_do_resume(par->pdev);
-	console_unlock();
+	fb_console_unlock();
 }
 #endif /* CONFIG_PPC_PMAC */

@@ -2461,7 +2460,7 @@ static int aty128_pci_suspend(struct pci_dev
*pdev, pm_message_t state)

 	printk(KERN_DEBUG "aty128fb: suspending...\n");
 	
-	console_lock();
+	fb_console_lock();

 	fb_set_suspend(info, 1);

@@ -2493,7 +2492,7 @@ static int aty128_pci_suspend(struct pci_dev
*pdev, pm_message_t state)
 	if (state.event != PM_EVENT_ON)
 		aty128_set_suspend(par, 1);

-	console_unlock();
+	fb_console_unlock();

 	pdev->dev.power.power_state = state;

@@ -2550,9 +2549,9 @@ static int aty128_pci_resume(struct pci_dev *pdev)
 {
 	int rc;

-	console_lock();
+	fb_console_lock();
 	rc = aty128_do_resume(pdev);
-	console_unlock();
+	fb_console_unlock();

 	return rc;
 }
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 3f2e8c1..9bb15ab 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -58,7 +58,6 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/delay.h>
-#include <linux/console.h>
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/pci.h>
@@ -2065,7 +2064,7 @@ static int atyfb_pci_suspend(struct pci_dev
*pdev, pm_message_t state)
 	if (state.event == pdev->dev.power.power_state.event)
 		return 0;

-	console_lock();
+	fb_console_lock();

 	fb_set_suspend(info, 1);

@@ -2093,14 +2092,14 @@ static int atyfb_pci_suspend(struct pci_dev
*pdev, pm_message_t state)
 		par->lock_blank = 0;
 		atyfb_blank(FB_BLANK_UNBLANK, info);
 		fb_set_suspend(info, 0);
-		console_unlock();
+		fb_console_unlock();
 		return -EIO;
 	}
 #else
 	pci_set_power_state(pdev, pci_choose_state(pdev, state));
 #endif

-	console_unlock();
+	fb_console_unlock();

 	pdev->dev.power.power_state = state;

@@ -2129,7 +2128,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
 	if (pdev->dev.power.power_state.event == PM_EVENT_ON)
 		return 0;

-	console_lock();
+	fb_console_lock();

 	/*
 	 * PCI state will have been restored by the core, so
@@ -2157,7 +2156,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
 	par->lock_blank = 0;
 	atyfb_blank(FB_BLANK_UNBLANK, info);

-	console_unlock();
+	fb_console_unlock();

 	pdev->dev.power.power_state = PMSG_ON;

diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index 92bda58..a2f07da 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -16,7 +16,6 @@

 #include "radeonfb.h"

-#include <linux/console.h>
 #include <linux/agp_backend.h>

 #ifdef CONFIG_PPC_PMAC
@@ -2626,7 +2625,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev,
pm_message_t mesg)
 		goto done;
 	}

-	console_lock();
+	fb_console_lock();

 	fb_set_suspend(info, 1);

@@ -2690,7 +2689,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev,
pm_message_t mesg)
 	if (rinfo->pm_mode & radeon_pm_d2)
 		radeon_set_suspend(rinfo, 1);

-	console_unlock();
+	fb_console_unlock();

  done:
 	pdev->dev.power.power_state = mesg;
@@ -2718,7 +2717,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
 		if (!console_trylock())
 			return 0;
 	} else
-		console_lock();
+		fb_console_lock();

 	printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n",
 	       pci_name(pdev), pdev->dev.power.power_state.event);
@@ -2783,7 +2782,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
 	pdev->dev.power.power_state = PMSG_ON;

  bail:
-	console_unlock();
+	fb_console_unlock();

 	return rc;
 }
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
index cff742a..d50fa6b 100644
--- a/drivers/video/chipsfb.c
+++ b/drivers/video/chipsfb.c
@@ -460,10 +460,10 @@ static int chipsfb_pci_suspend(struct pci_dev
*pdev, pm_message_t state)
 	if (!(state.event & PM_EVENT_SLEEP))
 		goto done;

-	console_lock();
+	fb_console_lock();
 	chipsfb_blank(1, p);
 	fb_set_suspend(p, 1);
-	console_unlock();
+	fb_console_unlock();
  done:
 	pdev->dev.power.power_state = state;
 	return 0;
@@ -473,10 +473,10 @@ static int chipsfb_pci_resume(struct pci_dev *pdev)
 {
         struct fb_info *p = pci_get_drvdata(pdev);

-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(p, 0);
 	chipsfb_blank(0, p);
-	console_unlock();
+	fb_console_unlock();

 	pdev->dev.power.power_state = PMSG_ON;
 	return 0;
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 7ae9d53..9a36bbc 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -29,7 +29,6 @@
 #include <linux/interrupt.h>
 #include <linux/clk.h>
 #include <linux/cpufreq.h>
-#include <linux/console.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -1406,14 +1405,14 @@ static int fb_suspend(struct platform_device
*dev, pm_message_t state)
 	struct fb_info *info = platform_get_drvdata(dev);
 	struct da8xx_fb_par *par = info->par;

-	console_lock();
+	fb_console_lock();
 	if (par->panel_power_ctrl)
 		par->panel_power_ctrl(0);

 	fb_set_suspend(info, 1);
 	lcd_disable_raster();
 	clk_disable(par->lcdc_clk);
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
@@ -1422,7 +1421,7 @@ static int fb_resume(struct platform_device *dev)
 	struct fb_info *info = platform_get_drvdata(dev);
 	struct da8xx_fb_par *par = info->par;

-	console_lock();
+	fb_console_lock();
 	clk_enable(par->lcdc_clk);
 	lcd_enable_raster();

@@ -1430,7 +1429,7 @@ static int fb_resume(struct platform_device *dev)
 		par->panel_power_ctrl(1);

 	fb_set_suspend(info, 0);
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
index 60a787f..87c8c4e 100644
--- a/drivers/video/fb-puv3.c
+++ b/drivers/video/fb-puv3.c
@@ -17,7 +17,6 @@
 #include <linux/clk.h>
 #include <linux/fb.h>
 #include <linux/init.h>
-#include <linux/console.h>

 #include <asm/sizes.h>
 #include <mach/hardware.h>
@@ -759,7 +758,7 @@ static int unifb_resume(struct platform_device *dev)
 	if (dev->dev.power.power_state.event == PM_EVENT_ON)
 		return 0;

-	console_lock();
+	fb_console_lock();

 	if (dev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
 		writel(unifb_regs[0], UDE_FSA);
@@ -775,7 +774,7 @@ static int unifb_resume(struct platform_device *dev)
 	}
 	dev->dev.power.power_state = PMSG_ON;

-	console_unlock();
+	fb_console_unlock();

 	return rc;
 }
@@ -804,11 +803,11 @@ static int unifb_suspend(struct platform_device
*dev, pm_message_t mesg)
 		goto done;
 	}

-	console_lock();
+	fb_console_lock();

 	/* do nothing... */

-	console_unlock();
+	fb_console_unlock();

 done:
 	dev->dev.power.power_state = mesg;
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 0dff12a..c2d4627 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -85,6 +85,22 @@ EXPORT_SYMBOL(lock_fb_info);
  * Helpers
  */

+void fb_console_lock(void)
+{
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE
+	console_lock();
+#endif
+}
+EXPORT_SYMBOL(fb_console_lock);
+
+void fb_console_unlock(void)
+{
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE
+	console_unlock();
+#endif
+}
+EXPORT_SYMBOL(fb_console_unlock);
+
 int fb_get_color_depth(struct fb_var_screeninfo *var,
 		       struct fb_fix_screeninfo *fix)
 {
@@ -1101,11 +1117,11 @@ static long do_fb_ioctl(struct fb_info *info,
unsigned int cmd,
 			return -EFAULT;
 		if (!lock_fb_info(info))
 			return -ENODEV;
-		console_lock();
+		fb_console_lock();
 		info->flags |= FBINFO_MISC_USEREVENT;
 		ret = fb_set_var(info, &var);
 		info->flags &= ~FBINFO_MISC_USEREVENT;
-		console_unlock();
+		fb_console_unlock();
 		unlock_fb_info(info);
 		if (!ret && copy_to_user(argp, &var, sizeof(var)))
 			ret = -EFAULT;
@@ -1137,9 +1153,9 @@ static long do_fb_ioctl(struct fb_info *info,
unsigned int cmd,
 			return -EFAULT;
 		if (!lock_fb_info(info))
 			return -ENODEV;
-		console_lock();
+		fb_console_lock();
 		ret = fb_pan_display(info, &var);
-		console_unlock();
+		fb_console_unlock();
 		unlock_fb_info(info);
 		if (ret == 0 && copy_to_user(argp, &var, sizeof(var)))
 			return -EFAULT;
@@ -1184,11 +1200,11 @@ static long do_fb_ioctl(struct fb_info *info,
unsigned int cmd,
 	case FBIOBLANK:
 		if (!lock_fb_info(info))
 			return -ENODEV;
-		console_lock();
+		fb_console_lock();
 		info->flags |= FBINFO_MISC_USEREVENT;
 		ret = fb_blank(info, arg);
 		info->flags &= ~FBINFO_MISC_USEREVENT;
-		console_unlock();
+		fb_console_unlock();
 		unlock_fb_info(info);
 		break;
 	default:
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index a55e366..976d8f5 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -18,7 +18,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/fb.h>
-#include <linux/console.h>
 #include <linux/module.h>

 #define FB_SYSFS_FLAG_ATTR 1
@@ -92,11 +91,11 @@ static int activate(struct fb_info *fb_info,
struct fb_var_screeninfo *var)
 	int err;

 	var->activate |= FB_ACTIVATE_FORCE;
-	console_lock();
+	fb_console_lock();
 	fb_info->flags |= FBINFO_MISC_USEREVENT;
 	err = fb_set_var(fb_info, var);
 	fb_info->flags &= ~FBINFO_MISC_USEREVENT;
-	console_unlock();
+	fb_console_unlock();
 	if (err)
 		return err;
 	return 0;
@@ -177,7 +176,7 @@ static ssize_t store_modes(struct device *device,
 	if (i * sizeof(struct fb_videomode) != count)
 		return -EINVAL;

-	console_lock();
+	fb_console_lock();
 	list_splice(&fb_info->modelist, &old_list);
 	fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
 				 &fb_info->modelist);
@@ -187,7 +186,7 @@ static ssize_t store_modes(struct device *device,
 	} else
 		fb_destroy_modelist(&old_list);

-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
@@ -303,11 +302,11 @@ static ssize_t store_blank(struct device *device,
 	char *last = NULL;
 	int err;

-	console_lock();
+	fb_console_lock();
 	fb_info->flags |= FBINFO_MISC_USEREVENT;
 	err = fb_blank(fb_info, simple_strtoul(buf, &last, 0));
 	fb_info->flags &= ~FBINFO_MISC_USEREVENT;
-	console_unlock();
+	fb_console_unlock();
 	if (err < 0)
 		return err;
 	return count;
@@ -366,9 +365,9 @@ static ssize_t store_pan(struct device *device,
 		return -EINVAL;
 	var.yoffset = simple_strtoul(last, &last, 0);

-	console_lock();
+	fb_console_lock();
 	err = fb_pan_display(fb_info, &var);
-	console_unlock();
+	fb_console_unlock();

 	if (err < 0)
 		return err;
@@ -403,9 +402,9 @@ static ssize_t store_fbstate(struct device *device,

 	if (!lock_fb_info(fb_info))
 		return -ENODEV;
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(fb_info, (int)state);
-	console_unlock();
+	fb_console_unlock();
 	unlock_fb_info(fb_info);

 	return count;
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index b4f19db..ba7dd0a 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -27,7 +27,6 @@
 #include <linux/mm.h>
 #include <linux/delay.h>
 #include <linux/fb.h>
-#include <linux/console.h>
 #include <linux/suspend.h>
 #include <linux/init.h>
 #include <linux/pci.h>
@@ -344,10 +343,10 @@ static int gxfb_suspend(struct pci_dev *pdev,
pm_message_t state)
 	struct fb_info *info = pci_get_drvdata(pdev);

 	if (state.event == PM_EVENT_SUSPEND) {
-		console_lock();
+		fb_console_lock();
 		gx_powerdown(info);
 		fb_set_suspend(info, 1);
-		console_unlock();
+		fb_console_unlock();
 	}

 	/* there's no point in setting PCI states; we emulate PCI, so
@@ -361,7 +360,7 @@ static int gxfb_resume(struct pci_dev *pdev)
 	struct fb_info *info = pci_get_drvdata(pdev);
 	int ret;

-	console_lock();
+	fb_console_lock();
 	ret = gx_powerup(info);
 	if (ret) {
 		printk(KERN_ERR "gxfb:  power up failed!\n");
@@ -369,7 +368,7 @@ static int gxfb_resume(struct pci_dev *pdev)
 	}

 	fb_set_suspend(info, 0);
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 #endif
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
index 416851c..5341bf1 100644
--- a/drivers/video/geode/lxfb_core.c
+++ b/drivers/video/geode/lxfb_core.c
@@ -465,10 +465,10 @@ static int lxfb_suspend(struct pci_dev *pdev,
pm_message_t state)
 	struct fb_info *info = pci_get_drvdata(pdev);

 	if (state.event == PM_EVENT_SUSPEND) {
-		console_lock();
+		fb_console_lock();
 		lx_powerdown(info);
 		fb_set_suspend(info, 1);
-		console_unlock();
+		fb_console_unlock();
 	}

 	/* there's no point in setting PCI states; we emulate PCI, so
@@ -482,7 +482,7 @@ static int lxfb_resume(struct pci_dev *pdev)
 	struct fb_info *info = pci_get_drvdata(pdev);
 	int ret;

-	console_lock();
+	fb_console_lock();
 	ret = lx_powerup(info);
 	if (ret) {
 		printk(KERN_ERR "lxfb:  power up failed!\n");
@@ -490,7 +490,7 @@ static int lxfb_resume(struct pci_dev *pdev)
 	}

 	fb_set_suspend(info, 0);
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 #else
diff --git a/drivers/video/i740fb.c b/drivers/video/i740fb.c
index ff3f880..b3fe538 100644
--- a/drivers/video/i740fb.c
+++ b/drivers/video/i740fb.c
@@ -24,7 +24,6 @@
 #include <linux/pci_ids.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
-#include <linux/console.h>
 #include <video/vga.h>

 #ifdef CONFIG_MTRR
@@ -1210,13 +1209,13 @@ static int i740fb_suspend(struct pci_dev *dev,
pm_message_t state)
 	if (state.event == PM_EVENT_FREEZE || state.event == PM_EVENT_PRETHAW)
 		return 0;

-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));

 	/* do nothing if framebuffer is not active */
 	if (par->ref_count == 0) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		return 0;
 	}

@@ -1227,7 +1226,7 @@ static int i740fb_suspend(struct pci_dev *dev,
pm_message_t state)
 	pci_set_power_state(dev, pci_choose_state(dev, state));

 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
@@ -1237,7 +1236,7 @@ static int i740fb_resume(struct pci_dev *dev)
 	struct fb_info *info = pci_get_drvdata(dev);
 	struct i740fb_par *par = info->par;

-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));

 	if (par->ref_count == 0)
@@ -1253,7 +1252,7 @@ static int i740fb_resume(struct pci_dev *dev)

 fail:
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 #else
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index b83f361..84fe1ed 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -40,7 +40,6 @@
 #include <linux/pci_ids.h>
 #include <linux/resource.h>
 #include <linux/unistd.h>
-#include <linux/console.h>

 #include <asm/io.h>
 #include <asm/div64.h>
@@ -1574,7 +1573,7 @@ static int i810fb_suspend(struct pci_dev *dev,
pm_message_t mesg)
 		return 0;
 	}

-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(info, 1);

 	if (info->fbops->fb_sync)
@@ -1587,7 +1586,7 @@ static int i810fb_suspend(struct pci_dev *dev,
pm_message_t mesg)
 	pci_save_state(dev);
 	pci_disable_device(dev);
 	pci_set_power_state(dev, pci_choose_state(dev, mesg));
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
@@ -1605,7 +1604,7 @@ static int i810fb_resume(struct pci_dev *dev)
 		return 0;
 	}

-	console_lock();
+	fb_console_lock();
 	pci_set_power_state(dev, PCI_D0);
 	pci_restore_state(dev);

@@ -1621,7 +1620,7 @@ static int i810fb_resume(struct pci_dev *dev)
 	fb_set_suspend (info, 0);
 	info->fbops->fb_blank(VESA_NO_BLANKING, info);
 fail:
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 /***********************************************************************
diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
index de36693..7e9301a 100644
--- a/drivers/video/jz4740_fb.c
+++ b/drivers/video/jz4740_fb.c
@@ -21,7 +21,6 @@
 #include <linux/clk.h>
 #include <linux/delay.h>

-#include <linux/console.h>
 #include <linux/fb.h>

 #include <linux/dma-mapping.h>
@@ -778,9 +777,9 @@ static int jzfb_suspend(struct device *dev)
 {
 	struct jzfb *jzfb = dev_get_drvdata(dev);

-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(jzfb->fb, 1);
-	console_unlock();
+	fb_console_unlock();

 	mutex_lock(&jzfb->lock);
 	if (jzfb->is_enabled)
@@ -800,9 +799,9 @@ static int jzfb_resume(struct device *dev)
 		jzfb_enable(jzfb);
 	mutex_unlock(&jzfb->lock);

-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(jzfb->fb, 0);
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index c89f8a8..da25fa1 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -23,7 +23,6 @@
 #include <linux/ioport.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
-#include <linux/console.h>
 #include <linux/clk.h>
 #include <linux/mutex.h>

@@ -1204,9 +1203,9 @@ static int mx3fb_suspend(struct platform_device
*pdev, pm_message_t state)
 	struct mx3fb_data *mx3fb = platform_get_drvdata(pdev);
 	struct mx3fb_info *mx3_fbi = mx3fb->fbi->par;

-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(mx3fb->fbi, 1);
-	console_unlock();
+	fb_console_unlock();

 	if (mx3_fbi->blank == FB_BLANK_UNBLANK) {
 		sdc_disable_channel(mx3_fbi);
@@ -1229,9 +1228,9 @@ static int mx3fb_resume(struct platform_device *pdev)
 		sdc_set_brightness(mx3fb, mx3fb->backlight_level);
 	}

-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(mx3fb->fbi, 0);
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index fe13ac5..f47eb2a 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -19,7 +19,6 @@
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/pci.h>
-#include <linux/console.h>
 #include <linux/backlight.h>
 #ifdef CONFIG_MTRR
 #include <asm/mtrr.h>
@@ -1057,7 +1056,7 @@ static int nvidiafb_suspend(struct pci_dev *dev,
pm_message_t mesg)

 	if (mesg.event == PM_EVENT_PRETHAW)
 		mesg.event = PM_EVENT_FREEZE;
-	console_lock();
+	fb_console_lock();
 	par->pm_state = mesg.event;

 	if (mesg.event & PM_EVENT_SLEEP) {
@@ -1070,7 +1069,7 @@ static int nvidiafb_suspend(struct pci_dev *dev,
pm_message_t mesg)
 	}
 	dev->dev.power.power_state = mesg;

-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }

@@ -1079,7 +1078,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
 	struct fb_info *info = pci_get_drvdata(dev);
 	struct nvidia_par *par = info->par;

-	console_lock();
+	fb_console_lock();
 	pci_set_power_state(dev, PCI_D0);

 	if (par->pm_state != PM_EVENT_FREEZE) {
@@ -1097,7 +1096,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
 	nvidiafb_blank(FB_BLANK_UNBLANK, info);

 fail:
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 #else
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 213fbbc..cb2e174 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -23,7 +23,6 @@
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
-#include <linux/console.h>
 #include <linux/ioctl.h>
 #include <linux/kthread.h>
 #include <linux/freezer.h>
@@ -515,7 +514,7 @@ static int ps3fb_release(struct fb_info *info, int user)
 			atomic_set(&ps3fb.ext_flip, 0);
 			if (console_trylock()) {
 				ps3fb_sync(info, 0);	/* single buffer */
-				console_unlock();
+				fb_console_unlock();
 			}
 		}
 	}
@@ -830,14 +829,14 @@ static int ps3fb_ioctl(struct fb_info *info,
unsigned int cmd,
 			if (vmode) {
 				var = info->var;
 				fb_videomode_to_var(&var, vmode);
-				console_lock();
+				fb_console_lock();
 				info->flags |= FBINFO_MISC_USEREVENT;
 				/* Force, in case only special bits changed */
 				var.activate |= FB_ACTIVATE_FORCE;
 				par->new_mode_id = val;
 				retval = fb_set_var(info, &var);
 				info->flags &= ~FBINFO_MISC_USEREVENT;
-				console_unlock();
+				fb_console_unlock();
 			}
 			break;
 		}
@@ -881,9 +880,9 @@ static int ps3fb_ioctl(struct fb_info *info,
unsigned int cmd,
 			break;

 		dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
-		console_lock();
+		fb_console_lock();
 		retval = ps3fb_sync(info, val);
-		console_unlock();
+		fb_console_unlock();
 		break;

 	default:
@@ -903,9 +902,9 @@ static int ps3fbd(void *arg)
 		set_current_state(TASK_INTERRUPTIBLE);
 		if (ps3fb.is_kicked) {
 			ps3fb.is_kicked = 0;
-			console_lock();
+			fb_console_lock();
 			ps3fb_sync(info, 0);	/* single buffer */
-			console_unlock();
+			fb_console_unlock();
 		}
 		schedule();
 	}
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 3f90255..a1af212 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -54,7 +54,6 @@
 #include <linux/mutex.h>
 #include <linux/kthread.h>
 #include <linux/freezer.h>
-#include <linux/console.h>

 #include <mach/hardware.h>
 #include <asm/io.h>
@@ -733,9 +732,9 @@ static int overlayfb_open(struct fb_info *info, int user)

 	if (ofb->usage++ == 0) {
 		/* unblank the base framebuffer */
-		console_lock();
+		fb_console_lock();
 		fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
-		console_unlock();
+		fb_console_unlock();
 	}

 	return 0;
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index 1d00736..7759c82 100644
--- a/drivers/video/s3fb.c
+++ b/drivers/video/s3fb.c
@@ -22,7 +22,6 @@
 #include <linux/svga.h>
 #include <linux/init.h>
 #include <linux/pci.h>
-#include <linux/console.h> /* Why should fb driver call console
functions? because console_lock() */
 #include <video/vga.h>

 #include <linux/i2c.h>
@@ -1445,12 +1444,12 @@ static int s3_pci_suspend(struct pci_dev* dev,
pm_message_t state)

 	dev_info(info->device, "suspend\n");

-	console_lock();
+	fb_fb_console_lock();
 	mutex_lock(&(par->open_lock));

 	if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		return 0;
 	}

@@ -1461,7 +1460,7 @@ static int s3_pci_suspend(struct pci_dev* dev,
pm_message_t state)
 	pci_set_power_state(dev, pci_choose_state(dev, state));

 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
@@ -1477,12 +1476,12 @@ static int s3_pci_resume(struct pci_dev* dev)

 	dev_info(info->device, "resume\n");

-	console_lock();
+	fb_fb_console_lock();
 	mutex_lock(&(par->open_lock));

 	if (par->ref_count == 0) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		return 0;
 	}

@@ -1491,7 +1490,7 @@ static int s3_pci_resume(struct pci_dev* dev)
 	err = pci_enable_device(dev);
 	if (err) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		dev_err(info->device, "error %d enabling device for resume\n", err);
 		return err;
 	}
@@ -1501,7 +1500,7 @@ static int s3_pci_resume(struct pci_dev* dev)
 	fb_set_suspend(info, 0);

 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
diff --git a/drivers/video/savage/savagefb_driver.c
b/drivers/video/savage/savagefb_driver.c
index 0d0f52c..bf64221 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -51,7 +51,6 @@
 #include <linux/fb.h>
 #include <linux/pci.h>
 #include <linux/init.h>
-#include <linux/console.h>

 #include <asm/io.h>
 #include <asm/irq.h>
@@ -2391,7 +2390,7 @@ static int savagefb_suspend(struct pci_dev *dev,
pm_message_t mesg)
 	if (mesg.event == PM_EVENT_FREEZE)
 		return 0;

-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(info, 1);

 	if (info->fbops->fb_sync)
@@ -2403,7 +2402,7 @@ static int savagefb_suspend(struct pci_dev *dev,
pm_message_t mesg)
 	pci_save_state(dev);
 	pci_disable_device(dev);
 	pci_set_power_state(dev, pci_choose_state(dev, mesg));
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
@@ -2427,7 +2426,7 @@ static int savagefb_resume(struct pci_dev* dev)
 		return 0;
 	}

-	console_lock();
+	fb_console_lock();

 	pci_set_power_state(dev, PCI_D0);
 	pci_restore_state(dev);
@@ -2441,7 +2440,7 @@ static int savagefb_resume(struct pci_dev* dev)
 	savagefb_set_par(info);
 	fb_set_suspend(info, 0);
 	savagefb_blank(FB_BLANK_UNBLANK, info);
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 699487c..2bc1119 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -11,7 +11,6 @@
 #include <linux/atomic.h>
 #include <linux/backlight.h>
 #include <linux/clk.h>
-#include <linux/console.h>
 #include <linux/ctype.h>
 #include <linux/dma-mapping.h>
 #include <linux/delay.h>
@@ -575,7 +574,7 @@ static int sh_mobile_lcdc_display_notify(struct
sh_mobile_lcdc_chan *ch,
 	case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT:
 		/* HDMI plug in */
 		if (lock_fb_info(info)) {
-			console_lock();
+			fb_console_lock();

 			ch->display.width = monspec->max_x * 10;
 			ch->display.height = monspec->max_y * 10;
@@ -594,7 +593,7 @@ static int sh_mobile_lcdc_display_notify(struct
sh_mobile_lcdc_chan *ch,
 				fb_set_suspend(info, 0);
 			}

-			console_unlock();
+			fb_console_unlock();
 			unlock_fb_info(info);
 		}
 		break;
@@ -602,9 +601,9 @@ static int sh_mobile_lcdc_display_notify(struct
sh_mobile_lcdc_chan *ch,
 	case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT:
 		/* HDMI disconnect */
 		if (lock_fb_info(info)) {
-			console_lock();
+			fb_console_lock();
 			fb_set_suspend(info, 1);
-			console_unlock();
+			fb_console_unlock();
 			unlock_fb_info(info);
 		}
 		break;
@@ -1934,9 +1933,9 @@ static int sh_mobile_lcdc_release(struct fb_info
*info, int user)

 	/* Nothing to reconfigure, when called from fbcon */
 	if (user) {
-		console_lock();
+		fb_console_lock();
 		sh_mobile_fb_reconfig(info);
-		console_unlock();
+		fb_console_unlock();
 	}

 	mutex_unlock(&ch->open_lock);
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index 3690eff..536f922 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -28,7 +28,6 @@
 #include <linux/wait.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
-#include <linux/console.h>
 #include <linux/io.h>

 #include <asm/uaccess.h>
@@ -2104,9 +2103,9 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info,

 	/* tell console/fb driver we are suspending */

-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(fbi, 1);
-	console_unlock();
+	fb_console_unlock();

 	/* backup copies in case chip is powered down over suspend */

@@ -2163,9 +2162,9 @@ static void sm501fb_resume_fb(struct sm501fb_info *info,
 		memcpy_toio(par->cursor.k_addr, par->store_cursor,
 			    par->cursor.size);

-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(fbi, 0);
-	console_unlock();
+	fb_console_unlock();

 	vfree(par->store_fb);
 	vfree(par->store_cursor);
diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c
index 8e4a446..e266b6b 100644
--- a/drivers/video/tmiofb.c
+++ b/drivers/video/tmiofb.c
@@ -25,8 +25,7 @@
 #include <linux/fb.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
-/* Why should fb driver call console functions? because console_lock() */
-#include <linux/console.h>
+/* Why should fb driver call console functions? because fb_console_lock() */
 #include <linux/mfd/core.h>
 #include <linux/mfd/tmio.h>
 #include <linux/uaccess.h>
@@ -938,7 +937,7 @@ static int tmiofb_suspend(struct platform_device
*dev, pm_message_t state)
 	const struct mfd_cell *cell = mfd_get_cell(dev);
 	int retval = 0;

-	console_lock();
+	fb_console_lock();

 	fb_set_suspend(info, 1);

@@ -959,7 +958,7 @@ static int tmiofb_suspend(struct platform_device
*dev, pm_message_t state)
 	if (cell->suspend)
 		retval = cell->suspend(dev);

-	console_unlock();
+	fb_fb_console_unlock();

 	return retval;
 }
@@ -970,7 +969,7 @@ static int tmiofb_resume(struct platform_device *dev)
 	const struct mfd_cell *cell = mfd_get_cell(dev);
 	int retval = 0;

-	console_lock();
+	fb_console_lock();

 	if (cell->resume) {
 		retval = cell->resume(dev);
@@ -986,7 +985,7 @@ static int tmiofb_resume(struct platform_device *dev)

 	fb_set_suspend(info, 0);
 out:
-	console_unlock();
+	fb_fb_console_unlock();
 	return retval;
 }
 #else
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index c80e770..d36b173 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -1698,17 +1698,17 @@ static int parse_mode(const char *str, u32
devices, u32 *xres, u32 *yres)
 #ifdef CONFIG_PM
 static int viafb_suspend(void *unused)
 {
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(viafbinfo, 1);
 	viafb_sync(viafbinfo);
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }

 static int viafb_resume(void *unused)
 {
-	console_lock();
+	fb_console_lock();
 	if (viaparinfo->shared->vdev->engine_mmio)
 		viafb_reset_engine(viaparinfo);
 	viafb_set_par(viafbinfo);
@@ -1716,7 +1716,7 @@ static int viafb_resume(void *unused)
 		viafb_set_par(viafbinfo1);
 	fb_set_suspend(viafbinfo, 0);

-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }

diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
index 4e74d26..cb48d4d 100644
--- a/drivers/video/vt8623fb.c
+++ b/drivers/video/vt8623fb.c
@@ -23,7 +23,6 @@
 #include <linux/svga.h>
 #include <linux/init.h>
 #include <linux/pci.h>
-#include <linux/console.h> /* Why should fb driver call console
functions? because console_lock() */
 #include <video/vga.h>

 #ifdef CONFIG_MTRR
@@ -845,12 +844,12 @@ static int vt8623_pci_suspend(struct pci_dev*
dev, pm_message_t state)

 	dev_info(info->device, "suspend\n");

-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));

 	if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		return 0;
 	}

@@ -861,7 +860,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev,
pm_message_t state)
 	pci_set_power_state(dev, pci_choose_state(dev, state));

 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
@@ -876,7 +875,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)

 	dev_info(info->device, "resume\n");

-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));

 	if (par->ref_count == 0)
@@ -895,7 +894,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)

 fail:
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();

 	return 0;
 }
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index b7f5173..770397e7 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -18,7 +18,6 @@
  * frame buffer.
  */

-#include <linux/console.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/fb.h>
@@ -495,12 +494,12 @@ xenfb_make_preferred_console(void)
 	if (console_set_on_cmdline)
 		return;

-	console_lock();
+	fb_console_lock();
 	for_each_console(c) {
 		if (!strcmp(c->name, "tty") && c->index == 0)
 			break;
 	}
-	console_unlock();
+	fb_console_unlock();
 	if (c) {
 		unregister_console(c);
 		c->flags |= CON_CONSDEV;
diff --git a/include/linux/fb.h b/include/linux/fb.h
index ac3f1c6..7ae96ad 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -1021,6 +1021,8 @@ extern int fb_get_color_depth(struct
fb_var_screeninfo *var,
 			      struct fb_fix_screeninfo *fix);
 extern int fb_get_options(char *name, char **option);
 extern int fb_new_modelist(struct fb_info *info);
+extern void fb_console_unlock(void);
+extern void fb_console_lock(void);

 extern struct fb_info *registered_fb[FB_MAX];
 extern int num_registered_fb;
-- 
1.7.9.5

[-- Attachment #2: 0001-fb-only-enable-console-lock-in-fb-for-VGA-console.patch --]
[-- Type: application/octet-stream, Size: 35541 bytes --]

From 4f46fd3d98efa57f37357618986e2382a56c6f4a Mon Sep 17 00:00:00 2001
From: Jun Nie <njun@marvell.com>
Date: Sat, 29 Sep 2012 13:04:17 +0800
Subject: [PATCH] fb: only enable console lock in fb for VGA console

If VGA console is not enable, we do not have to
involve console lock/unlock in FB framework to avoid
hold the lock unnecessarily. Otherwise, UART console
output may be blocked by FB pan_display etc operations,
which hold the console lock. This may block the
panic log out on UART, where the lock may never be
released by FB.

Signed-off-by: Jun Nie <njun@marvell.com>
---
 drivers/video/arkfb.c                  |   11 +++++------
 drivers/video/aty/aty128fb.c           |   11 +++++------
 drivers/video/aty/atyfb_base.c         |   11 +++++------
 drivers/video/aty/radeon_pm.c          |    9 ++++-----
 drivers/video/chipsfb.c                |    8 ++++----
 drivers/video/da8xx-fb.c               |    9 ++++-----
 drivers/video/fb-puv3.c                |    9 ++++-----
 drivers/video/fbmem.c                  |   28 ++++++++++++++++++++++------
 drivers/video/fbsysfs.c                |   21 ++++++++++-----------
 drivers/video/geode/gxfb_core.c        |    9 ++++-----
 drivers/video/geode/lxfb_core.c        |    8 ++++----
 drivers/video/i740fb.c                 |   11 +++++------
 drivers/video/i810/i810_main.c         |    9 ++++-----
 drivers/video/jz4740_fb.c              |    9 ++++-----
 drivers/video/mx3fb.c                  |    9 ++++-----
 drivers/video/nvidia/nvidia.c          |    9 ++++-----
 drivers/video/ps3fb.c                  |   15 +++++++--------
 drivers/video/pxafb.c                  |    5 ++---
 drivers/video/s3fb.c                   |   15 +++++++--------
 drivers/video/savage/savagefb_driver.c |    9 ++++-----
 drivers/video/sh_mobile_lcdcfb.c       |   13 ++++++-------
 drivers/video/sm501fb.c                |    9 ++++-----
 drivers/video/tmiofb.c                 |   11 +++++------
 drivers/video/via/viafbdev.c           |    8 ++++----
 drivers/video/vt8623fb.c               |   11 +++++------
 drivers/video/xen-fbfront.c            |    5 ++---
 include/linux/fb.h                     |    2 ++
 27 files changed, 140 insertions(+), 144 deletions(-)

diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
index 555dd4c..774d902 100644
--- a/drivers/video/arkfb.c
+++ b/drivers/video/arkfb.c
@@ -23,7 +23,6 @@
 #include <linux/svga.h>
 #include <linux/init.h>
 #include <linux/pci.h>
-#include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */
 #include <video/vga.h>
 
 #ifdef CONFIG_MTRR
@@ -1124,12 +1123,12 @@ static int ark_pci_suspend (struct pci_dev* dev, pm_message_t state)
 
 	dev_info(info->device, "suspend\n");
 
-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));
 
 	if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		return 0;
 	}
 
@@ -1140,7 +1139,7 @@ static int ark_pci_suspend (struct pci_dev* dev, pm_message_t state)
 	pci_set_power_state(dev, pci_choose_state(dev, state));
 
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
@@ -1155,7 +1154,7 @@ static int ark_pci_resume (struct pci_dev* dev)
 
 	dev_info(info->device, "resume\n");
 
-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));
 
 	if (par->ref_count == 0)
@@ -1174,7 +1173,7 @@ static int ark_pci_resume (struct pci_dev* dev)
 
 fail:
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 #else
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 747442d..1c6b80b 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -60,7 +60,6 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/ioport.h>
-#include <linux/console.h>
 #include <linux/backlight.h>
 #include <asm/io.h>
 
@@ -1884,7 +1883,7 @@ static void aty128_early_resume(void *data)
 		return;
 	pci_restore_state(par->pdev);
 	aty128_do_resume(par->pdev);
-	console_unlock();
+	fb_console_unlock();
 }
 #endif /* CONFIG_PPC_PMAC */
 
@@ -2461,7 +2460,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 
 	printk(KERN_DEBUG "aty128fb: suspending...\n");
 	
-	console_lock();
+	fb_console_lock();
 
 	fb_set_suspend(info, 1);
 
@@ -2493,7 +2492,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 	if (state.event != PM_EVENT_ON)
 		aty128_set_suspend(par, 1);
 
-	console_unlock();
+	fb_console_unlock();
 
 	pdev->dev.power.power_state = state;
 
@@ -2550,9 +2549,9 @@ static int aty128_pci_resume(struct pci_dev *pdev)
 {
 	int rc;
 
-	console_lock();
+	fb_console_lock();
 	rc = aty128_do_resume(pdev);
-	console_unlock();
+	fb_console_unlock();
 
 	return rc;
 }
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 3f2e8c1..9bb15ab 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -58,7 +58,6 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/delay.h>
-#include <linux/console.h>
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/pci.h>
@@ -2065,7 +2064,7 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 	if (state.event == pdev->dev.power.power_state.event)
 		return 0;
 
-	console_lock();
+	fb_console_lock();
 
 	fb_set_suspend(info, 1);
 
@@ -2093,14 +2092,14 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 		par->lock_blank = 0;
 		atyfb_blank(FB_BLANK_UNBLANK, info);
 		fb_set_suspend(info, 0);
-		console_unlock();
+		fb_console_unlock();
 		return -EIO;
 	}
 #else
 	pci_set_power_state(pdev, pci_choose_state(pdev, state));
 #endif
 
-	console_unlock();
+	fb_console_unlock();
 
 	pdev->dev.power.power_state = state;
 
@@ -2129,7 +2128,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
 	if (pdev->dev.power.power_state.event == PM_EVENT_ON)
 		return 0;
 
-	console_lock();
+	fb_console_lock();
 
 	/*
 	 * PCI state will have been restored by the core, so
@@ -2157,7 +2156,7 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
 	par->lock_blank = 0;
 	atyfb_blank(FB_BLANK_UNBLANK, info);
 
-	console_unlock();
+	fb_console_unlock();
 
 	pdev->dev.power.power_state = PMSG_ON;
 
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index 92bda58..a2f07da 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -16,7 +16,6 @@
 
 #include "radeonfb.h"
 
-#include <linux/console.h>
 #include <linux/agp_backend.h>
 
 #ifdef CONFIG_PPC_PMAC
@@ -2626,7 +2625,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
 		goto done;
 	}
 
-	console_lock();
+	fb_console_lock();
 
 	fb_set_suspend(info, 1);
 
@@ -2690,7 +2689,7 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
 	if (rinfo->pm_mode & radeon_pm_d2)
 		radeon_set_suspend(rinfo, 1);
 
-	console_unlock();
+	fb_console_unlock();
 
  done:
 	pdev->dev.power.power_state = mesg;
@@ -2718,7 +2717,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
 		if (!console_trylock())
 			return 0;
 	} else
-		console_lock();
+		fb_console_lock();
 
 	printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n",
 	       pci_name(pdev), pdev->dev.power.power_state.event);
@@ -2783,7 +2782,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
 	pdev->dev.power.power_state = PMSG_ON;
 
  bail:
-	console_unlock();
+	fb_console_unlock();
 
 	return rc;
 }
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
index cff742a..d50fa6b 100644
--- a/drivers/video/chipsfb.c
+++ b/drivers/video/chipsfb.c
@@ -460,10 +460,10 @@ static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 	if (!(state.event & PM_EVENT_SLEEP))
 		goto done;
 
-	console_lock();
+	fb_console_lock();
 	chipsfb_blank(1, p);
 	fb_set_suspend(p, 1);
-	console_unlock();
+	fb_console_unlock();
  done:
 	pdev->dev.power.power_state = state;
 	return 0;
@@ -473,10 +473,10 @@ static int chipsfb_pci_resume(struct pci_dev *pdev)
 {
         struct fb_info *p = pci_get_drvdata(pdev);
 
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(p, 0);
 	chipsfb_blank(0, p);
-	console_unlock();
+	fb_console_unlock();
 
 	pdev->dev.power.power_state = PMSG_ON;
 	return 0;
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 7ae9d53..9a36bbc 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -29,7 +29,6 @@
 #include <linux/interrupt.h>
 #include <linux/clk.h>
 #include <linux/cpufreq.h>
-#include <linux/console.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -1406,14 +1405,14 @@ static int fb_suspend(struct platform_device *dev, pm_message_t state)
 	struct fb_info *info = platform_get_drvdata(dev);
 	struct da8xx_fb_par *par = info->par;
 
-	console_lock();
+	fb_console_lock();
 	if (par->panel_power_ctrl)
 		par->panel_power_ctrl(0);
 
 	fb_set_suspend(info, 1);
 	lcd_disable_raster();
 	clk_disable(par->lcdc_clk);
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
@@ -1422,7 +1421,7 @@ static int fb_resume(struct platform_device *dev)
 	struct fb_info *info = platform_get_drvdata(dev);
 	struct da8xx_fb_par *par = info->par;
 
-	console_lock();
+	fb_console_lock();
 	clk_enable(par->lcdc_clk);
 	lcd_enable_raster();
 
@@ -1430,7 +1429,7 @@ static int fb_resume(struct platform_device *dev)
 		par->panel_power_ctrl(1);
 
 	fb_set_suspend(info, 0);
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
index 60a787f..87c8c4e 100644
--- a/drivers/video/fb-puv3.c
+++ b/drivers/video/fb-puv3.c
@@ -17,7 +17,6 @@
 #include <linux/clk.h>
 #include <linux/fb.h>
 #include <linux/init.h>
-#include <linux/console.h>
 
 #include <asm/sizes.h>
 #include <mach/hardware.h>
@@ -759,7 +758,7 @@ static int unifb_resume(struct platform_device *dev)
 	if (dev->dev.power.power_state.event == PM_EVENT_ON)
 		return 0;
 
-	console_lock();
+	fb_console_lock();
 
 	if (dev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
 		writel(unifb_regs[0], UDE_FSA);
@@ -775,7 +774,7 @@ static int unifb_resume(struct platform_device *dev)
 	}
 	dev->dev.power.power_state = PMSG_ON;
 
-	console_unlock();
+	fb_console_unlock();
 
 	return rc;
 }
@@ -804,11 +803,11 @@ static int unifb_suspend(struct platform_device *dev, pm_message_t mesg)
 		goto done;
 	}
 
-	console_lock();
+	fb_console_lock();
 
 	/* do nothing... */
 
-	console_unlock();
+	fb_console_unlock();
 
 done:
 	dev->dev.power.power_state = mesg;
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 0dff12a..c2d4627 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -85,6 +85,22 @@ EXPORT_SYMBOL(lock_fb_info);
  * Helpers
  */
 
+void fb_console_lock(void)
+{
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE
+	console_lock();
+#endif
+}
+EXPORT_SYMBOL(fb_console_lock);
+
+void fb_console_unlock(void)
+{
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE
+	console_unlock();
+#endif
+}
+EXPORT_SYMBOL(fb_console_unlock);
+
 int fb_get_color_depth(struct fb_var_screeninfo *var,
 		       struct fb_fix_screeninfo *fix)
 {
@@ -1101,11 +1117,11 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 			return -EFAULT;
 		if (!lock_fb_info(info))
 			return -ENODEV;
-		console_lock();
+		fb_console_lock();
 		info->flags |= FBINFO_MISC_USEREVENT;
 		ret = fb_set_var(info, &var);
 		info->flags &= ~FBINFO_MISC_USEREVENT;
-		console_unlock();
+		fb_console_unlock();
 		unlock_fb_info(info);
 		if (!ret && copy_to_user(argp, &var, sizeof(var)))
 			ret = -EFAULT;
@@ -1137,9 +1153,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 			return -EFAULT;
 		if (!lock_fb_info(info))
 			return -ENODEV;
-		console_lock();
+		fb_console_lock();
 		ret = fb_pan_display(info, &var);
-		console_unlock();
+		fb_console_unlock();
 		unlock_fb_info(info);
 		if (ret == 0 && copy_to_user(argp, &var, sizeof(var)))
 			return -EFAULT;
@@ -1184,11 +1200,11 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 	case FBIOBLANK:
 		if (!lock_fb_info(info))
 			return -ENODEV;
-		console_lock();
+		fb_console_lock();
 		info->flags |= FBINFO_MISC_USEREVENT;
 		ret = fb_blank(info, arg);
 		info->flags &= ~FBINFO_MISC_USEREVENT;
-		console_unlock();
+		fb_console_unlock();
 		unlock_fb_info(info);
 		break;
 	default:
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index a55e366..976d8f5 100644
--- a/drivers/video/fbsysfs.c
+++ b/drivers/video/fbsysfs.c
@@ -18,7 +18,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/fb.h>
-#include <linux/console.h>
 #include <linux/module.h>
 
 #define FB_SYSFS_FLAG_ATTR 1
@@ -92,11 +91,11 @@ static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var)
 	int err;
 
 	var->activate |= FB_ACTIVATE_FORCE;
-	console_lock();
+	fb_console_lock();
 	fb_info->flags |= FBINFO_MISC_USEREVENT;
 	err = fb_set_var(fb_info, var);
 	fb_info->flags &= ~FBINFO_MISC_USEREVENT;
-	console_unlock();
+	fb_console_unlock();
 	if (err)
 		return err;
 	return 0;
@@ -177,7 +176,7 @@ static ssize_t store_modes(struct device *device,
 	if (i * sizeof(struct fb_videomode) != count)
 		return -EINVAL;
 
-	console_lock();
+	fb_console_lock();
 	list_splice(&fb_info->modelist, &old_list);
 	fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
 				 &fb_info->modelist);
@@ -187,7 +186,7 @@ static ssize_t store_modes(struct device *device,
 	} else
 		fb_destroy_modelist(&old_list);
 
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
@@ -303,11 +302,11 @@ static ssize_t store_blank(struct device *device,
 	char *last = NULL;
 	int err;
 
-	console_lock();
+	fb_console_lock();
 	fb_info->flags |= FBINFO_MISC_USEREVENT;
 	err = fb_blank(fb_info, simple_strtoul(buf, &last, 0));
 	fb_info->flags &= ~FBINFO_MISC_USEREVENT;
-	console_unlock();
+	fb_console_unlock();
 	if (err < 0)
 		return err;
 	return count;
@@ -366,9 +365,9 @@ static ssize_t store_pan(struct device *device,
 		return -EINVAL;
 	var.yoffset = simple_strtoul(last, &last, 0);
 
-	console_lock();
+	fb_console_lock();
 	err = fb_pan_display(fb_info, &var);
-	console_unlock();
+	fb_console_unlock();
 
 	if (err < 0)
 		return err;
@@ -403,9 +402,9 @@ static ssize_t store_fbstate(struct device *device,
 
 	if (!lock_fb_info(fb_info))
 		return -ENODEV;
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(fb_info, (int)state);
-	console_unlock();
+	fb_console_unlock();
 	unlock_fb_info(fb_info);
 
 	return count;
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index b4f19db..ba7dd0a 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -27,7 +27,6 @@
 #include <linux/mm.h>
 #include <linux/delay.h>
 #include <linux/fb.h>
-#include <linux/console.h>
 #include <linux/suspend.h>
 #include <linux/init.h>
 #include <linux/pci.h>
@@ -344,10 +343,10 @@ static int gxfb_suspend(struct pci_dev *pdev, pm_message_t state)
 	struct fb_info *info = pci_get_drvdata(pdev);
 
 	if (state.event == PM_EVENT_SUSPEND) {
-		console_lock();
+		fb_console_lock();
 		gx_powerdown(info);
 		fb_set_suspend(info, 1);
-		console_unlock();
+		fb_console_unlock();
 	}
 
 	/* there's no point in setting PCI states; we emulate PCI, so
@@ -361,7 +360,7 @@ static int gxfb_resume(struct pci_dev *pdev)
 	struct fb_info *info = pci_get_drvdata(pdev);
 	int ret;
 
-	console_lock();
+	fb_console_lock();
 	ret = gx_powerup(info);
 	if (ret) {
 		printk(KERN_ERR "gxfb:  power up failed!\n");
@@ -369,7 +368,7 @@ static int gxfb_resume(struct pci_dev *pdev)
 	}
 
 	fb_set_suspend(info, 0);
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 #endif
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
index 416851c..5341bf1 100644
--- a/drivers/video/geode/lxfb_core.c
+++ b/drivers/video/geode/lxfb_core.c
@@ -465,10 +465,10 @@ static int lxfb_suspend(struct pci_dev *pdev, pm_message_t state)
 	struct fb_info *info = pci_get_drvdata(pdev);
 
 	if (state.event == PM_EVENT_SUSPEND) {
-		console_lock();
+		fb_console_lock();
 		lx_powerdown(info);
 		fb_set_suspend(info, 1);
-		console_unlock();
+		fb_console_unlock();
 	}
 
 	/* there's no point in setting PCI states; we emulate PCI, so
@@ -482,7 +482,7 @@ static int lxfb_resume(struct pci_dev *pdev)
 	struct fb_info *info = pci_get_drvdata(pdev);
 	int ret;
 
-	console_lock();
+	fb_console_lock();
 	ret = lx_powerup(info);
 	if (ret) {
 		printk(KERN_ERR "lxfb:  power up failed!\n");
@@ -490,7 +490,7 @@ static int lxfb_resume(struct pci_dev *pdev)
 	}
 
 	fb_set_suspend(info, 0);
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 #else
diff --git a/drivers/video/i740fb.c b/drivers/video/i740fb.c
index ff3f880..b3fe538 100644
--- a/drivers/video/i740fb.c
+++ b/drivers/video/i740fb.c
@@ -24,7 +24,6 @@
 #include <linux/pci_ids.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
-#include <linux/console.h>
 #include <video/vga.h>
 
 #ifdef CONFIG_MTRR
@@ -1210,13 +1209,13 @@ static int i740fb_suspend(struct pci_dev *dev, pm_message_t state)
 	if (state.event == PM_EVENT_FREEZE || state.event == PM_EVENT_PRETHAW)
 		return 0;
 
-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));
 
 	/* do nothing if framebuffer is not active */
 	if (par->ref_count == 0) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		return 0;
 	}
 
@@ -1227,7 +1226,7 @@ static int i740fb_suspend(struct pci_dev *dev, pm_message_t state)
 	pci_set_power_state(dev, pci_choose_state(dev, state));
 
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
@@ -1237,7 +1236,7 @@ static int i740fb_resume(struct pci_dev *dev)
 	struct fb_info *info = pci_get_drvdata(dev);
 	struct i740fb_par *par = info->par;
 
-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));
 
 	if (par->ref_count == 0)
@@ -1253,7 +1252,7 @@ static int i740fb_resume(struct pci_dev *dev)
 
 fail:
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 #else
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index b83f361..84fe1ed 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -40,7 +40,6 @@
 #include <linux/pci_ids.h>
 #include <linux/resource.h>
 #include <linux/unistd.h>
-#include <linux/console.h>
 
 #include <asm/io.h>
 #include <asm/div64.h>
@@ -1574,7 +1573,7 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t mesg)
 		return 0;
 	}
 
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(info, 1);
 
 	if (info->fbops->fb_sync)
@@ -1587,7 +1586,7 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t mesg)
 	pci_save_state(dev);
 	pci_disable_device(dev);
 	pci_set_power_state(dev, pci_choose_state(dev, mesg));
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
@@ -1605,7 +1604,7 @@ static int i810fb_resume(struct pci_dev *dev)
 		return 0;
 	}
 
-	console_lock();
+	fb_console_lock();
 	pci_set_power_state(dev, PCI_D0);
 	pci_restore_state(dev);
 
@@ -1621,7 +1620,7 @@ static int i810fb_resume(struct pci_dev *dev)
 	fb_set_suspend (info, 0);
 	info->fbops->fb_blank(VESA_NO_BLANKING, info);
 fail:
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 /***********************************************************************
diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
index de36693..7e9301a 100644
--- a/drivers/video/jz4740_fb.c
+++ b/drivers/video/jz4740_fb.c
@@ -21,7 +21,6 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 
-#include <linux/console.h>
 #include <linux/fb.h>
 
 #include <linux/dma-mapping.h>
@@ -778,9 +777,9 @@ static int jzfb_suspend(struct device *dev)
 {
 	struct jzfb *jzfb = dev_get_drvdata(dev);
 
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(jzfb->fb, 1);
-	console_unlock();
+	fb_console_unlock();
 
 	mutex_lock(&jzfb->lock);
 	if (jzfb->is_enabled)
@@ -800,9 +799,9 @@ static int jzfb_resume(struct device *dev)
 		jzfb_enable(jzfb);
 	mutex_unlock(&jzfb->lock);
 
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(jzfb->fb, 0);
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index c89f8a8..da25fa1 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -23,7 +23,6 @@
 #include <linux/ioport.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
-#include <linux/console.h>
 #include <linux/clk.h>
 #include <linux/mutex.h>
 
@@ -1204,9 +1203,9 @@ static int mx3fb_suspend(struct platform_device *pdev, pm_message_t state)
 	struct mx3fb_data *mx3fb = platform_get_drvdata(pdev);
 	struct mx3fb_info *mx3_fbi = mx3fb->fbi->par;
 
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(mx3fb->fbi, 1);
-	console_unlock();
+	fb_console_unlock();
 
 	if (mx3_fbi->blank == FB_BLANK_UNBLANK) {
 		sdc_disable_channel(mx3_fbi);
@@ -1229,9 +1228,9 @@ static int mx3fb_resume(struct platform_device *pdev)
 		sdc_set_brightness(mx3fb, mx3fb->backlight_level);
 	}
 
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(mx3fb->fbi, 0);
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index fe13ac5..f47eb2a 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -19,7 +19,6 @@
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/pci.h>
-#include <linux/console.h>
 #include <linux/backlight.h>
 #ifdef CONFIG_MTRR
 #include <asm/mtrr.h>
@@ -1057,7 +1056,7 @@ static int nvidiafb_suspend(struct pci_dev *dev, pm_message_t mesg)
 
 	if (mesg.event == PM_EVENT_PRETHAW)
 		mesg.event = PM_EVENT_FREEZE;
-	console_lock();
+	fb_console_lock();
 	par->pm_state = mesg.event;
 
 	if (mesg.event & PM_EVENT_SLEEP) {
@@ -1070,7 +1069,7 @@ static int nvidiafb_suspend(struct pci_dev *dev, pm_message_t mesg)
 	}
 	dev->dev.power.power_state = mesg;
 
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 
@@ -1079,7 +1078,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
 	struct fb_info *info = pci_get_drvdata(dev);
 	struct nvidia_par *par = info->par;
 
-	console_lock();
+	fb_console_lock();
 	pci_set_power_state(dev, PCI_D0);
 
 	if (par->pm_state != PM_EVENT_FREEZE) {
@@ -1097,7 +1096,7 @@ static int nvidiafb_resume(struct pci_dev *dev)
 	nvidiafb_blank(FB_BLANK_UNBLANK, info);
 
 fail:
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 #else
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 213fbbc..cb2e174 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -23,7 +23,6 @@
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
-#include <linux/console.h>
 #include <linux/ioctl.h>
 #include <linux/kthread.h>
 #include <linux/freezer.h>
@@ -515,7 +514,7 @@ static int ps3fb_release(struct fb_info *info, int user)
 			atomic_set(&ps3fb.ext_flip, 0);
 			if (console_trylock()) {
 				ps3fb_sync(info, 0);	/* single buffer */
-				console_unlock();
+				fb_console_unlock();
 			}
 		}
 	}
@@ -830,14 +829,14 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
 			if (vmode) {
 				var = info->var;
 				fb_videomode_to_var(&var, vmode);
-				console_lock();
+				fb_console_lock();
 				info->flags |= FBINFO_MISC_USEREVENT;
 				/* Force, in case only special bits changed */
 				var.activate |= FB_ACTIVATE_FORCE;
 				par->new_mode_id = val;
 				retval = fb_set_var(info, &var);
 				info->flags &= ~FBINFO_MISC_USEREVENT;
-				console_unlock();
+				fb_console_unlock();
 			}
 			break;
 		}
@@ -881,9 +880,9 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
 			break;
 
 		dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
-		console_lock();
+		fb_console_lock();
 		retval = ps3fb_sync(info, val);
-		console_unlock();
+		fb_console_unlock();
 		break;
 
 	default:
@@ -903,9 +902,9 @@ static int ps3fbd(void *arg)
 		set_current_state(TASK_INTERRUPTIBLE);
 		if (ps3fb.is_kicked) {
 			ps3fb.is_kicked = 0;
-			console_lock();
+			fb_console_lock();
 			ps3fb_sync(info, 0);	/* single buffer */
-			console_unlock();
+			fb_console_unlock();
 		}
 		schedule();
 	}
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 3f90255..a1af212 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -54,7 +54,6 @@
 #include <linux/mutex.h>
 #include <linux/kthread.h>
 #include <linux/freezer.h>
-#include <linux/console.h>
 
 #include <mach/hardware.h>
 #include <asm/io.h>
@@ -733,9 +732,9 @@ static int overlayfb_open(struct fb_info *info, int user)
 
 	if (ofb->usage++ == 0) {
 		/* unblank the base framebuffer */
-		console_lock();
+		fb_console_lock();
 		fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK);
-		console_unlock();
+		fb_console_unlock();
 	}
 
 	return 0;
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index 1d00736..7759c82 100644
--- a/drivers/video/s3fb.c
+++ b/drivers/video/s3fb.c
@@ -22,7 +22,6 @@
 #include <linux/svga.h>
 #include <linux/init.h>
 #include <linux/pci.h>
-#include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */
 #include <video/vga.h>
 
 #include <linux/i2c.h>
@@ -1445,12 +1444,12 @@ static int s3_pci_suspend(struct pci_dev* dev, pm_message_t state)
 
 	dev_info(info->device, "suspend\n");
 
-	console_lock();
+	fb_fb_console_lock();
 	mutex_lock(&(par->open_lock));
 
 	if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		return 0;
 	}
 
@@ -1461,7 +1460,7 @@ static int s3_pci_suspend(struct pci_dev* dev, pm_message_t state)
 	pci_set_power_state(dev, pci_choose_state(dev, state));
 
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
@@ -1477,12 +1476,12 @@ static int s3_pci_resume(struct pci_dev* dev)
 
 	dev_info(info->device, "resume\n");
 
-	console_lock();
+	fb_fb_console_lock();
 	mutex_lock(&(par->open_lock));
 
 	if (par->ref_count == 0) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		return 0;
 	}
 
@@ -1491,7 +1490,7 @@ static int s3_pci_resume(struct pci_dev* dev)
 	err = pci_enable_device(dev);
 	if (err) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		dev_err(info->device, "error %d enabling device for resume\n", err);
 		return err;
 	}
@@ -1501,7 +1500,7 @@ static int s3_pci_resume(struct pci_dev* dev)
 	fb_set_suspend(info, 0);
 
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index 0d0f52c..bf64221 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -51,7 +51,6 @@
 #include <linux/fb.h>
 #include <linux/pci.h>
 #include <linux/init.h>
-#include <linux/console.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -2391,7 +2390,7 @@ static int savagefb_suspend(struct pci_dev *dev, pm_message_t mesg)
 	if (mesg.event == PM_EVENT_FREEZE)
 		return 0;
 
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(info, 1);
 
 	if (info->fbops->fb_sync)
@@ -2403,7 +2402,7 @@ static int savagefb_suspend(struct pci_dev *dev, pm_message_t mesg)
 	pci_save_state(dev);
 	pci_disable_device(dev);
 	pci_set_power_state(dev, pci_choose_state(dev, mesg));
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
@@ -2427,7 +2426,7 @@ static int savagefb_resume(struct pci_dev* dev)
 		return 0;
 	}
 
-	console_lock();
+	fb_console_lock();
 
 	pci_set_power_state(dev, PCI_D0);
 	pci_restore_state(dev);
@@ -2441,7 +2440,7 @@ static int savagefb_resume(struct pci_dev* dev)
 	savagefb_set_par(info);
 	fb_set_suspend(info, 0);
 	savagefb_blank(FB_BLANK_UNBLANK, info);
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 699487c..2bc1119 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -11,7 +11,6 @@
 #include <linux/atomic.h>
 #include <linux/backlight.h>
 #include <linux/clk.h>
-#include <linux/console.h>
 #include <linux/ctype.h>
 #include <linux/dma-mapping.h>
 #include <linux/delay.h>
@@ -575,7 +574,7 @@ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
 	case SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT:
 		/* HDMI plug in */
 		if (lock_fb_info(info)) {
-			console_lock();
+			fb_console_lock();
 
 			ch->display.width = monspec->max_x * 10;
 			ch->display.height = monspec->max_y * 10;
@@ -594,7 +593,7 @@ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
 				fb_set_suspend(info, 0);
 			}
 
-			console_unlock();
+			fb_console_unlock();
 			unlock_fb_info(info);
 		}
 		break;
@@ -602,9 +601,9 @@ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
 	case SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT:
 		/* HDMI disconnect */
 		if (lock_fb_info(info)) {
-			console_lock();
+			fb_console_lock();
 			fb_set_suspend(info, 1);
-			console_unlock();
+			fb_console_unlock();
 			unlock_fb_info(info);
 		}
 		break;
@@ -1934,9 +1933,9 @@ static int sh_mobile_lcdc_release(struct fb_info *info, int user)
 
 	/* Nothing to reconfigure, when called from fbcon */
 	if (user) {
-		console_lock();
+		fb_console_lock();
 		sh_mobile_fb_reconfig(info);
-		console_unlock();
+		fb_console_unlock();
 	}
 
 	mutex_unlock(&ch->open_lock);
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index 3690eff..536f922 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -28,7 +28,6 @@
 #include <linux/wait.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
-#include <linux/console.h>
 #include <linux/io.h>
 
 #include <asm/uaccess.h>
@@ -2104,9 +2103,9 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info,
 
 	/* tell console/fb driver we are suspending */
 
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(fbi, 1);
-	console_unlock();
+	fb_console_unlock();
 
 	/* backup copies in case chip is powered down over suspend */
 
@@ -2163,9 +2162,9 @@ static void sm501fb_resume_fb(struct sm501fb_info *info,
 		memcpy_toio(par->cursor.k_addr, par->store_cursor,
 			    par->cursor.size);
 
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(fbi, 0);
-	console_unlock();
+	fb_console_unlock();
 
 	vfree(par->store_fb);
 	vfree(par->store_cursor);
diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c
index 8e4a446..e266b6b 100644
--- a/drivers/video/tmiofb.c
+++ b/drivers/video/tmiofb.c
@@ -25,8 +25,7 @@
 #include <linux/fb.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
-/* Why should fb driver call console functions? because console_lock() */
-#include <linux/console.h>
+/* Why should fb driver call console functions? because fb_console_lock() */
 #include <linux/mfd/core.h>
 #include <linux/mfd/tmio.h>
 #include <linux/uaccess.h>
@@ -938,7 +937,7 @@ static int tmiofb_suspend(struct platform_device *dev, pm_message_t state)
 	const struct mfd_cell *cell = mfd_get_cell(dev);
 	int retval = 0;
 
-	console_lock();
+	fb_console_lock();
 
 	fb_set_suspend(info, 1);
 
@@ -959,7 +958,7 @@ static int tmiofb_suspend(struct platform_device *dev, pm_message_t state)
 	if (cell->suspend)
 		retval = cell->suspend(dev);
 
-	console_unlock();
+	fb_fb_console_unlock();
 
 	return retval;
 }
@@ -970,7 +969,7 @@ static int tmiofb_resume(struct platform_device *dev)
 	const struct mfd_cell *cell = mfd_get_cell(dev);
 	int retval = 0;
 
-	console_lock();
+	fb_console_lock();
 
 	if (cell->resume) {
 		retval = cell->resume(dev);
@@ -986,7 +985,7 @@ static int tmiofb_resume(struct platform_device *dev)
 
 	fb_set_suspend(info, 0);
 out:
-	console_unlock();
+	fb_fb_console_unlock();
 	return retval;
 }
 #else
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index c80e770..d36b173 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -1698,17 +1698,17 @@ static int parse_mode(const char *str, u32 devices, u32 *xres, u32 *yres)
 #ifdef CONFIG_PM
 static int viafb_suspend(void *unused)
 {
-	console_lock();
+	fb_console_lock();
 	fb_set_suspend(viafbinfo, 1);
 	viafb_sync(viafbinfo);
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
 
 static int viafb_resume(void *unused)
 {
-	console_lock();
+	fb_console_lock();
 	if (viaparinfo->shared->vdev->engine_mmio)
 		viafb_reset_engine(viaparinfo);
 	viafb_set_par(viafbinfo);
@@ -1716,7 +1716,7 @@ static int viafb_resume(void *unused)
 		viafb_set_par(viafbinfo1);
 	fb_set_suspend(viafbinfo, 0);
 
-	console_unlock();
+	fb_console_unlock();
 	return 0;
 }
 
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
index 4e74d26..cb48d4d 100644
--- a/drivers/video/vt8623fb.c
+++ b/drivers/video/vt8623fb.c
@@ -23,7 +23,6 @@
 #include <linux/svga.h>
 #include <linux/init.h>
 #include <linux/pci.h>
-#include <linux/console.h> /* Why should fb driver call console functions? because console_lock() */
 #include <video/vga.h>
 
 #ifdef CONFIG_MTRR
@@ -845,12 +844,12 @@ static int vt8623_pci_suspend(struct pci_dev* dev, pm_message_t state)
 
 	dev_info(info->device, "suspend\n");
 
-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));
 
 	if ((state.event == PM_EVENT_FREEZE) || (par->ref_count == 0)) {
 		mutex_unlock(&(par->open_lock));
-		console_unlock();
+		fb_console_unlock();
 		return 0;
 	}
 
@@ -861,7 +860,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev, pm_message_t state)
 	pci_set_power_state(dev, pci_choose_state(dev, state));
 
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
@@ -876,7 +875,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
 
 	dev_info(info->device, "resume\n");
 
-	console_lock();
+	fb_console_lock();
 	mutex_lock(&(par->open_lock));
 
 	if (par->ref_count == 0)
@@ -895,7 +894,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
 
 fail:
 	mutex_unlock(&(par->open_lock));
-	console_unlock();
+	fb_console_unlock();
 
 	return 0;
 }
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index b7f5173..770397e7 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -18,7 +18,6 @@
  * frame buffer.
  */
 
-#include <linux/console.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/fb.h>
@@ -495,12 +494,12 @@ xenfb_make_preferred_console(void)
 	if (console_set_on_cmdline)
 		return;
 
-	console_lock();
+	fb_console_lock();
 	for_each_console(c) {
 		if (!strcmp(c->name, "tty") && c->index == 0)
 			break;
 	}
-	console_unlock();
+	fb_console_unlock();
 	if (c) {
 		unregister_console(c);
 		c->flags |= CON_CONSDEV;
diff --git a/include/linux/fb.h b/include/linux/fb.h
index ac3f1c6..7ae96ad 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -1021,6 +1021,8 @@ extern int fb_get_color_depth(struct fb_var_screeninfo *var,
 			      struct fb_fix_screeninfo *fix);
 extern int fb_get_options(char *name, char **option);
 extern int fb_new_modelist(struct fb_info *info);
+extern void fb_console_unlock(void);
+extern void fb_console_lock(void);
 
 extern struct fb_info *registered_fb[FB_MAX];
 extern int num_registered_fb;
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH 1/4] ARM: clps711x: Remove board support for CEIVA
From: Arnd Bergmann @ 2012-09-28 19:18 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1345568375-28516-1-git-send-email-shc_work@mail.ru>

On Tuesday 21 August 2012, Alexander Shiyan wrote:
> The current kernel does not fit in the CEIVA ROM. Also, some functional
> has already been removed due migrate from 2.6 to 3.0, and it seems that
> no one uses this platform. So, remove support for this board and modules
> specific only to this board.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>

Sorry, this fell through the cracks at first.

>  arch/arm/mach-clps711x/Kconfig                 |    6 -
>  arch/arm/mach-clps711x/Makefile                |    1 -
>  arch/arm/mach-clps711x/ceiva.c                 |   64 --
>  arch/arm/mach-clps711x/include/mach/hardware.h |   48 --
>  arch/arm/tools/mach-types                      |    1 -
>  drivers/video/Kconfig                          |   12 -
>  drivers/video/Makefile                         |    1 -
>  drivers/video/epson1355fb.c                    |  749 ------------------------
>  include/video/epson1355.h                      |   64 --
>  9 files changed, 0 insertions(+), 946 deletions(-)
>  delete mode 100644 arch/arm/mach-clps711x/ceiva.c
>  delete mode 100644 drivers/video/epson1355fb.c
>  delete mode 100644 include/video/epson1355.h

I've added Florian to Cc as the drivers/video maintainer, since you are
removing the epson1355fb driver along with its last user, and he
might have objections. Florian, I hope it's ok to merge this through
arm-soc, if not please let me know and I'll revert this.

I've applied the series to the next/cleanup2 branch in arm-soc now
for the next 3.7 merge window.

	Arnd

^ permalink raw reply

* Re: [PATCH V3 0/3] OMAPDSS: Enable dynamic debug printing
From: Mahapatra, Chandrabhanu @ 2012-09-28 12:23 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <1348832057.2437.24.camel@deskari>

On Fri, Sep 28, 2012 at 5:04 PM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> On Fri, 2012-09-28 at 15:53 +0530, Chandrabhanu Mahapatra wrote:
>> Hi everyone,
>> this patch series aims at cleaning up of DSS of printk()'s enabled with
>> dss_debug and replace them with generic dynamic debug printing.
>>
>> The 1st patch
>>  * moved DEBUG flag definition to Makefile
>> The 2nd patch
>>  * replaces printk() in DSSDBG definition with pr_debug()
>>  * removes DSSDBGF definition and replaces its instances with DSSDBG()
>> The 3rd patch
>>  * cleans up printk()'s in omap_dispc_unregister_isr() and
>>    _dsi_print_reset_status() with pr_debug()
>>  * removes dss_debug variable
>>
>> Changes from V1 to V2:
>>  * added debug messages to DSSDBG calls
>>  * added patch "OMAPDSS: Remove dss_debug variable"
>>
>> Changes from V2 to V3
>>  * added patch "OMAPDSS: Move definition of DEBUG flag to Makefile"
>>
>> All your comments and suggestions are welcome.
>
> There's one thing that's not quite nice about omapdss's debug print
> behavior after this series.
>
> CONFIG_OMAP2_DSS_DEBUG_SUPPORT is marked "default y", and it's also been
> safe to enable earlier as we had the dss_debug variable to prevent the
> debug prints. But after this series, the debug prints are enabled, and
> will spam the kernel log quite heavily.
>
> And that happens with both dynamic debugging enabled and disabled.

Yes, I had noticed that but I thought a better way to disable debug
prints is to disable both dynamic debugging (CONFIG_DYNAMIC_DEBUG) and
CONFIG_OMAP2_DSS_DEBUG_SUPPORT. May be CONFIG_OMAP2_DSS_DEBUG_SUPPORT
should have been false by default.

> How things should work:
>
> For kernels with dynamic debugging disabled: by default the dss debugs
> are not compiled, and the user needs to explicitly enable them in the
> kernel config.
>
> For kernels with dynamic debugging enabled: by default the dss debugs
> are compiled in, but not enabled. A Kconfig option can be set to make
> the debugs enabled by default.
>
> In addition to those, we have the debugfs files. Those should be usable
> regardless of the debug prints.
>
> So I suggest the following:
>
> - Remove CONFIG_OMAP2_DSS_DEBUG_SUPPORT. We can't re-use it, because it
> may be enabled in user's kernel configs.
> - Add new Kconfig option: CONFIG_OMAP2_DSS_DEBUG. This will set DEBUG in
> the makefile. This is off by default.
> - Add new Kconfig option: CONFIG_OMAP2_DSS_DEBUGFS. This will be use to
> decide if debugfs functionality is compiled in or not. This is off by
> default.
>
>  Tomi
>

Well, I had a different perception. If one needs to debug then both
debugfs and debug prints should be enabled. If one needs only debug
prints then CONFIG_DEBUG_FS can be disabled.
But above approach seems to provide more flexibilty.

-- 
Chandrabhanu Mahapatra
Texas Instruments India Pvt. Ltd.

^ permalink raw reply

* Re: [PATCH V3 2/3] OMAPDSS: Cleanup DSSDBG with dynamic pr_debug function
From: Mahapatra, Chandrabhanu @ 2012-09-28 11:42 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <1348831358.2437.14.camel@deskari>

On Fri, Sep 28, 2012 at 4:52 PM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> On Fri, 2012-09-28 at 15:53 +0530, Chandrabhanu Mahapatra wrote:
>> The printk in DSSDBG function definition is replaced with dynamic debug enabled
>> pr_debug(). The use of dynamic debugging provides more flexibility as each debug
>> statement can be enabled or disabled dynamically on basis of source filename,
>> line number, module name etc. by writing to a control file in debugfs
>> filesystem. For better understanding please refer to
>> Documentation/dynamic-debug-howto.txt.
>>
>> The DSSDBGF() differs from DSSDBG() by providing function name. However,
>> function name, line number, module name and thread ID can be printed through
>> dynamic debug by setting appropriate flags 'f','l','m' and 't' in the debugfs
>> control file. So, DSSDBGF instances are replaced with DSSDBG.
>>
>> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
>> ---
>>  drivers/video/omap2/dss/apply.c |    8 ++++----
>>  drivers/video/omap2/dss/dsi.c   |   12 ++++++------
>>  drivers/video/omap2/dss/dss.h   |   34 ++++++++--------------------------
>>  3 files changed, 18 insertions(+), 36 deletions(-)
>>
>
>> -     DSSDBGF("%d", channel);
>> +     DSSDBG("Initial Config of Virtual Channel %d", channel);
>
> A Bit Too Much Capital Letters here for my taste =). Use just one at the
> beginning of the print, or none at all.
>
>>
>>       r = dsi_read_reg(dsidev, DSI_VC_CTRL(channel));
>>
>> @@ -2814,7 +2814,7 @@ static int dsi_vc_config_source(struct platform_device *dsidev, int channel,
>>       if (dsi->vc[channel].source = source)
>>               return 0;
>>
>> -     DSSDBGF("%d", channel);
>> +     DSSDBG("Source Config of Virtual Channel %d", channel);
>
> Here also.
>

Ok.

>>
>>       dsi_sync_vc(dsidev, channel);
>>
>> @@ -3572,7 +3572,7 @@ static int dsi_enter_ulps(struct platform_device *dsidev)
>>       int r, i;
>>       unsigned mask;
>>
>> -     DSSDBGF();
>> +     DSSDBG("Entering ULPS");
>>
>>       WARN_ON(!dsi_bus_is_locked(dsidev));
>>
>> @@ -4276,7 +4276,7 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
>>       unsigned long pck;
>>       int r;
>>
>> -     DSSDBGF("ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk);
>> +     DSSDBG("Setting DSI clocks: ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk);
>>
>>       mutex_lock(&dsi->lock);
>>
>> diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
>> index ffbba7e..5ef4e17 100644
>> --- a/drivers/video/omap2/dss/dss.h
>> +++ b/drivers/video/omap2/dss/dss.h
>> @@ -25,38 +25,20 @@
>>
>>  #ifdef DEBUG
>>  extern bool dss_debug;
>> -#ifdef DSS_SUBSYS_NAME
>> -#define DSSDBG(format, ...) \
>> -     if (dss_debug) \
>> -             printk(KERN_DEBUG "omapdss " DSS_SUBSYS_NAME ": " format, \
>> -             ## __VA_ARGS__)
>> -#else
>> -#define DSSDBG(format, ...) \
>> -     if (dss_debug) \
>> -             printk(KERN_DEBUG "omapdss: " format, ## __VA_ARGS__)
>>  #endif
>>
>> -#ifdef DSS_SUBSYS_NAME
>> -#define DSSDBGF(format, ...) \
>> -     if (dss_debug) \
>> -             printk(KERN_DEBUG "omapdss " DSS_SUBSYS_NAME \
>> -                             ": %s(" format ")\n", \
>> -                             __func__, \
>> -                             ## __VA_ARGS__)
>> -#else
>> -#define DSSDBGF(format, ...) \
>> -     if (dss_debug) \
>> -             printk(KERN_DEBUG "omapdss: " \
>> -                             ": %s(" format ")\n", \
>> -                             __func__, \
>> -                             ## __VA_ARGS__)
>> +#ifdef pr_fmt
>> +#undef pr_fmt
>>  #endif
>>
>> -#else /* DEBUG */
>> -#define DSSDBG(format, ...)
>> -#define DSSDBGF(format, ...)
>> +#ifdef DSS_SUBSYS_NAME
>> +#define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt
>> +#else
>> +#define pr_fmt(fmt) fmt
>>  #endif
>
> I think you could just do:
>
> #ifdef DSS_SUBSYS_NAME
> #ifdef pr_fmt
> #undef pr_fmt
> #endif
> #define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt
> #endif
>
> For the case where there's no DSS_SUBSYS_NAME, there's no need to undef
> pr_fmt, only to redefine it again back to the original.
>
>  Tomi
>

Ok. But I thought it could be more clearer if the definition of pr_fmt
is more clearer in both the cases, when DSS_SUBSYS_NAME is defined and
when not.

-- 
Chandrabhanu Mahapatra
Texas Instruments India Pvt. Ltd.

^ permalink raw reply

* Re: [PATCH V3 2/3] OMAPDSS: Cleanup DSSDBG with dynamic pr_debug function
From: Tomi Valkeinen @ 2012-09-28 11:37 UTC (permalink / raw)
  To: Mahapatra, Chandrabhanu; +Cc: linux-omap, linux-fbdev
In-Reply-To: <CAF0AtAvfnnBzTgPtNBJhxXTp9dZfPQOnotNmCQ+Fz=tkHY65gA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 616 bytes --]

On Fri, 2012-09-28 at 17:00 +0530, Mahapatra, Chandrabhanu wrote:

> > I think you could just do:
> >
> > #ifdef DSS_SUBSYS_NAME
> > #ifdef pr_fmt
> > #undef pr_fmt
> > #endif
> > #define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt
> > #endif
> >
> > For the case where there's no DSS_SUBSYS_NAME, there's no need to undef
> > pr_fmt, only to redefine it again back to the original.
> >
> >  Tomi
> >
> 
> Ok. But I thought it could be more clearer if the definition of pr_fmt
> is more clearer in both the cases, when DSS_SUBSYS_NAME is defined and
> when not.

Ok, then it's fine for me.

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH V3 0/3] OMAPDSS: Enable dynamic debug printing
From: Tomi Valkeinen @ 2012-09-28 11:34 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra; +Cc: linux-omap, linux-fbdev
In-Reply-To: <cover.1348826106.git.cmahapatra@ti.com>

[-- Attachment #1: Type: text/plain, Size: 2217 bytes --]

On Fri, 2012-09-28 at 15:53 +0530, Chandrabhanu Mahapatra wrote:
> Hi everyone,
> this patch series aims at cleaning up of DSS of printk()'s enabled with
> dss_debug and replace them with generic dynamic debug printing.
> 
> The 1st patch
>  * moved DEBUG flag definition to Makefile
> The 2nd patch 
>  * replaces printk() in DSSDBG definition with pr_debug()
>  * removes DSSDBGF definition and replaces its instances with DSSDBG() 
> The 3rd patch
>  * cleans up printk()'s in omap_dispc_unregister_isr() and 
>    _dsi_print_reset_status() with pr_debug()
>  * removes dss_debug variable
> 
> Changes from V1 to V2:
>  * added debug messages to DSSDBG calls
>  * added patch "OMAPDSS: Remove dss_debug variable"
> 
> Changes from V2 to V3
>  * added patch "OMAPDSS: Move definition of DEBUG flag to Makefile"
> 
> All your comments and suggestions are welcome.

There's one thing that's not quite nice about omapdss's debug print
behavior after this series.

CONFIG_OMAP2_DSS_DEBUG_SUPPORT is marked "default y", and it's also been
safe to enable earlier as we had the dss_debug variable to prevent the
debug prints. But after this series, the debug prints are enabled, and
will spam the kernel log quite heavily.

And that happens with both dynamic debugging enabled and disabled.

How things should work:

For kernels with dynamic debugging disabled: by default the dss debugs
are not compiled, and the user needs to explicitly enable them in the
kernel config.

For kernels with dynamic debugging enabled: by default the dss debugs
are compiled in, but not enabled. A Kconfig option can be set to make
the debugs enabled by default.

In addition to those, we have the debugfs files. Those should be usable
regardless of the debug prints.

So I suggest the following:

- Remove CONFIG_OMAP2_DSS_DEBUG_SUPPORT. We can't re-use it, because it
may be enabled in user's kernel configs.
- Add new Kconfig option: CONFIG_OMAP2_DSS_DEBUG. This will set DEBUG in
the makefile. This is off by default.
- Add new Kconfig option: CONFIG_OMAP2_DSS_DEBUGFS. This will be use to
decide if debugfs functionality is compiled in or not. This is off by
default.

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH V3 2/3] OMAPDSS: Cleanup DSSDBG with dynamic pr_debug function
From: Tomi Valkeinen @ 2012-09-28 11:22 UTC (permalink / raw)
  To: Chandrabhanu Mahapatra; +Cc: linux-omap, linux-fbdev
In-Reply-To: <2fc91980de4af940ac59b26fd49da6498865db8b.1348826106.git.cmahapatra@ti.com>

[-- Attachment #1: Type: text/plain, Size: 3746 bytes --]

On Fri, 2012-09-28 at 15:53 +0530, Chandrabhanu Mahapatra wrote:
> The printk in DSSDBG function definition is replaced with dynamic debug enabled
> pr_debug(). The use of dynamic debugging provides more flexibility as each debug
> statement can be enabled or disabled dynamically on basis of source filename,
> line number, module name etc. by writing to a control file in debugfs
> filesystem. For better understanding please refer to
> Documentation/dynamic-debug-howto.txt.
> 
> The DSSDBGF() differs from DSSDBG() by providing function name. However,
> function name, line number, module name and thread ID can be printed through
> dynamic debug by setting appropriate flags 'f','l','m' and 't' in the debugfs
> control file. So, DSSDBGF instances are replaced with DSSDBG.
> 
> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
> ---
>  drivers/video/omap2/dss/apply.c |    8 ++++----
>  drivers/video/omap2/dss/dsi.c   |   12 ++++++------
>  drivers/video/omap2/dss/dss.h   |   34 ++++++++--------------------------
>  3 files changed, 18 insertions(+), 36 deletions(-)
> 

> -	DSSDBGF("%d", channel);
> +	DSSDBG("Initial Config of Virtual Channel %d", channel);

A Bit Too Much Capital Letters here for my taste =). Use just one at the
beginning of the print, or none at all. 

>  
>  	r = dsi_read_reg(dsidev, DSI_VC_CTRL(channel));
>  
> @@ -2814,7 +2814,7 @@ static int dsi_vc_config_source(struct platform_device *dsidev, int channel,
>  	if (dsi->vc[channel].source == source)
>  		return 0;
>  
> -	DSSDBGF("%d", channel);
> +	DSSDBG("Source Config of Virtual Channel %d", channel);

Here also.

>  
>  	dsi_sync_vc(dsidev, channel);
>  
> @@ -3572,7 +3572,7 @@ static int dsi_enter_ulps(struct platform_device *dsidev)
>  	int r, i;
>  	unsigned mask;
>  
> -	DSSDBGF();
> +	DSSDBG("Entering ULPS");
>  
>  	WARN_ON(!dsi_bus_is_locked(dsidev));
>  
> @@ -4276,7 +4276,7 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
>  	unsigned long pck;
>  	int r;
>  
> -	DSSDBGF("ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk);
> +	DSSDBG("Setting DSI clocks: ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk);
>  
>  	mutex_lock(&dsi->lock);
>  
> diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
> index ffbba7e..5ef4e17 100644
> --- a/drivers/video/omap2/dss/dss.h
> +++ b/drivers/video/omap2/dss/dss.h
> @@ -25,38 +25,20 @@
>  
>  #ifdef DEBUG
>  extern bool dss_debug;
> -#ifdef DSS_SUBSYS_NAME
> -#define DSSDBG(format, ...) \
> -	if (dss_debug) \
> -		printk(KERN_DEBUG "omapdss " DSS_SUBSYS_NAME ": " format, \
> -		## __VA_ARGS__)
> -#else
> -#define DSSDBG(format, ...) \
> -	if (dss_debug) \
> -		printk(KERN_DEBUG "omapdss: " format, ## __VA_ARGS__)
>  #endif
>  
> -#ifdef DSS_SUBSYS_NAME
> -#define DSSDBGF(format, ...) \
> -	if (dss_debug) \
> -		printk(KERN_DEBUG "omapdss " DSS_SUBSYS_NAME \
> -				": %s(" format ")\n", \
> -				__func__, \
> -				## __VA_ARGS__)
> -#else
> -#define DSSDBGF(format, ...) \
> -	if (dss_debug) \
> -		printk(KERN_DEBUG "omapdss: " \
> -				": %s(" format ")\n", \
> -				__func__, \
> -				## __VA_ARGS__)
> +#ifdef pr_fmt
> +#undef pr_fmt
>  #endif
>  
> -#else /* DEBUG */
> -#define DSSDBG(format, ...)
> -#define DSSDBGF(format, ...)
> +#ifdef DSS_SUBSYS_NAME
> +#define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt
> +#else
> +#define pr_fmt(fmt) fmt
>  #endif

I think you could just do:

#ifdef DSS_SUBSYS_NAME
#ifdef pr_fmt
#undef pr_fmt
#endif
#define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt
#endif 

For the case where there's no DSS_SUBSYS_NAME, there's no need to undef
pr_fmt, only to redefine it again back to the original.

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH 1/6] OMAPDSS: add omapdss_version
From: Archit Taneja @ 2012-09-28 11:12 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: linux-omap, linux-fbdev, Chandrabhanu Mahapatra,
	Raphaël Assénat, Tony Lindgren
In-Reply-To: <1348828527-13309-2-git-send-email-tomi.valkeinen@ti.com>

On Friday 28 September 2012 04:05 PM, Tomi Valkeinen wrote:
> Add new enum, omapdss_version, that is used to tell which DSS hardware
> version the SoC has. This enum is initialized during platform init, and
> passed in the platform data to omapdss driver.
>
> Note that the versions are not "continuous", that is, you cannot check
> if the version is less or greater than something, but you need to check
> for exact version match. In other words, this is invalid:
>
> /* test if DSS is 3630 or earlier */
> if (ver <= OMAPDSS_VER_OMAP3630)
> 	...
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>   arch/arm/mach-omap2/display.c |   38 ++++++++++++++++++++++++++++++++++++++
>   include/video/omapdss.h       |   14 ++++++++++++++
>   2 files changed, 52 insertions(+)
>
> diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
> index ee40739..33555da 100644
> --- a/arch/arm/mach-omap2/display.c
> +++ b/arch/arm/mach-omap2/display.c
> @@ -284,6 +284,35 @@ err:
>   	return ERR_PTR(r);
>   }
>
> +static enum omapdss_version omap_display_get_version(void)

We could add a __init for this function?

Archit


^ permalink raw reply

* Re: [PATCH 1/6] OMAPDSS: add omapdss_version
From: Tomi Valkeinen @ 2012-09-28 11:07 UTC (permalink / raw)
  To: Archit Taneja
  Cc: linux-omap, linux-fbdev, Chandrabhanu Mahapatra,
	Raphaël Assénat, Tony Lindgren
In-Reply-To: <50658345.5050403@ti.com>

[-- Attachment #1: Type: text/plain, Size: 1318 bytes --]

On Fri, 2012-09-28 at 16:30 +0530, Archit Taneja wrote:
> On Friday 28 September 2012 04:05 PM, Tomi Valkeinen wrote:
> > Add new enum, omapdss_version, that is used to tell which DSS hardware
> > version the SoC has. This enum is initialized during platform init, and
> > passed in the platform data to omapdss driver.
> >
> > Note that the versions are not "continuous", that is, you cannot check
> > if the version is less or greater than something, but you need to check
> > for exact version match. In other words, this is invalid:
> >
> > /* test if DSS is 3630 or earlier */
> > if (ver <= OMAPDSS_VER_OMAP3630)
> > 	...
> >
> > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > ---
> >   arch/arm/mach-omap2/display.c |   38 ++++++++++++++++++++++++++++++++++++++
> >   include/video/omapdss.h       |   14 ++++++++++++++
> >   2 files changed, 52 insertions(+)
> >
> > diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
> > index ee40739..33555da 100644
> > --- a/arch/arm/mach-omap2/display.c
> > +++ b/arch/arm/mach-omap2/display.c
> > @@ -284,6 +284,35 @@ err:
> >   	return ERR_PTR(r);
> >   }
> >
> > +static enum omapdss_version omap_display_get_version(void)
> 
> We could add a __init for this function?

Good point, thanks.

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH 1/6] OMAPDSS: add omapdss_version
From: Tomi Valkeinen @ 2012-09-28 10:44 UTC (permalink / raw)
  To: linux-omap
  Cc: linux-fbdev, Archit Taneja, Chandrabhanu Mahapatra,
	Raphaël Assénat, Tony Lindgren
In-Reply-To: <1348828527-13309-2-git-send-email-tomi.valkeinen@ti.com>

[-- Attachment #1: Type: text/plain, Size: 2102 bytes --]

On Fri, 2012-09-28 at 13:35 +0300, Tomi Valkeinen wrote:
> Add new enum, omapdss_version, that is used to tell which DSS hardware
> version the SoC has. This enum is initialized during platform init, and
> passed in the platform data to omapdss driver.
> 
> Note that the versions are not "continuous", that is, you cannot check
> if the version is less or greater than something, but you need to check
> for exact version match. In other words, this is invalid:
> 
> /* test if DSS is 3630 or earlier */
> if (ver <= OMAPDSS_VER_OMAP3630)
> 	...
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  arch/arm/mach-omap2/display.c |   38 ++++++++++++++++++++++++++++++++++++++
>  include/video/omapdss.h       |   14 ++++++++++++++
>  2 files changed, 52 insertions(+)
> 
> diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
> index ee40739..33555da 100644
> --- a/arch/arm/mach-omap2/display.c
> +++ b/arch/arm/mach-omap2/display.c
> @@ -284,6 +284,35 @@ err:
>  	return ERR_PTR(r);
>  }
>  
> +static enum omapdss_version omap_display_get_version(void)
> +{
> +	if (cpu_is_omap24xx())
> +		return OMAPDSS_VER_OMAP24xx;
> +	else if (cpu_is_omap3630())
> +		return OMAPDSS_VER_OMAP3630;
> +	else if (cpu_is_omap34xx()) {
> +		if (soc_is_am35xx()) {
> +			return OMAPDSS_VER_AM35xx;
> +		} else {
> +			if (omap_rev() < OMAP3430_REV_ES3_0)
> +				return OMAPDSS_VER_OMAP34xx_ES1;
> +			else
> +				return OMAPDSS_VER_OMAP34xx_ES3;
> +		}
> +	} else if (omap_rev() == OMAP4430_REV_ES1_0)
> +		return OMAPDSS_VER_OMAP4430_ES1;
> +	else if (omap_rev() == OMAP4430_REV_ES2_0 ||
> +			omap_rev() == OMAP4430_REV_ES2_1 ||
> +			omap_rev() == OMAP4430_REV_ES2_2)
> +		return OMAPDSS_VER_OMAP4430_ES2;
> +	else if (cpu_is_omap44xx())
> +		return OMAPDSS_VER_OMAP4;
> +	else if (soc_is_omap54xx())
> +		return OMAPDSS_VER_OMAP5;
> +	else
> +		return OMAPDSS_VER_UNKNOWN

Sigh. I made a late minor change, and of course I broke the compilation
and didn't check it. So there's a ; missing in the above line.

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* [PATCH V3 3/3] OMAPDSS: Remove dss_debug variable
From: Chandrabhanu Mahapatra @ 2012-09-28 10:35 UTC (permalink / raw)
  To: tomi.valkeinen; +Cc: linux-omap, linux-fbdev, Chandrabhanu Mahapatra
In-Reply-To: <cover.1348826106.git.cmahapatra@ti.com>

The debug prints in omap_dispc_unregister_isr() and _dsi_print_reset_status()
are replaced with dynamic debug enabled pr_debug(). So, as the final dependency
on dss_debug variable is replaced with dyndbg, the dss_debug variable is
removed.

Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/video/omap2/dss/core.c  |    5 -----
 drivers/video/omap2/dss/dispc.c |   39 ++++++++++++++-------------------------
 drivers/video/omap2/dss/dsi.c   |   37 ++++++++++++++-----------------------
 drivers/video/omap2/dss/dss.h   |    4 ----
 4 files changed, 28 insertions(+), 57 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index b2af72d..e51bd84 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -53,11 +53,6 @@ static char *def_disp_name;
 module_param_named(def_disp, def_disp_name, charp, 0);
 MODULE_PARM_DESC(def_disp, "default display name");
 
-#ifdef DEBUG
-bool dss_debug;
-module_param_named(debug, dss_debug, bool, 0644);
-#endif
-
 const char *dss_get_default_display_name(void)
 {
 	return core.default_display_name;
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index a173a94..85d2128 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3669,34 +3669,26 @@ int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask)
 }
 EXPORT_SYMBOL(omap_dispc_unregister_isr);
 
-#ifdef DEBUG
 static void print_irq_status(u32 status)
 {
 	if ((status & dispc.irq_error_mask) = 0)
 		return;
 
-	printk(KERN_DEBUG "DISPC IRQ: 0x%x: ", status);
-
-#define PIS(x) \
-	if (status & DISPC_IRQ_##x) \
-		printk(#x " ");
-	PIS(GFX_FIFO_UNDERFLOW);
-	PIS(OCP_ERR);
-	PIS(VID1_FIFO_UNDERFLOW);
-	PIS(VID2_FIFO_UNDERFLOW);
-	if (dss_feat_get_num_ovls() > 3)
-		PIS(VID3_FIFO_UNDERFLOW);
-	PIS(SYNC_LOST);
-	PIS(SYNC_LOST_DIGIT);
-	if (dss_has_feature(FEAT_MGR_LCD2))
-		PIS(SYNC_LOST2);
-	if (dss_has_feature(FEAT_MGR_LCD3))
-		PIS(SYNC_LOST3);
+#define PIS(x) (status & DISPC_IRQ_##x) ? (#x " ") : ""
+
+	pr_debug("DISPC IRQ: 0x%x: %s%s%s%s%s%s%s%s%s\n",
+		status,
+		PIS(OCP_ERR),
+		PIS(GFX_FIFO_UNDERFLOW),
+		PIS(VID1_FIFO_UNDERFLOW),
+		PIS(VID2_FIFO_UNDERFLOW),
+		dss_feat_get_num_ovls() > 3 ? PIS(VID3_FIFO_UNDERFLOW) : "",
+		PIS(SYNC_LOST),
+		PIS(SYNC_LOST_DIGIT),
+		dss_has_feature(FEAT_MGR_LCD2) ? PIS(SYNC_LOST2) : "",
+		dss_has_feature(FEAT_MGR_LCD3) ? PIS(SYNC_LOST3) : "");
 #undef PIS
-
-	printk("\n");
 }
-#endif
 
 /* Called from dss.c. Note that we don't touch clocks here,
  * but we presume they are on because we got an IRQ. However,
@@ -3729,10 +3721,7 @@ static irqreturn_t omap_dispc_irq_handler(int irq, void *arg)
 	spin_unlock(&dispc.irq_stats_lock);
 #endif
 
-#ifdef DEBUG
-	if (dss_debug)
-		print_irq_status(irqstatus);
-#endif
+	print_irq_status(irqstatus);
 	/* Ack the interrupt. Do it here before clocks are possibly turned
 	 * off */
 	dispc_write_reg(DISPC_IRQSTATUS, irqstatus);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 3b524cd..70be86c 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -1107,28 +1107,16 @@ static inline void dsi_enable_pll_clock(struct platform_device *dsidev,
 	}
 }
 
-#ifdef DEBUG
 static void _dsi_print_reset_status(struct platform_device *dsidev)
 {
 	u32 l;
 	int b0, b1, b2;
 
-	if (!dss_debug)
-		return;
-
 	/* A dummy read using the SCP interface to any DSIPHY register is
 	 * required after DSIPHY reset to complete the reset of the DSI complex
 	 * I/O. */
 	l = dsi_read_reg(dsidev, DSI_DSIPHY_CFG5);
 
-	printk(KERN_DEBUG "DSI resets: ");
-
-	l = dsi_read_reg(dsidev, DSI_PLL_STATUS);
-	printk("PLL (%d) ", FLD_GET(l, 0, 0));
-
-	l = dsi_read_reg(dsidev, DSI_COMPLEXIO_CFG1);
-	printk("CIO (%d) ", FLD_GET(l, 29, 29));
-
 	if (dss_has_feature(FEAT_DSI_REVERSE_TXCLKESC)) {
 		b0 = 28;
 		b1 = 27;
@@ -1139,18 +1127,21 @@ static void _dsi_print_reset_status(struct platform_device *dsidev)
 		b2 = 26;
 	}
 
-	l = dsi_read_reg(dsidev, DSI_DSIPHY_CFG5);
-	printk("PHY (%x%x%x, %d, %d, %d)\n",
-			FLD_GET(l, b0, b0),
-			FLD_GET(l, b1, b1),
-			FLD_GET(l, b2, b2),
-			FLD_GET(l, 29, 29),
-			FLD_GET(l, 30, 30),
-			FLD_GET(l, 31, 31));
+#define DSI_FLD_GET(fld, start, end)\
+	FLD_GET(dsi_read_reg(dsidev, DSI_##fld), start, end)
+
+	pr_debug("DSI resets: PLL (%d) CIO (%d) PHY (%x%x%x, %d, %d, %d)\n",
+		DSI_FLD_GET(PLL_STATUS, 0, 0),
+		DSI_FLD_GET(COMPLEXIO_CFG1, 29, 29),
+		DSI_FLD_GET(DSIPHY_CFG5, b0, b0),
+		DSI_FLD_GET(DSIPHY_CFG5, b1, b1),
+		DSI_FLD_GET(DSIPHY_CFG5, b2, b2),
+		DSI_FLD_GET(DSIPHY_CFG5, 29, 29),
+		DSI_FLD_GET(DSIPHY_CFG5, 30, 30),
+		DSI_FLD_GET(DSIPHY_CFG5, 31, 31));
+
+#undef DSI_FLD_GET
 }
-#else
-#define _dsi_print_reset_status(x)
-#endif
 
 static inline int dsi_if_enable(struct platform_device *dsidev, bool enable)
 {
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 5ef4e17..1d0205c 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -23,10 +23,6 @@
 #ifndef __OMAP2_DSS_H
 #define __OMAP2_DSS_H
 
-#ifdef DEBUG
-extern bool dss_debug;
-#endif
-
 #ifdef pr_fmt
 #undef pr_fmt
 #endif
-- 
1.7.10


^ permalink raw reply related

* [PATCH V3 2/3] OMAPDSS: Cleanup DSSDBG with dynamic pr_debug function
From: Chandrabhanu Mahapatra @ 2012-09-28 10:35 UTC (permalink / raw)
  To: tomi.valkeinen; +Cc: linux-omap, linux-fbdev, Chandrabhanu Mahapatra
In-Reply-To: <cover.1348826106.git.cmahapatra@ti.com>

The printk in DSSDBG function definition is replaced with dynamic debug enabled
pr_debug(). The use of dynamic debugging provides more flexibility as each debug
statement can be enabled or disabled dynamically on basis of source filename,
line number, module name etc. by writing to a control file in debugfs
filesystem. For better understanding please refer to
Documentation/dynamic-debug-howto.txt.

The DSSDBGF() differs from DSSDBG() by providing function name. However,
function name, line number, module name and thread ID can be printed through
dynamic debug by setting appropriate flags 'f','l','m' and 't' in the debugfs
control file. So, DSSDBGF instances are replaced with DSSDBG.

Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com>
---
 drivers/video/omap2/dss/apply.c |    8 ++++----
 drivers/video/omap2/dss/dsi.c   |   12 ++++++------
 drivers/video/omap2/dss/dss.h   |   34 ++++++++--------------------------
 3 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 19d66f4..e923d9f 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -573,7 +573,7 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl)
 	struct mgr_priv_data *mp;
 	int r;
 
-	DSSDBGF("%d", ovl->id);
+	DSSDBG("writing ovl %d regs", ovl->id);
 
 	if (!op->enabled || !op->info_dirty)
 		return;
@@ -608,7 +608,7 @@ static void dss_ovl_write_regs_extra(struct omap_overlay *ovl)
 	struct ovl_priv_data *op = get_ovl_priv(ovl);
 	struct mgr_priv_data *mp;
 
-	DSSDBGF("%d", ovl->id);
+	DSSDBG("writing ovl %d regs extra", ovl->id);
 
 	if (!op->extra_info_dirty)
 		return;
@@ -632,7 +632,7 @@ static void dss_mgr_write_regs(struct omap_overlay_manager *mgr)
 	struct mgr_priv_data *mp = get_mgr_priv(mgr);
 	struct omap_overlay *ovl;
 
-	DSSDBGF("%d", mgr->id);
+	DSSDBG("writing mgr %d regs", mgr->id);
 
 	if (!mp->enabled)
 		return;
@@ -658,7 +658,7 @@ static void dss_mgr_write_regs_extra(struct omap_overlay_manager *mgr)
 {
 	struct mgr_priv_data *mp = get_mgr_priv(mgr);
 
-	DSSDBGF("%d", mgr->id);
+	DSSDBG("writing mgr %d regs extra", mgr->id);
 
 	if (!mp->extra_info_dirty)
 		return;
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index e37e6d8..3b524cd 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -1612,7 +1612,7 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev,
 	u8 regn_start, regn_end, regm_start, regm_end;
 	u8 regm_dispc_start, regm_dispc_end, regm_dsi_start, regm_dsi_end;
 
-	DSSDBGF();
+	DSSDBG("DSI PLL clock config starts");
 
 	dsi->current_cinfo.clkin = cinfo->clkin;
 	dsi->current_cinfo.fint = cinfo->fint;
@@ -2431,7 +2431,7 @@ static int dsi_cio_init(struct platform_device *dsidev)
 	int r;
 	u32 l;
 
-	DSSDBGF();
+	DSSDBG("DSI CIO init starts");
 
 	r = dss_dsi_enable_pads(dsi->module_id, dsi_get_lane_mask(dsidev));
 	if (r)
@@ -2782,7 +2782,7 @@ static void dsi_vc_initial_config(struct platform_device *dsidev, int channel)
 {
 	u32 r;
 
-	DSSDBGF("%d", channel);
+	DSSDBG("Initial Config of Virtual Channel %d", channel);
 
 	r = dsi_read_reg(dsidev, DSI_VC_CTRL(channel));
 
@@ -2814,7 +2814,7 @@ static int dsi_vc_config_source(struct platform_device *dsidev, int channel,
 	if (dsi->vc[channel].source = source)
 		return 0;
 
-	DSSDBGF("%d", channel);
+	DSSDBG("Source Config of Virtual Channel %d", channel);
 
 	dsi_sync_vc(dsidev, channel);
 
@@ -3572,7 +3572,7 @@ static int dsi_enter_ulps(struct platform_device *dsidev)
 	int r, i;
 	unsigned mask;
 
-	DSSDBGF();
+	DSSDBG("Entering ULPS");
 
 	WARN_ON(!dsi_bus_is_locked(dsidev));
 
@@ -4276,7 +4276,7 @@ int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
 	unsigned long pck;
 	int r;
 
-	DSSDBGF("ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk);
+	DSSDBG("Setting DSI clocks: ddr_clk %lu, lp_clk %lu", ddr_clk, lp_clk);
 
 	mutex_lock(&dsi->lock);
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index ffbba7e..5ef4e17 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -25,38 +25,20 @@
 
 #ifdef DEBUG
 extern bool dss_debug;
-#ifdef DSS_SUBSYS_NAME
-#define DSSDBG(format, ...) \
-	if (dss_debug) \
-		printk(KERN_DEBUG "omapdss " DSS_SUBSYS_NAME ": " format, \
-		## __VA_ARGS__)
-#else
-#define DSSDBG(format, ...) \
-	if (dss_debug) \
-		printk(KERN_DEBUG "omapdss: " format, ## __VA_ARGS__)
 #endif
 
-#ifdef DSS_SUBSYS_NAME
-#define DSSDBGF(format, ...) \
-	if (dss_debug) \
-		printk(KERN_DEBUG "omapdss " DSS_SUBSYS_NAME \
-				": %s(" format ")\n", \
-				__func__, \
-				## __VA_ARGS__)
-#else
-#define DSSDBGF(format, ...) \
-	if (dss_debug) \
-		printk(KERN_DEBUG "omapdss: " \
-				": %s(" format ")\n", \
-				__func__, \
-				## __VA_ARGS__)
+#ifdef pr_fmt
+#undef pr_fmt
 #endif
 
-#else /* DEBUG */
-#define DSSDBG(format, ...)
-#define DSSDBGF(format, ...)
+#ifdef DSS_SUBSYS_NAME
+#define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt
+#else
+#define pr_fmt(fmt) fmt
 #endif
 
+#define DSSDBG(format, ...) \
+	pr_debug(format, ## __VA_ARGS__)
 
 #ifdef DSS_SUBSYS_NAME
 #define DSSERR(format, ...) \
-- 
1.7.10


^ permalink raw reply related

* [PATCH 6/6] OMAPDSS: remove <plat/cpu.h> includes
From: Tomi Valkeinen @ 2012-09-28 10:35 UTC (permalink / raw)
  To: linux-omap, linux-fbdev
  Cc: Archit Taneja, Chandrabhanu Mahapatra, Raphaël Assénat,
	Tony Lindgren, Tomi Valkeinen
In-Reply-To: <1348828527-13309-1-git-send-email-tomi.valkeinen@ti.com>

cpu_is_* calls are no longer used in omapdss, so the includes for
<plat/cpu.h> can be removed.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dss.c          |    2 --
 drivers/video/omap2/dss/dss_features.c |    1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 2e74eef..363852a 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -35,8 +35,6 @@
 
 #include <video/omapdss.h>
 
-#include <plat/cpu.h>
-
 #include "dss.h"
 #include "dss_features.h"
 
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index e2c2e2b..3e8287c 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -23,7 +23,6 @@
 #include <linux/slab.h>
 
 #include <video/omapdss.h>
-#include <plat/cpu.h>
 
 #include "dss.h"
 #include "dss_features.h"
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 5/6] OMAPDSS: HDMI: use omapdss_version
From: Tomi Valkeinen @ 2012-09-28 10:35 UTC (permalink / raw)
  To: linux-omap, linux-fbdev
  Cc: Archit Taneja, Chandrabhanu Mahapatra, Raphaël Assénat,
	Tony Lindgren, Tomi Valkeinen
In-Reply-To: <1348828527-13309-1-git-send-email-tomi.valkeinen@ti.com>

Use omapdss_version in hdmi.c to select the proper hdmi features.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dss_features.c |   14 ++++++++++++--
 drivers/video/omap2/dss/dss_features.h |    3 ++-
 drivers/video/omap2/dss/hdmi.c         |    3 ++-
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index 5936ba7..e2c2e2b 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -825,10 +825,20 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
 
 };
 
-void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
+void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data,
+		enum omapdss_version version)
 {
-	if (cpu_is_omap44xx())
+	switch (version) {
+	case OMAPDSS_VER_OMAP4430_ES1:
+	case OMAPDSS_VER_OMAP4430_ES2:
+	case OMAPDSS_VER_OMAP4:
 		ip_data->ops = &omap4_hdmi_functions;
+		break;
+	default:
+		ip_data->ops = NULL;
+	}
+
+	WARN_ON(ip_data->ops = NULL);
 }
 #endif
 
diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/omap2/dss/dss_features.h
index 14a412e..fc492ef 100644
--- a/drivers/video/omap2/dss/dss_features.h
+++ b/drivers/video/omap2/dss/dss_features.h
@@ -125,6 +125,7 @@ bool dss_has_feature(enum dss_feat_id id);
 void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end);
 void dss_features_init(enum omapdss_version version);
 #if defined(CONFIG_OMAP4_DSS_HDMI)
-void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data);
+void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data,
+		enum omapdss_version version);
 #endif
 #endif
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index a48a7dd..adcc906 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -323,6 +323,7 @@ static void hdmi_runtime_put(void)
 
 static int __init hdmi_init_display(struct omap_dss_device *dssdev)
 {
+	struct omap_dss_board_info *pdata = hdmi.pdev->dev.platform_data;
 	int r;
 
 	struct gpio gpios[] = {
@@ -333,7 +334,7 @@ static int __init hdmi_init_display(struct omap_dss_device *dssdev)
 
 	DSSDBG("init_display\n");
 
-	dss_init_hdmi_ip_ops(&hdmi.ip_data);
+	dss_init_hdmi_ip_ops(&hdmi.ip_data, pdata->version);
 
 	if (hdmi.vdda_hdmi_dac_reg = NULL) {
 		struct regulator *reg;
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 4/6] OMAPDSS: DSS: use omapdss_version
From: Tomi Valkeinen @ 2012-09-28 10:35 UTC (permalink / raw)
  To: linux-omap, linux-fbdev
  Cc: Archit Taneja, Chandrabhanu Mahapatra, Raphaël Assénat,
	Tony Lindgren, Tomi Valkeinen
In-Reply-To: <1348828527-13309-1-git-send-email-tomi.valkeinen@ti.com>

Use omapdss_version in dss.c to select the proper dss features.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dss.c |   37 +++++++++++++++++++++++++++----------
 1 file changed, 27 insertions(+), 10 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 2ab1c3e..2e74eef 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -792,29 +792,46 @@ static const struct dss_features omap54xx_dss_feats __initconst = {
 	.dpi_select_source	=	&dss_dpi_select_source_omap5,
 };
 
-static int __init dss_init_features(struct device *dev)
+static int __init dss_init_features(struct platform_device *pdev)
 {
+	struct omap_dss_board_info *pdata = pdev->dev.platform_data;
 	const struct dss_features *src;
 	struct dss_features *dst;
 
-	dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL);
+	dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
 	if (!dst) {
-		dev_err(dev, "Failed to allocate local DSS Features\n");
+		dev_err(&pdev->dev, "Failed to allocate local DSS Features\n");
 		return -ENOMEM;
 	}
 
-	if (cpu_is_omap24xx())
+	switch (pdata->version) {
+	case OMAPDSS_VER_OMAP24xx:
 		src = &omap24xx_dss_feats;
-	else if (cpu_is_omap34xx())
+		break;
+
+	case OMAPDSS_VER_OMAP34xx_ES1:
+	case OMAPDSS_VER_OMAP34xx_ES3:
+	case OMAPDSS_VER_AM35xx:
 		src = &omap34xx_dss_feats;
-	else if (cpu_is_omap3630())
+		break;
+
+	case OMAPDSS_VER_OMAP3630:
 		src = &omap3630_dss_feats;
-	else if (cpu_is_omap44xx())
+		break;
+
+	case OMAPDSS_VER_OMAP4430_ES1:
+	case OMAPDSS_VER_OMAP4430_ES2:
+	case OMAPDSS_VER_OMAP4:
 		src = &omap44xx_dss_feats;
-	else if (soc_is_omap54xx())
+		break;
+
+	case OMAPDSS_VER_OMAP5:
 		src = &omap54xx_dss_feats;
-	else
+		break;
+
+	default:
 		return -ENODEV;
+	}
 
 	memcpy(dst, src, sizeof(*dst));
 	dss.feat = dst;
@@ -831,7 +848,7 @@ static int __init omap_dsshw_probe(struct platform_device *pdev)
 
 	dss.pdev = pdev;
 
-	r = dss_init_features(&dss.pdev->dev);
+	r = dss_init_features(dss.pdev);
 	if (r)
 		return r;
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 3/6] OMAPDSS: DISPC: use omapdss_version
From: Tomi Valkeinen @ 2012-09-28 10:35 UTC (permalink / raw)
  To: linux-omap, linux-fbdev
  Cc: Archit Taneja, Chandrabhanu Mahapatra, Raphaël Assénat,
	Tony Lindgren, Tomi Valkeinen
In-Reply-To: <1348828527-13309-1-git-send-email-tomi.valkeinen@ti.com>

Use omapdss_version in dispc.c to select the proper dispc features.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dispc.c |   41 ++++++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index a173a94..a5ab354 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -4040,29 +4040,44 @@ static const struct dispc_features omap44xx_dispc_feats __initconst = {
 	.gfx_fifo_workaround	=	true,
 };
 
-static int __init dispc_init_features(struct device *dev)
+static int __init dispc_init_features(struct platform_device *pdev)
 {
+	struct omap_dss_board_info *pdata = pdev->dev.platform_data;
 	const struct dispc_features *src;
 	struct dispc_features *dst;
 
-	dst = devm_kzalloc(dev, sizeof(*dst), GFP_KERNEL);
+	dst = devm_kzalloc(&pdev->dev, sizeof(*dst), GFP_KERNEL);
 	if (!dst) {
-		dev_err(dev, "Failed to allocate DISPC Features\n");
+		dev_err(&pdev->dev, "Failed to allocate DISPC Features\n");
 		return -ENOMEM;
 	}
 
-	if (cpu_is_omap24xx()) {
+	switch (pdata->version) {
+	case OMAPDSS_VER_OMAP24xx:
 		src = &omap24xx_dispc_feats;
-	} else if (cpu_is_omap34xx()) {
-		if (omap_rev() < OMAP3430_REV_ES3_0)
-			src = &omap34xx_rev1_0_dispc_feats;
-		else
-			src = &omap34xx_rev3_0_dispc_feats;
-	} else if (cpu_is_omap44xx()) {
+		break;
+
+	case OMAPDSS_VER_OMAP34xx_ES1:
+		src = &omap34xx_rev1_0_dispc_feats;
+		break;
+
+	case OMAPDSS_VER_OMAP34xx_ES3:
+	case OMAPDSS_VER_OMAP3630:
+	case OMAPDSS_VER_AM35xx:
+		src = &omap34xx_rev3_0_dispc_feats;
+		break;
+
+	case OMAPDSS_VER_OMAP4430_ES1:
+	case OMAPDSS_VER_OMAP4430_ES2:
+	case OMAPDSS_VER_OMAP4:
 		src = &omap44xx_dispc_feats;
-	} else if (soc_is_omap54xx()) {
+		break;
+
+	case OMAPDSS_VER_OMAP5:
 		src = &omap44xx_dispc_feats;
-	} else {
+		break;
+
+	default:
 		return -ENODEV;
 	}
 
@@ -4082,7 +4097,7 @@ static int __init omap_dispchw_probe(struct platform_device *pdev)
 
 	dispc.pdev = pdev;
 
-	r = dispc_init_features(&dispc.pdev->dev);
+	r = dispc_init_features(dispc.pdev);
 	if (r)
 		return r;
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 2/6] OMAPDSS: use omapdss_version in dss_features.c
From: Tomi Valkeinen @ 2012-09-28 10:35 UTC (permalink / raw)
  To: linux-omap, linux-fbdev
  Cc: Archit Taneja, Chandrabhanu Mahapatra, Raphaël Assénat,
	Tony Lindgren, Tomi Valkeinen
In-Reply-To: <1348828527-13309-1-git-send-email-tomi.valkeinen@ti.com>

Pass the omapdss_version to dss_features.c and use it to select the
proper dss features.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/core.c         |    2 +-
 drivers/video/omap2/dss/dss_features.c |   49 +++++++++++++++++++++-----------
 drivers/video/omap2/dss/dss_features.h |    2 +-
 3 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index b2af72d..d94ef9e 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -237,7 +237,7 @@ static int __init omap_dss_probe(struct platform_device *pdev)
 
 	core.pdev = pdev;
 
-	dss_features_init();
+	dss_features_init(pdata->version);
 
 	dss_apply_init();
 
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index acbc1e1..5936ba7 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -929,29 +929,44 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type)
 	return omap_current_dss_features->supported_rotation_types & rot_type;
 }
 
-void dss_features_init(void)
+void dss_features_init(enum omapdss_version version)
 {
-	if (cpu_is_omap24xx())
+	switch (version) {
+	case OMAPDSS_VER_OMAP24xx:
 		omap_current_dss_features = &omap2_dss_features;
-	else if (cpu_is_omap3630())
+		break;
+
+	case OMAPDSS_VER_OMAP34xx_ES1:
+	case OMAPDSS_VER_OMAP34xx_ES3:
+		omap_current_dss_features = &omap3430_dss_features;
+		break;
+
+	case OMAPDSS_VER_OMAP3630:
 		omap_current_dss_features = &omap3630_dss_features;
-	else if (cpu_is_omap34xx()) {
-		if (soc_is_am35xx()) {
-			omap_current_dss_features = &am35xx_dss_features;
-		} else {
-			omap_current_dss_features = &omap3430_dss_features;
-		}
-	}
-	else if (omap_rev() = OMAP4430_REV_ES1_0)
+		break;
+
+	case OMAPDSS_VER_OMAP4430_ES1:
 		omap_current_dss_features = &omap4430_es1_0_dss_features;
-	else if (omap_rev() = OMAP4430_REV_ES2_0 ||
-		omap_rev() = OMAP4430_REV_ES2_1 ||
-		omap_rev() = OMAP4430_REV_ES2_2)
+		break;
+
+	case OMAPDSS_VER_OMAP4430_ES2:
 		omap_current_dss_features = &omap4430_es2_0_1_2_dss_features;
-	else if (cpu_is_omap44xx())
+		break;
+
+	case OMAPDSS_VER_OMAP4:
 		omap_current_dss_features = &omap4_dss_features;
-	else if (soc_is_omap54xx())
+		break;
+
+	case OMAPDSS_VER_OMAP5:
 		omap_current_dss_features = &omap5_dss_features;
-	else
+		break;
+
+	case OMAPDSS_VER_AM35xx:
+		omap_current_dss_features = &am35xx_dss_features;
+		break;
+
+	default:
 		DSSWARN("Unsupported OMAP version");
+		break;
+	}
 }
diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/omap2/dss/dss_features.h
index 9218113..14a412e 100644
--- a/drivers/video/omap2/dss/dss_features.h
+++ b/drivers/video/omap2/dss/dss_features.h
@@ -123,7 +123,7 @@ bool dss_feat_rotation_type_supported(enum omap_dss_rotation_type rot_type);
 
 bool dss_has_feature(enum dss_feat_id id);
 void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end);
-void dss_features_init(void);
+void dss_features_init(enum omapdss_version version);
 #if defined(CONFIG_OMAP4_DSS_HDMI)
 void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data);
 #endif
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 1/6] OMAPDSS: add omapdss_version
From: Tomi Valkeinen @ 2012-09-28 10:35 UTC (permalink / raw)
  To: linux-omap, linux-fbdev
  Cc: Archit Taneja, Chandrabhanu Mahapatra, Raphaël Assénat,
	Tony Lindgren, Tomi Valkeinen
In-Reply-To: <1348828527-13309-1-git-send-email-tomi.valkeinen@ti.com>

Add new enum, omapdss_version, that is used to tell which DSS hardware
version the SoC has. This enum is initialized during platform init, and
passed in the platform data to omapdss driver.

Note that the versions are not "continuous", that is, you cannot check
if the version is less or greater than something, but you need to check
for exact version match. In other words, this is invalid:

/* test if DSS is 3630 or earlier */
if (ver <= OMAPDSS_VER_OMAP3630)
	...

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 arch/arm/mach-omap2/display.c |   38 ++++++++++++++++++++++++++++++++++++++
 include/video/omapdss.h       |   14 ++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index ee40739..33555da 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -284,6 +284,35 @@ err:
 	return ERR_PTR(r);
 }
 
+static enum omapdss_version omap_display_get_version(void)
+{
+	if (cpu_is_omap24xx())
+		return OMAPDSS_VER_OMAP24xx;
+	else if (cpu_is_omap3630())
+		return OMAPDSS_VER_OMAP3630;
+	else if (cpu_is_omap34xx()) {
+		if (soc_is_am35xx()) {
+			return OMAPDSS_VER_AM35xx;
+		} else {
+			if (omap_rev() < OMAP3430_REV_ES3_0)
+				return OMAPDSS_VER_OMAP34xx_ES1;
+			else
+				return OMAPDSS_VER_OMAP34xx_ES3;
+		}
+	} else if (omap_rev() = OMAP4430_REV_ES1_0)
+		return OMAPDSS_VER_OMAP4430_ES1;
+	else if (omap_rev() = OMAP4430_REV_ES2_0 ||
+			omap_rev() = OMAP4430_REV_ES2_1 ||
+			omap_rev() = OMAP4430_REV_ES2_2)
+		return OMAPDSS_VER_OMAP4430_ES2;
+	else if (cpu_is_omap44xx())
+		return OMAPDSS_VER_OMAP4;
+	else if (soc_is_omap54xx())
+		return OMAPDSS_VER_OMAP5;
+	else
+		return OMAPDSS_VER_UNKNOWN
+}
+
 int __init omap_display_init(struct omap_dss_board_info *board_data)
 {
 	int r = 0;
@@ -291,9 +320,18 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
 	int i, oh_count;
 	const struct omap_dss_hwmod_data *curr_dss_hwmod;
 	struct platform_device *dss_pdev;
+	enum omapdss_version ver;
 
 	/* create omapdss device */
 
+	ver = omap_display_get_version();
+
+	if (ver = OMAPDSS_VER_UNKNOWN) {
+		pr_err("DSS not supported on this SoC\n");
+		return -ENODEV;
+	}
+
+	board_data->version = ver;
 	board_data->dsi_enable_pads = omap_dsi_enable_pads;
 	board_data->dsi_disable_pads = omap_dsi_disable_pads;
 	board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 3729173..88c8294 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -314,6 +314,19 @@ int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel);
 int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel);
 void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel);
 
+enum omapdss_version {
+	OMAPDSS_VER_UNKNOWN = 0,
+	OMAPDSS_VER_OMAP24xx,
+	OMAPDSS_VER_OMAP34xx_ES1,	/* OMAP3430 ES1.0, 2.0 */
+	OMAPDSS_VER_OMAP34xx_ES3,	/* OMAP3430 ES3.0+ */
+	OMAPDSS_VER_OMAP3630,
+	OMAPDSS_VER_AM35xx,
+	OMAPDSS_VER_OMAP4430_ES1,	/* OMAP4430 ES1.0 */
+	OMAPDSS_VER_OMAP4430_ES2,	/* OMAP4430 ES2.0, 2.1, 2.2 */
+	OMAPDSS_VER_OMAP4,		/* All other OMAP4s */
+	OMAPDSS_VER_OMAP5,
+};
+
 /* Board specific data */
 struct omap_dss_board_info {
 	int (*get_context_loss_count)(struct device *dev);
@@ -323,6 +336,7 @@ struct omap_dss_board_info {
 	int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask);
 	void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask);
 	int (*set_min_bus_tput)(struct device *dev, unsigned long r);
+	enum omapdss_version version;
 };
 
 /* Init with the board info */
-- 
1.7.9.5


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox