1. Change the Linux version number in Android in the version. c file in the init folder!
2. the SPI clock is changed when the SPI reception is not ideal!
3. Single-CPU kernel and lock
On a single CPU machine, the spin lock does not exist for kernels that neither enable config_smp nor config_preempt during compilation. This is an outstanding design strategy
: Since no one else can execute the lock at the same time, there is no reason to lock it.
If both config_smp and config_preempt are enabled during compilation, the spin lock only disables preemption, which is enough to prevent any competing states. In most cases,
We can equate preemptible with SMP to consider the possible competition issues, so we don't have to deal with it separately.
When the lock is testedCodeEven if you do not have an SMP test environment, you should always turn on the config_smp and config_preempt options, because this will reproduce some types of bugs about the lock.
Semaphores still exist because they are introduced to synchronize user context. We will immediately see this.
4. BUG: Scheduling while atomic
If the spin lock contains a sleep function, the above error may occur.
There are three solutions: 1. Disable the preemption feature of the kernel.
2. Move the sleep function after the spin_unlock_irq (& SPI-> lock)
3. Use semaphores instead