On 26/06/24 01:47PM, Cédric Le Goater wrote:
> On 6/23/26 16:19, Aditya Gupta wrote:
> > <...snip...>
> >
> >       g_test_init(&argc, &argv, NULL);
> > -    char *tname = g_strdup_printf("pnv-xscom/spi-seeprom/%s",
> > -            pnv_chips[3].cpu_model);
> > -    qtest_add_data_func(tname, &pnv_chips[3], test_spi_seeprom);
> > -    g_free(tname);
> > +
> > +    for (int i = 0; i < ARRAY_SIZE(pnv_chips); i++) {
> > +        /* TYPE_PNV_SPI is not instantiated for older Power8/9 machines */
> > +        if (pnv_chips[i].chip_type < PNV_CHIP_POWER10) {
> 
> Can we remove this chip_type field from the tests too ? see 248e4e924e87.

I went through the usage, and don't see any fix currently, as the
PnvChip structure these qtests are using is basic, and we need some way
to identify the chip type, for things like which machine to use, xscom
addresses, and to skip/do specific things for particular chip type.
I went through the mentioned commit and its parent, seems it was
possible with the compat property being handled by respective
class_init. So currently I don't see a better way, what do you think ?

> 
> > +            continue;
> > +        }
> > +
> > +        char *tname = g_strdup_printf("pnv-xscom/spi-seeprom/%s",
> > +                pnv_chips[i].cpu_model);
> 
> please consider g_autofree variables.

Sure cedric, will use it in v2.

Thanks,
- Aditya G

> 
> > +        qtest_add_data_func(tname, &pnv_chips[i], test_spi_seeprom);
> > +        g_free(tname);
> > +    }
> >       return g_test_run();
> >   }
> 

Reply via email to