lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZegrMMTehDk2e4A8@wunner.de>
Date: Wed, 6 Mar 2024 09:37:04 +0100
From: Lukas Wunner <lukas@...ner.de>
To: Alexey Kardashevskiy <aik@....com>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Dan Williams <dan.j.williams@...el.com>,
	Jonathan Cameron <Jonathan.Cameron@...wei.com>,
	Ira Weiny <ira.weiny@...el.com>
Subject: Re: [PATCH kernel v2] pci/doe: Support discovery version

On Tue, Mar 05, 2024 at 05:02:27PM +1100, Alexey Kardashevskiy wrote:
> On 28/2/24 07:41, Lukas Wunner wrote:
> > > +	u32 disver = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_DISCOVER_VER,
> > > +				(capver >= 2) ? 2 : 0);
> > >   	u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX,
> > > -				    *index);
> > > +				    *index) | disver;
> > 
> > Hm, why use a separate "disver" variable?  This could be combined
> > into a single statement.
> 
> Less ugly since we want to keep it 80 chars long

I don't quite follow, this stays exactly within 80 chars:

	u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX,
-				    *index);
+				    *index) |
+			 FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_DISCOVER_VER,
+				    (capver >= 2) ? 2 : 0);

And if you replace DISCOVER_VER with VERSION as I've suggested,
it becomes even shorter:

	u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX,
-				    *index);
+				    *index) |
+			 FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_VERSION,
+				    (capver >= 2) ? 2 : 0);

Thanks,

Lukas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ