RE: [PATCH 4/5 V2] PCI: only return true when dev io state is really changed

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

 



😊  definitely simpler !

-----Original Message-----
From: Joe Perches <joe@xxxxxxxxxxx> 
Sent: Sunday, September 27, 2020 12:17 PM
To: Zhao, Haifeng <haifeng.zhao@xxxxxxxxx>; bhelgaas@xxxxxxxxxx; oohall@xxxxxxxxx; ruscur@xxxxxxxxxx; lukas@xxxxxxxxx; andriy.shevchenko@xxxxxxxxxxxxxxx; stuart.w.hayes@xxxxxxxxx; mr.nuke.me@xxxxxxxxx; mika.westerberg@xxxxxxxxxxxxxxx
Cc: linux-pci@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Jia, Pei P <pei.p.jia@xxxxxxxxx>; ashok.raj@xxxxxxxxxxxxxxx; Kuppuswamy, Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxx>
Subject: Re: [PATCH 4/5 V2] PCI: only return true when dev io state is really changed

On Sat, 2020-09-26 at 23:28 -0400, Ethan Zhao wrote:
> simplify the pci_dev_set_io_state() function to only return true when 
> dev->error_state is changed.
[]
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
[]
> @@ -362,35 +362,11 @@ static inline bool pci_dev_set_io_state(struct pci_dev *dev,
>  	bool changed = false;
[]
> +	if (dev->error_state == new)
> +		return changed;
> +
> +	dev->error_state = new;
> +	changed = true;
>  	return changed;
>  }

This would be simpler removing the unnecessary changed automatic

...

	if (dev->error_state == new)
		return false;

	dev->error_state = new;

	return true;
}






[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