[Qemu-devel] [PATCH v3 1/3] vfio/display: add edid support.

Gerd Hoffmann kraxel at redhat.com
Mon Mar 11 06:28:00 UTC 2019


  Hi,

> Liam and I both found some difficulty with the cleverness of the
> macros, so for the sake of better maintainability, I'd like to propose
> rolling in the following patch, including Liam's trace format fix.  It's
> not as compact as your version, but I think it's equivalent, it's easier
> to follow, and doesn't covertly introduce a non-curly braced block ;)
> If you agree, I'll roll this into your v3. Thanks,

>  #define pwrite_field(_fd, _reg, _ptr, _fld)                             \
> -    if (sizeof(_ptr->_fld) !=                                           \
> -        pwrite(_fd, &(_ptr->_fld), sizeof(_ptr->_fld),                  \
> -               _reg->offset + offsetof(typeof(*_ptr), _fld)))           \
> -        goto err;
> +    (sizeof(_ptr->_fld) !=                                              \
> +     pwrite(_fd, &(_ptr->_fld), sizeof(_ptr->_fld),                     \
> +            _reg->offset + offsetof(typeof(*_ptr), _fld)))

>      dpy->edid_regs->link_state = VFIO_DEVICE_GFX_LINK_STATE_DOWN;
> -    pwrite_field(fd, dpy->edid_info, dpy->edid_regs, link_state);
> +    if (pwrite_field(fd, dpy->edid_info, dpy->edid_regs, link_state)) {
> +        goto err;
> +    }

Fine with me.

thanks,
  Gerd



More information about the intel-gvt-dev mailing list