Lines Matching refs:cmd
36 struct command *cmd;
41 cmd = kzalloc(sizeof(struct command), GFP_KERNEL);
42 if (cmd == NULL)
46 cmd->buffer = kzalloc(buffer_size, GFP_KERNEL);
47 if (cmd->buffer == NULL) {
48 kfree(cmd);
51 cmd->buffer_size = buffer_size;
53 kref_init(&cmd->kref);
54 cmd->lock = &sp->lock;
56 cmd->status = IBMASM_CMD_PENDING;
57 init_waitqueue_head(&cmd->wait);
58 INIT_LIST_HEAD(&cmd->queue_node);
63 return cmd;
68 struct command *cmd = to_command(kref);
70 list_del(&cmd->queue_node);
73 kfree(cmd->buffer);
74 kfree(cmd);
77 static void enqueue_command(struct service_processor *sp, struct command *cmd)
79 list_add_tail(&cmd->queue_node, &sp->command_queue);
84 struct command *cmd;
92 cmd = list_entry(next, struct command, queue_node);
94 return cmd;
119 void ibmasm_exec_command(struct service_processor *sp, struct command *cmd)
129 sp->current_command = cmd;
134 enqueue_command(sp, cmd);
162 void ibmasm_wait_for_response(struct command *cmd, int timeout)
164 wait_event_interruptible_timeout(cmd->wait,
165 cmd->status == IBMASM_CMD_COMPLETE ||
166 cmd->status == IBMASM_CMD_FAILED,
177 struct command *cmd = sp->current_command;
182 memcpy_fromio(cmd->buffer, response, min(size, cmd->buffer_size));
183 cmd->status = IBMASM_CMD_COMPLETE;