summaryrefslogtreecommitdiffstats
path: root/drivers/misc/ibmasm/ibmasm.h
diff options
context:
space:
mode:
authorMax Asbock <masbock@us.ibm.com>2005-06-21 17:16:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 19:07:35 -0700
commit8818760512424f60ad9fafb7a087b007a9274eb3 (patch)
treefb49ce398750f42803d4631a24e4a2ffe35d79d7 /drivers/misc/ibmasm/ibmasm.h
parent278d72ae8803ffcd16070c95fe1d53f4466dc741 (diff)
[PATCH] ibmasm driver: fix race in command refcount logic
This patch fixes a race in the command reference counting logic by putting spinlocks around kobject_put() in the command_put function. - Also added debug messages. - Changed a memcpy to memcpy_fromio since we are reading from io space. Signed-off-by: Max Asbock <masbock@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/misc/ibmasm/ibmasm.h')
-rw-r--r--drivers/misc/ibmasm/ibmasm.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h
index 653a7d096a8..ecce4ffd3e2 100644
--- a/drivers/misc/ibmasm/ibmasm.h
+++ b/drivers/misc/ibmasm/ibmasm.h
@@ -95,12 +95,17 @@ struct command {
size_t buffer_size;
int status;
struct kobject kobj;
+ spinlock_t *lock;
};
#define to_command(c) container_of(c, struct command, kobj)
static inline void command_put(struct command *cmd)
{
+ unsigned long flags;
+
+ spin_lock_irqsave(cmd->lock, flags);
kobject_put(&cmd->kobj);
+ spin_unlock_irqrestore(cmd->lock, flags);
}
static inline void command_get(struct command *cmd)
@@ -159,7 +164,7 @@ struct service_processor {
};
/* command processing */
-extern struct command *ibmasm_new_command(size_t buffer_size);
+extern struct command *ibmasm_new_command(struct service_processor *sp, size_t buffer_size);
extern void ibmasm_exec_command(struct service_processor *sp, struct command *cmd);
extern void ibmasm_wait_for_response(struct command *cmd, int timeout);
extern void ibmasm_receive_command_response(struct service_processor *sp, void *response, size_t size);