Re: [PATCH 2/3] i3c: master: Extend address status bit to 4 and add I3C_ADDR_SLOT_EXT_INIT

From: Miquel Raynal
Date: Thu Oct 03 2024 - 04:29:45 EST


Hi Frank,

> > >
> > > -static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr,
> > > - enum i3c_addr_slot_status status)
> > > +static enum i3c_addr_slot_status
> > > +i3c_bus_get_addr_slot_status(struct i3c_bus *bus, u16 addr)
> > > +{
> > > + return i3c_bus_get_addr_slot_status_ext(bus, addr) & I3C_ADDR_SLOT_STATUS_MASK;
> > > +}
> > > +
> > > +static void i3c_bus_set_addr_slot_status_mask(struct i3c_bus *bus, u16 addr,
> > > + enum i3c_addr_slot_status status, int mask)
> > > {
> > > int bitpos = addr * I3C_ADDR_SLOT_STATUS_BITS;
> > > unsigned long *ptr;
> > > @@ -369,11 +375,22 @@ static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr,
> > > return;
> > >
> > > ptr = bus->addrslots + (bitpos / BITS_PER_LONG);
> > > - *ptr &= ~((unsigned long)I3C_ADDR_SLOT_STATUS_MASK <<
> > > - (bitpos % BITS_PER_LONG));
> > > + *ptr &= ~((unsigned long)mask << (bitpos % BITS_PER_LONG));
> > > *ptr |= (unsigned long)status << (bitpos % BITS_PER_LONG);
> > > }
> > >
> > > +static void i3c_bus_set_addr_slot_status(struct i3c_bus *bus, u16 addr,
> > > + enum i3c_addr_slot_status status)
> > > +{
> > > + i3c_bus_set_addr_slot_status_mask(bus, addr, status, I3C_ADDR_SLOT_STATUS_MASK);
> > > +}
> > > +
> > > +static void i3c_bus_set_addr_slot_status_ext(struct i3c_bus *bus, u16 addr,
> > > + enum i3c_addr_slot_status status)
> > > +{
> > > + i3c_bus_set_addr_slot_status_mask(bus, addr, status, I3C_ADDR_SLOT_EXT_STATUS_MASK);
> > > +}
> >
> > Can we drop this helper and instead modify the
> > i3c_bus_set_addr_slot_status() prototype to get the mask from its
> > parameters?
>
> git grep "i3c_bus_set_addr_slot_status(" drivers/i3c/ | wc
>
> There are 18 places need be modified without this helper function.
> are you sue what you want?
>
> Maybe drop i3c_bus_set_addr_slot_status_ext() is good idea by direct use
> i3c_bus_set_addr_slot_status_mask().

Ok fine for _mask.

Thanks,
Miquèl