As I was trying to turn the main macros (spin_lock, spin_lock_irq and the others) from <spinlock.h> I have uncovered the fact that <sof/spinlock.h> includes <sof/drivers/interrupt.h> and <sof/drivers/interrupt.h> includes <sof/spinlock.h>, which means that for every C file that includes either of them one of the two will not see the declarations of the other.
Is this circular dependency actually real?
Right now I have issues with interrupt_global_disable - it does an implicit declaration in <spinlock.h> due to <interrupt.h> being included first (or only) within some C files.
If I try to include <arch/spinlock.h> from <sof/interrupt.h> I only get the error for "this file shouldn't be included from outside of sof/spinlock.h", but if I try to hack it to believe it's from there I get no further errors.
I will submit a pull request displaying that soon (hopefully today) but I need feedback on whether this is the best approach. I mean the cyclic dependency is real because <sof/interrupt.h> needs to use spinlock_t but <sof/spinlock.h> requires several things from <sof/interrupt.h> so I believe it needs to be fixed even if the macros from <sof/spinlock.h> are left as macros.