On Tue, Oct 26, 2021 at 04:42:28PM -0600, Alex Williamson wrote: > > + /* Saving switches on and not running */ > > + if ((flipped_bits & > > + (VFIO_DEVICE_STATE_RUNNING | VFIO_DEVICE_STATE_SAVING)) && > > + ((state & (VFIO_DEVICE_STATE_RUNNING | > > + VFIO_DEVICE_STATE_SAVING)) == VFIO_DEVICE_STATE_SAVING)) { > > Can't this be reduced to: > > if ((flipped_bits & ~VFIO_DEVICE_STATE_RESUMING) && > (state == VFIO_DEVICE_STATE_SAVING)) { > > Maybe there's an argument for the original to be more invariant of TBD > device_state bits? I definitely prefer to see it explicit for this reason. The shorter version relies on too much implicit stuff - eg that SAVING|RESUMING is rejected at the top and seeing RESUMING as part of a stanza that is only about SAVING|RUNNING is less reasable. Jason