Solve the problem that "init_mutex" cannot be compiled because the wireless NIC driver is installed in Ubuntu.

Source: Internet
Author: User
Solve the problem that "init_mutex" cannot be compiled because the wireless NIC driver is installed in Ubuntu. When I bought a wireless network card, I specifically found a network card with drivers for both windows, linux, and mac platforms. However, when the wireless network card is installed in Ubuntu11.04, the code of the driver module cannot be compiled. The cause is located at init_mutex. Error: implicitdeclarationoffunction 'init _ M

SolutionUbuntuInstall wireless NIC Driver"Init_mutex"The problem that compilation cannot be abolished. 

When I bought a wireless network card, I foundWin,LinuxAndMacThe NIC Driver of the three platforms. HoweverUbuntu11.04When installing the wireless network card, the driver module code is not compiled. Cause foundInit_mutex.

Error: implicit declaration of function 'init _ MUTEX'

Later, I checked thatLinuxIn the kernel,Init_mutexIt has been abolished.

Check the definition of earlier versions.

Platform: X86 32-bit
Kernel: 2.6.24
Definition
:

Static inline void init_MUTEX (struct semaphore * sem)
{
Sema_init (sem, 1 );
}
 

Description: The Init_MUTEX () function initializes the semaphores as mutex. Mutex is a special case of semaphores. It can prevent data from being read and written by two different systems.

Static inline voidSema_init (StructSemaphore * sem,IntVal)
{
/*
** Sem = (struct semaphore) _ SEMAPHORE_INITIALIZER (* sem), val );
*
* I 'd rather use the more flexible initialization above, but sadly
* GCC 2.7.2.3 emits a bogus warning. EGCS doesn't. Oh well.
*/

Atomic_set (& sem-> count, val );
Sem-> sleepers = 0;
Init_waitqueue_head (& sem-> wait );
}

Sleepers:Specifies the number of processes allowed to enter the waiting for entry into the critical section. The initialization here is0.
Init_waitqueue_head ():Initialize a waiting queue header.

Based on the code, as longInit_mutexDirectly useSema_initTo replace. I tried some of them and it was successful.Make. The driver can also be installed normally.

The code is probably like this.Init_MUTEX (& wl-> sem ); Manually modify Sema_init (& wl-> sem, 1 ); Then you can compile it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.