On 10/12/2019 04:34, David Gibson wrote: >> +static inline bool pnv_chip_is_power10(const PnvChip *chip) >> +{ >> + return PNV_CHIP_GET_CLASS(chip)->chip_type == PNV_CHIP_POWER10; >> +} >> + >> +static inline bool pnv_is_power10(PnvMachineState *pnv) >> +{ >> + return pnv_chip_is_power10(pnv->chips[0]); >> +} >
I agree this is starting to be ugly. > It's not in scope for this series, but now that we have P8/9/10 > specific chip object types and powernv8/powernv9, we should be able to > remove the ugly chip_type field, and just do object class checks on > the chip and or machine objects themselves. So we would use object_class_dynamic_cast() instead of field chip_type ? C.