Re: [PATCH v5 06/14] mfd: lm3533-core: Remove redundant pdata helpers
From: Svyatoslav Ryhel
Date: Mon Jul 27 2026 - 04:27:38 EST
ср, 22 лип. 2026 р. о 04:25 Jonathan Cameron <jic23@xxxxxxxxxx> пише:
>
> On Wed, 17 Jun 2026 11:00:23 +0300
> Svyatoslav Ryhel <clamor95@xxxxxxxxx> wrote:
>
> > The lm3533_set_boost_freq() and lm3533_set_boost_ovp() functions are used
> > only in lm3533_device_setup(), which in turn is only called by
> > lm3533_device_init(). Incorporate their code directly into
> > lm3533_device_init() to simplify driver readability.
> >
> > Signed-off-by: Svyatoslav Ryhel <clamor95@xxxxxxxxx>
>
> > static int lm3533_device_init(struct lm3533 *lm3533)
> > {
> > struct lm3533_platform_data *pdata = dev_get_platdata(lm3533->dev);
> > @@ -437,9 +396,21 @@ static int lm3533_device_init(struct lm3533 *lm3533)
> >
> > lm3533_enable(lm3533);
> >
> > - ret = lm3533_device_setup(lm3533, pdata);
> > - if (ret)
> > + ret = regmap_update_bits(lm3533->regmap, LM3533_REG_BOOST_PWM,
> > + LM3533_BOOST_FREQ_MASK,
> > + pdata->boost_freq << LM3533_BOOST_FREQ_SHIFT);
>
> As you are touching this maybe get rid of the shifts and have one source
> of info on where the field lies in the register.
>
> FIELD_PREP(LM3533_BOOST_FREQ_MASK, pdata->boost_freq));
>
Very decent suggestion, thanks!
> > + if (ret) {
> > + dev_err(lm3533->dev, "failed to set boost frequency\n");
> > goto err_disable;
> > + }
> > +
> > + ret = regmap_update_bits(lm3533->regmap, LM3533_REG_BOOST_PWM,
> > + LM3533_BOOST_OVP_MASK,
> > + pdata->boost_ovp << LM3533_BOOST_OVP_SHIFT);
> > + if (ret) {
> > + dev_err(lm3533->dev, "failed to set boost ovp\n");
> > + goto err_disable;
> > + }
> >
> > lm3533_device_als_init(lm3533);
> > lm3533_device_bl_init(lm3533);
>