From: Arnd Bergmann > Sent: 15 July 2020 07:47 > On Wed, Jul 15, 2020 at 1:46 AM Bjorn Helgaas <helg...@kernel.org> wrote: > > So something like: > > > > void pci_read_config_word(struct pci_dev *dev, int where, u16 *val) > > > > and where we used to return anything non-zero, we just set *val = ~0 > > instead? I think we do that already in most, maybe all, cases. > > Right, this is what I had in mind. If we start by removing the handling > of the return code in all files that clearly don't need it, looking at > whatever remains will give a much better idea of what a good interface > should be.
It would be best to get rid of that nasty 'u16 *' parameter. Make the return int and return the read value or -1 on error. (Or maybe 0xffff0000 on error??) For a 32bit read (there must be one for the BARs) returning a 64bit signed integer would work even for 32bit systems. If code cares about the error, and it can be detected then it can check. Otherwise the it all 'just works'. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)