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