* FIXME: LOCKING !!!
*/
+#include <linux/config.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kernel.h>
};
static LIST_HEAD(pmf_devices);
-static DEFINE_SPINLOCK(pmf_lock);
+static spinlock_t pmf_lock = SPIN_LOCK_UNLOCKED;
static DEFINE_MUTEX(pmf_irq_mutex);
static void pmf_release_device(struct kref *kref)
spin_unlock_irqrestore(&pmf_lock, flags);
if (func == NULL)
return -ENODEV;
-
- /* guard against manipulations of list */
mutex_lock(&pmf_irq_mutex);
if (list_empty(&func->irq_clients))
func->dev->handlers->irq_enable(func);
-
- /* guard against pmf_do_irq while changing list */
- spin_lock_irqsave(&pmf_lock, flags);
list_add(&client->link, &func->irq_clients);
- spin_unlock_irqrestore(&pmf_lock, flags);
-
client->func = func;
mutex_unlock(&pmf_irq_mutex);
void pmf_unregister_irq_client(struct pmf_irq_client *client)
{
struct pmf_function *func = client->func;
- unsigned long flags;
BUG_ON(func == NULL);
- /* guard against manipulations of list */
mutex_lock(&pmf_irq_mutex);
client->func = NULL;
-
- /* guard against pmf_do_irq while changing list */
- spin_lock_irqsave(&pmf_lock, flags);
list_del(&client->link);
- spin_unlock_irqrestore(&pmf_lock, flags);
-
if (list_empty(&func->irq_clients))
func->dev->handlers->irq_disable(func);
mutex_unlock(&pmf_irq_mutex);