Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 27104
b: refs/heads/master
c: 78b86e5
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Linus Torvalds committed Jun 5, 2006
1 parent 7e9d15e commit a547665
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d09bb627d2470299dfb1af0e6d27fb4aece9196
refs/heads/master: 78b86e579f11e7d7bd45acd90b6a87cd4b7c5a54
18 changes: 11 additions & 7 deletions trunk/arch/powerpc/platforms/powermac/pfunc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/spinlock.h>
#include <linux/module.h>
#include <linux/mutex.h>

#include <asm/semaphore.h>
#include <asm/prom.h>
Expand Down Expand Up @@ -546,6 +547,7 @@ struct pmf_device {

static LIST_HEAD(pmf_devices);
static spinlock_t pmf_lock = SPIN_LOCK_UNLOCKED;
static DEFINE_MUTEX(pmf_irq_mutex);

static void pmf_release_device(struct kref *kref)
{
Expand Down Expand Up @@ -864,15 +866,17 @@ int pmf_register_irq_client(struct device_node *target,

spin_lock_irqsave(&pmf_lock, flags);
func = __pmf_find_function(target, name, PMF_FLAGS_INT_GEN);
if (func == NULL) {
spin_unlock_irqrestore(&pmf_lock, flags);
if (func)
func = pmf_get_function(func);
spin_unlock_irqrestore(&pmf_lock, flags);
if (func == NULL)
return -ENODEV;
}
mutex_lock(&pmf_irq_mutex);
if (list_empty(&func->irq_clients))
func->dev->handlers->irq_enable(func);
list_add(&client->link, &func->irq_clients);
client->func = func;
spin_unlock_irqrestore(&pmf_lock, flags);
mutex_unlock(&pmf_irq_mutex);

return 0;
}
Expand All @@ -881,16 +885,16 @@ EXPORT_SYMBOL_GPL(pmf_register_irq_client);
void pmf_unregister_irq_client(struct pmf_irq_client *client)
{
struct pmf_function *func = client->func;
unsigned long flags;

BUG_ON(func == NULL);

spin_lock_irqsave(&pmf_lock, flags);
mutex_lock(&pmf_irq_mutex);
client->func = NULL;
list_del(&client->link);
if (list_empty(&func->irq_clients))
func->dev->handlers->irq_disable(func);
spin_unlock_irqrestore(&pmf_lock, flags);
mutex_unlock(&pmf_irq_mutex);
pmf_put_function(func);
}
EXPORT_SYMBOL_GPL(pmf_unregister_irq_client);

Expand Down

0 comments on commit a547665

Please sign in to comment.