本文整理汇总了C++中release_console_sem函数的典型用法代码示例。如果您正苦于以下问题:C++ release_console_sem函数的具体用法?C++ release_console_sem怎么用?C++ release_console_sem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了release_console_sem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pm_prepare_console
int pm_prepare_console(void)
{
orig_loglevel = console_loglevel;
console_loglevel = new_loglevel;
#ifdef SUSPEND_CONSOLE
acquire_console_sem();
orig_fgconsole = fg_console;
if (vc_allocate(SUSPEND_CONSOLE)) {
/* we can't have a free VC for now. Too bad,
* we don't want to mess the screen for now. */
release_console_sem();
return 1;
}
set_console(SUSPEND_CONSOLE);
release_console_sem();
if (vt_waitactive(SUSPEND_CONSOLE)) {
pr_debug("Suspend: Can't switch VCs.");
return 1;
}
orig_kmsg = kmsg_redirect;
kmsg_redirect = SUSPEND_CONSOLE;
#endif
return 0;
}
示例2: pm_restore_console
void pm_restore_console(void)
{
acquire_console_sem();
if (disable_vt_switch) {
release_console_sem();
return;
}
set_console(orig_fgconsole);
release_console_sem();
kmsg_redirect = orig_kmsg;
}
示例3: edid_work_fn
/* Hotplug interrupt occurred, read EDID */
static void edid_work_fn(struct work_struct *work)
{
struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work);
struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
pr_debug("%s(%p): begin, hotplug status %d\n", __func__,
pdata->lcd_dev, hdmi->hp_state);
if (!pdata->lcd_dev)
return;
if (hdmi->hp_state == HDMI_HOTPLUG_EDID_DONE) {
pm_runtime_get_sync(hdmi->dev);
/* A device has been plugged in */
sh_hdmi_read_edid(hdmi);
msleep(10);
sh_hdmi_configure(hdmi);
/* Switched to another (d) power-save mode */
msleep(10);
if (!hdmi->info)
return;
acquire_console_sem();
/* HDMI plug in */
hdmi->info->var = hdmi->var;
if (hdmi->info->state != FBINFO_STATE_RUNNING)
fb_set_suspend(hdmi->info, 0);
else
hdmi_display_on(hdmi, hdmi->info);
release_console_sem();
} else {
if (!hdmi->info)
return;
acquire_console_sem();
/* HDMI disconnect */
fb_set_suspend(hdmi->info, 1);
release_console_sem();
pm_runtime_put(hdmi->dev);
}
pr_debug("%s(%p): end\n", __func__, pdata->lcd_dev);
}
示例4: unregister_console
int unregister_console(struct console *console)
{
struct console *a, *b;
int res = 1;
acquire_console_sem();
if (console_drivers == console) {
console_drivers=console->next;
res = 0;
} else if (console_drivers) {
for (a=console_drivers->next, b=console_drivers ;
a; b=a, a=b->next) {
if (a == console) {
b->next = a->next;
res = 0;
break;
}
}
}
/* If last console is removed, we re-enable picking the first
* one that gets registered. Without that, pmac early boot console
* would prevent fbcon from taking over.
*
* If this isn't the last console and it has CON_CONSDEV set, we
* need to set it on the next preferred console.
*/
if (console_drivers == NULL)
preferred_console = selected_console;
else if (console->flags & CON_CONSDEV)
console_drivers->flags |= CON_CONSDEV;
release_console_sem();
return res;
}
示例5: printk
/*
* This is printk. It can be called from any context. We want it to work.
*
* We try to grab the console_sem. If we succeed, it's easy - we log the output and
* call the console drivers. If we fail to get the semaphore we place the output
* into the log buffer and return. The current holder of the console_sem will
* notice the new output in release_console_sem() and will send it to the
* consoles before releasing the semaphore.
*
* One effect of this deferred printing is that code which calls printk() and
* then changes console_loglevel may break. This is because console_loglevel
* is inspected when the actual printing occurs.
*/
asmlinkage int printk(const char *fmt, ...)
{
va_list args;
unsigned long flags;
int printed_len;
char *p;
static char printk_buf[1024];
static int log_level_unknown = 1;
if (oops_in_progress) {
/* If a crash is occurring, make sure we can't deadlock */
spin_lock_init(&logbuf_lock);
/* And make sure that we print immediately */
init_MUTEX(&console_sem);
}
/* This stops the holder of console_sem just where we want him */
spin_lock_irqsave(&logbuf_lock, flags);
/* Emit the output into the temporary buffer */
va_start(args, fmt);
printed_len = vsnprintf(printk_buf, sizeof(printk_buf), fmt, args);
va_end(args);
/*
* Copy the output into log_buf. If the caller didn't provide
* appropriate log level tags, we insert them here
*/
for (p = printk_buf; *p; p++) {
if (log_level_unknown) {
if (p[0] != '<' || p[1] < '0' || p[1] > '7' || p[2] != '>') {
emit_log_char('<');
emit_log_char(default_message_loglevel + '0');
emit_log_char('>');
}
log_level_unknown = 0;
}
emit_log_char(*p);
if (*p == '\n')
log_level_unknown = 1;
}
if (!down_trylock(&console_sem)) {
/*
* We own the drivers. We can drop the spinlock and let
* release_console_sem() print the text
*/
spin_unlock_irqrestore(&logbuf_lock, flags);
console_may_schedule = 0;
release_console_sem();
} else {
/*
* Someone else owns the drivers. We drop the spinlock, which
* allows the semaphore holder to proceed and to call the
* console drivers with the output which we just produced.
*/
spin_unlock_irqrestore(&logbuf_lock, flags);
}
return printed_len;
}
示例6: OMAPLFBDeInitFBDev
static void OMAPLFBDeInitFBDev(OMAPLFB_DEVINFO *psDevInfo)
{
struct fb_info *psLINFBInfo = psDevInfo->psLINFBInfo;
struct module *psLINFBOwner;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
console_lock();
#else
acquire_console_sem();
#endif
psLINFBOwner = psLINFBInfo->fbops->owner;
if (psLINFBInfo->fbops->fb_release != NULL)
{
(void) psLINFBInfo->fbops->fb_release(psLINFBInfo, 0);
}
module_put(psLINFBOwner);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
console_unlock();
#else
release_console_sem();
#endif
}
示例7: paste_selection
/* Insert the contents of the selection buffer into the
* queue of the tty associated with the current console.
* Invoked by ioctl().
*/
int paste_selection(struct tty_struct *tty)
{
struct vc_data *vc = (struct vc_data *)tty->driver_data;
int pasted = 0;
unsigned int count;
struct tty_ldisc *ld;
DECLARE_WAITQUEUE(wait, current);
acquire_console_sem();
poke_blanked_console();
release_console_sem();
ld = tty_ldisc_ref_wait(tty);
add_wait_queue(&vc->paste_wait, &wait);
while (sel_buffer && sel_buffer_lth > pasted) {
set_current_state(TASK_INTERRUPTIBLE);
if (test_bit(TTY_THROTTLED, &tty->flags)) {
schedule();
continue;
}
count = sel_buffer_lth - pasted;
count = min(count, tty->receive_room);
tty->ldisc.receive_buf(tty, sel_buffer + pasted, NULL, count);
pasted += count;
}
remove_wait_queue(&vc->paste_wait, &wait);
current->state = TASK_RUNNING;
tty_ldisc_deref(ld);
return 0;
}
示例8: i915_drm_freeze
static int i915_drm_freeze(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
drm_kms_helper_poll_disable(dev);
pci_save_state(dev->pdev);
/* If KMS is active, we do the leavevt stuff here */
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
int error = i915_gem_idle(dev);
if (error) {
dev_err(&dev->pdev->dev,
"GEM idle failed, resume might fail\n");
return error;
}
drm_irq_uninstall(dev);
}
i915_save_state(dev);
intel_opregion_fini(dev);
/* Modeset on resume, not lid events */
dev_priv->modeset_on_lid = 0;
acquire_console_sem();
intel_fbdev_set_suspend(dev, 1);
release_console_sem();
return 0;
}
示例9: unregister_console
int unregister_console(struct console *console)
{
struct console *a, *b;
int res = 1;
#ifdef CONFIG_A11Y_BRAILLE_CONSOLE
if (console->flags & CON_BRL)
return braille_unregister_console(console);
#endif
acquire_console_sem();
if (console_drivers == console) {
console_drivers=console->next;
res = 0;
} else if (console_drivers) {
for (a=console_drivers->next, b=console_drivers ;
a; b=a, a=b->next) {
if (a == console) {
b->next = a->next;
res = 0;
break;
}
}
}
/*
* If this isn't the last console and it has CON_CONSDEV set, we
* need to set it on the next preferred console.
*/
if (console_drivers != NULL && console->flags & CON_CONSDEV)
console_drivers->flags |= CON_CONSDEV;
release_console_sem();
return res;
}
示例10: mxc_elcdif_fb_suspend
static int mxc_elcdif_fb_suspend(struct platform_device *pdev,
pm_message_t state)
{
struct fb_info *fbi = platform_get_drvdata(pdev);
struct mxc_elcdif_fb_data *data = (struct mxc_elcdif_fb_data *)fbi->par;
int saved_blank;
acquire_console_sem();
fb_set_suspend(fbi, 1);
saved_blank = data->cur_blank;
mxc_elcdif_fb_blank(FB_BLANK_POWERDOWN, fbi);
data->next_blank = saved_blank;
if (!g_elcdif_pix_clk_enable) {
clk_enable(g_elcdif_pix_clk);
g_elcdif_pix_clk_enable = true;
}
mxc_elcdif_stop();
mxc_elcdif_dma_release();
if (g_elcdif_pix_clk_enable) {
clk_disable(g_elcdif_pix_clk);
g_elcdif_pix_clk_enable = false;
}
if (g_elcdif_axi_clk_enable) {
clk_disable(g_elcdif_axi_clk);
g_elcdif_axi_clk_enable = false;
}
release_console_sem();
return 0;
}
示例11: unregister_console
int unregister_console(struct console * console)
{
struct console *a,*b;
int res = 1;
acquire_console_sem();
if (console_drivers == console) {
console_drivers=console->next;
res = 0;
} else {
for (a=console_drivers->next, b=console_drivers ;
a; b=a, a=b->next) {
if (a == console) {
b->next = a->next;
res = 0;
break;
}
}
}
/* If last console is removed, we re-enable picking the first
* one that gets registered. Without that, pmac early boot console
* would prevent fbcon from taking over.
*/
if (console_drivers == NULL)
preferred_console = selected_console;
release_console_sem();
return res;
}
示例12: register_backlight_controller
void __pmac register_backlight_controller(struct backlight_controller *ctrler,
void *data, char *type)
{
struct device_node* bk_node;
char *prop;
int valid = 0;
/* There's already a matching controller, bail out */
if (backlighter != NULL)
return;
bk_node = find_devices("backlight");
#ifdef CONFIG_ADB_PMU
/* Special case for the old PowerBook since I can't test on it */
backlight_autosave = machine_is_compatible("AAPL,3400/2400")
|| machine_is_compatible("AAPL,3500");
if ((backlight_autosave
|| machine_is_compatible("AAPL,PowerBook1998")
|| machine_is_compatible("PowerBook1,1"))
&& !strcmp(type, "pmu"))
valid = 1;
#endif
if (bk_node) {
prop = get_property(bk_node, "backlight-control", NULL);
if (prop && !strncmp(prop, type, strlen(type)))
valid = 1;
}
if (!valid)
return;
backlighter = ctrler;
backlighter_data = data;
if (bk_node && !backlight_autosave)
prop = get_property(bk_node, "bklt", NULL);
else
prop = NULL;
if (prop) {
backlight_level = ((*prop)+1) >> 1;
if (backlight_level > BACKLIGHT_MAX)
backlight_level = BACKLIGHT_MAX;
}
#ifdef CONFIG_ADB_PMU
if (backlight_autosave) {
struct adb_request req;
pmu_request(&req, NULL, 2, 0xd9, 0);
while (!req.complete)
pmu_poll();
backlight_level = req.reply[0] >> 4;
}
#endif
acquire_console_sem();
if (!backlighter->set_enable(1, backlight_level, data))
backlight_enabled = 1;
release_console_sem();
printk(KERN_INFO "Registered \"%s\" backlight controller,"
"level: %d/15\n", type, backlight_level);
}
示例13: paste_selection
/* Insert the contents of the selection buffer into the
* queue of the tty associated with the current console.
* Invoked by ioctl().
*/
int paste_selection(struct tty_struct *tty)
{
struct vt_struct *vt = (struct vt_struct *) tty->driver_data;
int pasted = 0, count;
DECLARE_WAITQUEUE(wait, current);
acquire_console_sem();
poke_blanked_console();
release_console_sem();
add_wait_queue(&vt->paste_wait, &wait);
while (sel_buffer && sel_buffer_lth > pasted) {
set_current_state(TASK_INTERRUPTIBLE);
if (test_bit(TTY_THROTTLED, &tty->flags)) {
schedule();
continue;
}
count = sel_buffer_lth - pasted;
count = MIN(count, tty->ldisc.receive_room(tty));
tty->ldisc.receive_buf(tty, sel_buffer + pasted, 0, count);
pasted += count;
}
remove_wait_queue(&vt->paste_wait, &wait);
current->state = TASK_RUNNING;
return 0;
}
示例14: console_early_suspend
static void console_early_suspend(struct early_suspend *h)
{
acquire_console_sem();
orig_fgconsole = fg_console;
if (vc_allocate(EARLY_SUSPEND_CONSOLE))
goto err;
if (set_console(EARLY_SUSPEND_CONSOLE))
goto err;
release_console_sem();
if (vt_waitactive(EARLY_SUSPEND_CONSOLE))
pr_warning("console_early_suspend: Can't switch VCs.\n");
return;
err:
pr_warning("console_early_suspend: Can't set console\n");
release_console_sem();
}
示例15: pm_restore_console
void pm_restore_console(void)
{
acquire_console_sem();
if (disable_vt_switch) {
release_console_sem();
return;
}
set_console(orig_fgconsole);
release_console_sem();
if (vt_waitactive(orig_fgconsole)) {
pr_debug("Resume: Can't switch VCs.");
return;
}
kmsg_redirect = orig_kmsg;
}