btashton commented on pull request #979: URL: https://github.com/apache/incubator-nuttx/pull/979#issuecomment-625323858
> I am quite uncertain that `pci_cfg_read` should directly return the value or not. > Need suggestions. > > Yes, it more convenient to use and the semantics are much better if we driectly return the content. > However, I get quite paranoid about the fact that someone might give an invalid size to read. > > Of course, we can make 4 functions: read8, read16, read32 and read64, but the code will bloat. > > For what it is worth freebsd uses basically the same prototype. ``` uint32_t pcie_read_config(device_t dev, int reg, int width); ``` I think if we put a debug assert in we should be fine since the code is broken either way. I don't see a case where the read or write length should be dynamic. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org