aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/ibmasm/ibmasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/ibmasm/ibmasm.h')
-rw-r--r--drivers/misc/ibmasm/ibmasm.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/misc/ibmasm/ibmasm.h b/drivers/misc/ibmasm/ibmasm.h
index de860bc6d3f5..4d8a4e248b34 100644
--- a/drivers/misc/ibmasm/ibmasm.h
+++ b/drivers/misc/ibmasm/ibmasm.h
@@ -31,6 +31,7 @@
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/kref.h>
34#include <linux/device.h> 35#include <linux/device.h>
35#include <linux/input.h> 36#include <linux/input.h>
36 37
@@ -92,24 +93,25 @@ struct command {
92 unsigned char *buffer; 93 unsigned char *buffer;
93 size_t buffer_size; 94 size_t buffer_size;
94 int status; 95 int status;
95 struct kobject kobj; 96 struct kref kref;
96 spinlock_t *lock; 97 spinlock_t *lock;
97}; 98};
98#define to_command(c) container_of(c, struct command, kobj) 99#define to_command(c) container_of(c, struct command, kref)
99 100
101void ibmasm_free_command(struct kref *kref);
100static inline void command_put(struct command *cmd) 102static inline void command_put(struct command *cmd)
101{ 103{
102 unsigned long flags; 104 unsigned long flags;
103 spinlock_t *lock = cmd->lock; 105 spinlock_t *lock = cmd->lock;
104 106
105 spin_lock_irqsave(lock, flags); 107 spin_lock_irqsave(lock, flags);
106 kobject_put(&cmd->kobj); 108 kref_put(&cmd->kref, ibmasm_free_command);
107 spin_unlock_irqrestore(lock, flags); 109 spin_unlock_irqrestore(lock, flags);
108} 110}
109 111
110static inline void command_get(struct command *cmd) 112static inline void command_get(struct command *cmd)
111{ 113{
112 kobject_get(&cmd->kobj); 114 kref_get(&cmd->kref);
113} 115}
114 116
115 117