Re: [PATCH v5 06/14] mfd: lm3533-core: Remove redundant pdata helpers

Jonathan Cameron <[email protected]> Wed, 22 Jul 2026 02:25:19 +0100
Newsgroups org.kernel.vger.linux-fbdev,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel,org.kernel.vger.linux-leds
Message-ID <20260722022519.3b1e4fd3@jic23-huawei>
On Wed, 17 Jun 2026 11:00:23 +0300
Svyatoslav Ryhel <[email protected]> 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 <[email protected]>

>  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));

> +	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);