Subrata Banik has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/30209 )
Change subject: soc/intel/common/block/lpc: create LPC_GET_DEV macro ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/30209/2/src/soc/intel/common/block/... File src/soc/intel/common/block/lpc/lpc_lib.c:
https://review.coreboot.org/c/coreboot/+/30209/2/src/soc/intel/common/block/... PS2, Line 29: #if !defined(__SIMPLE_DEVICE__) : #include <device/device.h> : #define LPC_GET_DEV pcidev_on_root(PCH_DEV_SLOT_LPC, 0x0) : #else : #define LPC_GET_DEV PCH_DEV_LPC : #endif
Compiles fine as by Aamir's suggestion, btw.
yes compilation will work as long as #define __SIMPLE_DEVICE__ is there.
No, I meant this patch but with PCH_DEV_LPC from soc/pci_devs.h instead of your new macro works fine.
Do you mean PCH_DEV_LPC from soc/pci_devs.h will work without having #define __SIMPLE_DEVICE__ at line 18?
But i don't know why we have this guard at first place and want to compile this entire file as part of simple device. is that saving anything ? general query.
It provides a stable API even if the file is compiled for ramstage and pre-ram stages.
Intention is not to break the stability here for sure, just wondering if you have real reason why #define __SIMPLE_DEVICE__ been added at first place ?
Hence, avoids the need for any #if in platform code.
FYI, this is soc code not the platform code. hatch, poppy are the platform code in my understanding. this is soc library. i was adhering old review comments from Arthur who has suggested to have a macro rather function names.
because you can't use them anymore to get a `struct device *`. That's why there are some explicit calls to pcidev_on_root() below.
yes, that's the point. this could have been avoided but it has some other assumptions :) about "struct device *"