error: implicit declaration of function ‘acquire_console_sem’錯誤解決方案

來源:互聯網
上載者:User

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);

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.