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