title: Mark function to be used only under lock
body: <p>I'm writing a linux kernel driver and I have a function which MUST be called under lock, and I want to make sure no one will use it without acquiring the lock.
  This function is called many times from different functions which acquire the lock prior to calling the function.</p>
  
  <p>I'm wondering if there is a way of telling the compiler to verify that all calls to that function are done under a lock?
  something like function attributes or something similar.</p>
  
  <p>thanks.</p>