error: implicit declaration of function 'acquire_console_sem'错误解决方法

ubuntu12.10下编译Android4.0内核源代码


1.问题:

kernel/power/consoleearlysuspend.c:28:2: error: implicit declaration of function 'acquire_console_sem'


2.解决方法:

修改源代码根目录下kernel/power/consoleearlysuspend.c文件,将acquire_console_sem()与release_console_sem()函数分别换为console_lock()与console_unlock()函数


3.分析:

函数acquire_console_sem()与release_console_sem()用来获得和释放互斥锁console_sem;新内核下这两个函数变成console_lock()与console_unlock(),故替换之便OK.


4.附:console_lock()与console_unlock()函数位置:内核源代码根目录下kernel/printk.c文件1222行


/**
 * console_lock - lock the console system for exclusive use.
 *
 * Acquires a lock which guarantees that the caller has
 * exclusive access to the console system and the console_drivers list.
 *
 * Can sleep, returns nothing.
 */
void console_lock(void)
{
        BUG_ON(in_interrupt());
        down(&console_sem);
        if (console_suspended)
                return;
        console_locked = 1;
        console_may_schedule = 1;
}
EXPORT_SYMBOL(console_lock);


/**
 * console_unlock - unlock the console system
 *
 * Releases the console_lock which the caller holds on the console system
 * and the console driver list.
 *
 * While the console_lock was held, console output may have been buffered
 * by printk().  If this is the case, console_unlock(); emits
 * the output prior to releasing the lock.
 *
 * If there is output waiting for klogd, we wake it up.
 *
 * console_unlock(); may be called from any context.
 */
void console_unlock(void)
{
        unsigned long flags;
        unsigned _con_start, _log_end;
        unsigned wake_klogd = 0;

        if (console_suspended) {
                up(&console_sem);
                return;
        }

        console_may_schedule = 0;

        for ( ; ; ) {
                spin_lock_irqsave(&logbuf_lock, flags);
                wake_klogd |= log_start - log_end;
                if (con_start == log_end)
                        break;                  /* Nothing to print */
                _con_start = con_start;
                _log_end = log_end;
                con_start = log_end;            /* Flush */
                spin_unlock(&logbuf_lock);
                stop_critical_timings();        /* don't trace print latency */
                call_console_drivers(_con_start, _log_end);
                start_critical_timings();
                local_irq_restore(flags);
        }
        console_locked = 0;

        /* Release the exclusive_console once it is used */
        if (unlikely(exclusive_console))
                exclusive_console = NULL;

        up(&console_sem);
        spin_unlock_irqrestore(&logbuf_lock, flags);
        if (wake_klogd)
                wake_up_klogd();
}
EXPORT_SYMBOL(console_unlock);





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值