}
static int
-controlvm_respond(struct controlvm_message_header *msg_hdr, int response)
+controlvm_respond(struct controlvm_message_header *msg_hdr, int response,
+ struct spar_segment_state *state)
{
struct controlvm_message outmsg;
if (outmsg.hdr.flags.test_message == 1)
return -EINVAL;
- return visorchannel_signalinsert(chipset_dev->controlvm_channel,
- CONTROLVM_QUEUE_REQUEST, &outmsg);
-}
-
-static int controlvm_respond_physdev_changestate(
- struct controlvm_message_header *msg_hdr, int response,
- struct spar_segment_state state)
-{
- struct controlvm_message outmsg;
+ if (state) {
+ outmsg.cmd.device_change_state.state = *state;
+ outmsg.cmd.device_change_state.flags.phys_device = 1;
+ }
- controlvm_init_response(&outmsg, msg_hdr, response);
- outmsg.cmd.device_change_state.state = state;
- outmsg.cmd.device_change_state.flags.phys_device = 1;
return visorchannel_signalinsert(chipset_dev->controlvm_channel,
CONTROLVM_QUEUE_REQUEST, &outmsg);
}
if (pending_msg_hdr->id != (u32)cmd_id)
return -EINVAL;
- return controlvm_respond(pending_msg_hdr, response);
+ return controlvm_respond(pending_msg_hdr, response, NULL);
}
static int
spin_unlock(¶hotplug_request_list_lock);
req->msg.cmd.device_change_state.state.active = active;
if (req->msg.hdr.flags.response_expected)
- controlvm_respond_physdev_changestate(
- &req->msg.hdr, CONTROLVM_RESP_SUCCESS,
- req->msg.cmd.device_change_state.state);
+ controlvm_respond(
+ &req->msg.hdr, CONTROLVM_RESP_SUCCESS,
+ &req->msg.cmd.device_change_state.state);
parahotplug_request_destroy(req);
return 0;
}
err = parahotplug_request_kickoff(req);
if (err)
goto err_respond;
- controlvm_respond_physdev_changestate
- (&inmsg->hdr,
- CONTROLVM_RESP_SUCCESS,
- inmsg->cmd.device_change_state.state);
+ controlvm_respond(&inmsg->hdr, CONTROLVM_RESP_SUCCESS,
+ &inmsg->cmd.device_change_state.state);
parahotplug_request_destroy(req);
return 0;
}
return 0;
err_respond:
- controlvm_respond_physdev_changestate
- (&inmsg->hdr, err,
- inmsg->cmd.device_change_state.state);
+ controlvm_respond(&inmsg->hdr, err,
+ &inmsg->cmd.device_change_state.state);
return err;
}
KOBJ_ONLINE);
if (msg_hdr->flags.response_expected)
- controlvm_respond(msg_hdr, res);
+ controlvm_respond(msg_hdr, res, NULL);
return res;
}
KOBJ_CHANGE, envp);
if (msg_hdr->flags.response_expected)
- controlvm_respond(msg_hdr, res);
+ controlvm_respond(msg_hdr, res, NULL);
return res;
}
res = kobject_uevent(&chipset_dev->acpi_device->dev.kobj,
KOBJ_OFFLINE);
if (msg_hdr->flags.response_expected)
- controlvm_respond(msg_hdr, res);
+ controlvm_respond(msg_hdr, res, NULL);
return res;
}
case CONTROLVM_DEVICE_CONFIGURE:
/* no op just send a respond that we passed */
if (inmsg.hdr.flags.response_expected)
- controlvm_respond(&inmsg.hdr, CONTROLVM_RESP_SUCCESS);
+ controlvm_respond(&inmsg.hdr, CONTROLVM_RESP_SUCCESS,
+ NULL);
break;
case CONTROLVM_CHIPSET_READY:
err = chipset_ready_uevent(&inmsg.hdr);
err = -ENOMSG;
if (inmsg.hdr.flags.response_expected)
controlvm_respond(&inmsg.hdr,
- -CONTROLVM_RESP_ID_UNKNOWN);
+ -CONTROLVM_RESP_ID_UNKNOWN, NULL);
break;
}
list_del(pos);
if (req->msg.hdr.flags.response_expected)
- controlvm_respond_physdev_changestate(
+ controlvm_respond(
&req->msg.hdr,
CONTROLVM_RESP_DEVICE_UDEV_TIMEOUT,
- req->msg.cmd.device_change_state.state);
+ &req->msg.cmd.device_change_state.state);
parahotplug_request_destroy(req);
}