Matt Delco has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42468 )
Change subject: drivers/intel/mipi_camera: SSDT changes to add DSM ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/42468/2/src/drivers/intel/mipi_came... File src/drivers/intel/mipi_camera/camera.c:
https://review.coreboot.org/c/coreboot/+/42468/2/src/drivers/intel/mipi_came... PS2, Line 19: 0xFFFF
@Matt is it ok to return 0 if dev->bus is not valid
It's probably okay. I don't know how easy or hard it is to configure a 'dev' that doesn't have a dev->bus populated, so I'm not sure if it's worth trying to log an error message for such a case. The other 'return 0' seems to be impossible (for now), though I'm wondering if an approach like the following would be a worthwhile refactor:
uint16_t i2c_addr = 0; switch (dev_type) { case DEV_TYPE_SENSOR: i2c_addr = dev->path.i2c.device; break; case DEV_TYPE_VCM: i2c_addr = config->vcm_address; break; case DEV_TYPE_ROM: i2c_addr = config->rom_address; break; default: return 0; } return (((uint32_t)i2c_bus) << 24 | ((uint32_t)i2c_addr) << 8 | dev_type);