Re: [PATCH 09/11] mfd: bq257xx: Add BQ25792 support
From: Alexey Charkov
Date: Mon Mar 09 2026 - 03:42:42 EST
On Fri, Mar 6, 2026 at 6:15 PM Lee Jones <lee@xxxxxxxxxx> wrote:
>
> On Tue, 03 Mar 2026, Alexey Charkov wrote:
>
> > Add register definitions and a new 'type' enum to be passed in MFD
> > platform data to support the BQ25792, which is a newer variant of the
> > BQ257xx family.
> >
> > BQ25792 shares similar logic of operation with the already supported
> > BQ25703A but has a completely different register map and different
> > electrical constraints.
> >
> > Signed-off-by: Alexey Charkov <alchark@xxxxxxxxxxx>
> > ---
> > drivers/mfd/bq257xx.c | 60 ++++++-
> > include/linux/mfd/bq257xx.h | 417 ++++++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 472 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/mfd/bq257xx.c b/drivers/mfd/bq257xx.c
> > index e9d49dac0a16..a6776c8c94f2 100644
> > --- a/drivers/mfd/bq257xx.c
> > +++ b/drivers/mfd/bq257xx.c
[...]
> > static int bq257xx_probe(struct i2c_client *client)
> > {
> > + const struct bq257xx_match_data *md = device_get_match_data(&client->dev);
> > + const struct mfd_cell cells[] = {
> > + MFD_CELL_BASIC("bq257xx-regulator", NULL, &md->plat, sizeof(md->plat), 0),
> > + MFD_CELL_BASIC("bq257xx-charger", NULL, &md->plat, sizeof(md->plat), 0),
>
> Please keep these out of the functions.
>
> IOW, please put them back where you found them.
Thanks Lee, will address in v3.
Out of curiosity, are there lifecycle implications here, or is it more
of a convention to keep them out of functions? I've been thinking
that, given they are only accessed during the initial probe, it would
be neat to keep them const and initialize once, when the matched
variant is known. It works in my testing, but I can't vouch I've put
it through every possible corner case, especially various
built-in/module combinations or probe deferrals.
Best regards,
Alexey