On Tue, Jul 07, 2026 at 12:50:34PM +0100, Daniel P. Berrangé wrote:
> On Fri, Jul 03, 2026 at 03:32:17PM +0100, Mark Cave-Ayland wrote:
> > Signed-off-by: Mark Cave-Ayland <[email protected]>
> > ---
> >  hw/adc/npcm7xx_adc.c | 19 ++++++++++++-------
> >  1 file changed, 12 insertions(+), 7 deletions(-)
> > 
> > diff --git a/hw/adc/npcm7xx_adc.c b/hw/adc/npcm7xx_adc.c
> > index 3584c27c75..27d42f87b1 100644
> > --- a/hw/adc/npcm7xx_adc.c
> > +++ b/hw/adc/npcm7xx_adc.c
> > @@ -229,7 +229,6 @@ static void npcm7xx_adc_init(Object *obj)
> >  {
> >      NPCM7xxADCState *s = NPCM7XX_ADC(obj);
> >      SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
> > -    int i;
> >  
> >      sysbus_init_irq(sbd, &s->irq);
> >  
> > @@ -240,12 +239,6 @@ static void npcm7xx_adc_init(Object *obj)
> >      sysbus_init_mmio(sbd, &s->iomem);
> >      s->clock = qdev_init_clock_in(DEVICE(s), "clock", NULL, NULL, 0);
> >  
> > -    for (i = 0; i < NPCM7XX_ADC_NUM_INPUTS; ++i) {
> > -        object_property_add_uint32_ptr(obj, "adci[*]",
> > -                &s->adci[i], OBJ_PROP_FLAG_READWRITE);
> > -    }
> > -    object_property_add_uint32_ptr(obj, "vref",
> > -            &s->vref, OBJ_PROP_FLAG_WRITE);
> >      npcm7xx_adc_calibrate(s);
> >  }
> >  
> > @@ -275,6 +268,7 @@ static void npcm7xx_adc_class_init(ObjectClass *klass, 
> > const void *data)
> >  {
> >      ResettableClass *rc = RESETTABLE_CLASS(klass);
> >      DeviceClass *dc = DEVICE_CLASS(klass);
> > +    int i;
> >  
> >      dc->desc = "NPCM7xx ADC Module";
> >      dc->vmsd = &vmstate_npcm7xx_adc;
> > @@ -282,6 +276,17 @@ static void npcm7xx_adc_class_init(ObjectClass *klass, 
> > const void *data)
> >      rc->phases.hold = npcm7xx_adc_hold_reset;
> >  
> >      device_class_set_props(dc, npcm7xx_timer_properties);
> > +
> > +    for (i = 0; i < NPCM7XX_ADC_NUM_INPUTS; ++i) {
> > +        g_autofree char *adciprop = g_strdup_printf("adci[%u]", i);
> > +
> > +        object_class_property_add_uint32_ptr(klass, adciprop,
> > +                offsetof(NPCM7xxADCState, adci[i]),
> > +                OBJ_PROP_FLAG_READWRITE);
> > +    }
> > +    object_class_property_add_uint32_ptr(klass, "vref",
> > +                offsetof(NPCM7xxADCState, vref),
> > +                OBJ_PROP_FLAG_WRITE);
> 
> Are you sure this actually works ?

Never mind. I realize now that this depends on your previous
series that changes object_class_property_add_uint32_ptr
to actually have the useful/desirable "relative offset"
semantics.

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|


Reply via email to