Re: [PATCH V4 mlx5-next 11/13] vfio/mlx5: Implement vfio_pci driver for mlx5 devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux