Re: [PATCH 4/6] s390x: Add I/O adapter registration.

Christian Borntraeger
2014-02-26T08:29:12Z

On 25/02/14 18:25, Cornelia Huck wrote:

> +int kvm_s390_io_adapter_map(uint32_t id, uint64_t map_addr, bool do_map)
> +{
> + struct kvm_s390_io_adapter_req req = {
> + .id = id,
> + .type = do_map ? KVM_S390_IO_ADAPTER_MAP : KVM_S390_IO_ADAPTER_UNMAP,
> + .addr = map_addr,
> + };
> + KVMS390FLICState *flic = s390_get_flic();
> + struct kvm_device_attr attr;

Can we use designated initializer for attr, e.g.
struct kvm_device_attr attr = {
.group = KVM_DEV_FLIC_ADAPTER_MODIFY,
.addr = (uint64_t)&req,
}

> + int r;
> +
> + if (!flic) {
> + return -ENOSYS;
> + }
> + if (!kvm_check_extension(kvm_state, KVM_CAP_IRQ_ROUTING)) {
> + return -ENOSYS;
> + }
> +
> + attr.group = KVM_DEV_FLIC_ADAPTER_MODIFY;
> + attr.addr = (uint64_t)&req;

and not do it here. That will zero out the other fields of attr.

Same for the register code.

Christian