[PATCH v2 7/7] iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions

Jonathan Cameron Jonathan.Cameron at huawei.com
Tue Jul 22 07:19:56 PDT 2025


On Tue, 22 Jul 2025 12:13:17 +0200
AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com> wrote:

> This driver doesn't need to add any register base address to any
> regmap call anymore since it was migrated to register as a SPMI
> subdevice with its own regmap reg_base, which makes the regmap
> API to automatically add such base address internally.
> 
> Since the iadc_{read,write,read_result}() functions now only do
> call regmap_{read,write,bulk_read}() and nothing else, simplify
> the driver by removing them and by calling regmap APIs directly.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
One trivial comment following on from previous.
Either way

Reviewed-by: Jonathan Cameron <jonathan.cameron at huawei.com>

> @@ -267,11 +249,6 @@ static int iadc_poll_wait_eoc(struct iadc_chip *iadc, unsigned int interval_us)
>  	return -ETIMEDOUT;
>  }
>  
> -static int iadc_read_result(struct iadc_chip *iadc, u16 *data)
> -{
> -	return regmap_bulk_read(iadc->regmap, IADC_DATA, data, 2);
> -}
> -
>  static int iadc_do_conversion(struct iadc_chip *iadc, int chan, u16 *data)
>  {
>  	unsigned int wait;
> @@ -296,7 +273,7 @@ static int iadc_do_conversion(struct iadc_chip *iadc, int chan, u16 *data)
>  	}
>  
>  	if (!ret)
> -		ret = iadc_read_result(iadc, data);
> +		ret = regmap_bulk_read(iadc->regmap, IADC_DATA, data, 2);

sizeof(*data) would be better than the magic 2.  This is probably a good
place to tidy that up given you are replacing the line anyway.


>  exit:
>  	iadc_set_state(iadc, false);
>  	if (ret < 0)




More information about the linux-phy mailing list