Re: [PATCH v4 2/3] iio: adc: bcm_iproc_adc: Introduce local device pointer

From: David Lechner

Date: Sat Aug 01 2026 - 10:51:59 EST


On 8/1/26 4:09 AM, mdshahid03@xxxxxxxxx wrote:
> From: Mohammad Shahid <mdshahid03@xxxxxxxxx>
>
> Introduce a local 'struct device *dev' variable in iproc_adc_probe()
> and use it instead of repeatedly referencing '&pdev->dev'.
>
> This simplifies the code and makes subsequent error handling changes
> less verbose.
>
> No functional change intended.
>
> Signed-off-by: Mohammad Shahid <mdshahid03@xxxxxxxxx>
> ---
> drivers/iio/adc/bcm_iproc_adc.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c
> index 7c2e2770cd61..4acd9c3f089b 100644
> --- a/drivers/iio/adc/bcm_iproc_adc.c
> +++ b/drivers/iio/adc/bcm_iproc_adc.c
> @@ -506,9 +506,10 @@ static int iproc_adc_probe(struct platform_device *pdev)
> {
> struct iproc_adc_priv *adc_priv;
> struct iio_dev *indio_dev = NULL;
> + struct device *dev = &pdev->dev;
> int ret;
>
> - indio_dev = devm_iio_device_alloc(&pdev->dev,
> + indio_dev = devm_iio_device_alloc(dev,
> sizeof(*adc_priv));
> if (!indio_dev)
> return -ENOMEM;
> @@ -523,14 +524,14 @@ static int iproc_adc_probe(struct platform_device *pdev)
> adc_priv->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
> "adc-syscon");
> if (IS_ERR(adc_priv->regmap)) {
> - dev_err(&pdev->dev, "failed to get handle for tsc syscon\n");
> + dev_err(dev, "failed to get handle for tsc syscon\n");
> ret = PTR_ERR(adc_priv->regmap);
> return ret;
> }
>
> - adc_priv->adc_clk = devm_clk_get(&pdev->dev, "tsc_clk");
> + adc_priv->adc_clk = devm_clk_get(dev, "tsc_clk");
> if (IS_ERR(adc_priv->adc_clk)) {
> - dev_err(&pdev->dev,
> + dev_err(dev,
> "failed getting clock tsc_clk\n");
> ret = PTR_ERR(adc_priv->adc_clk);
> return ret;
I imagine some, if not all, of these will fit on one line now
without going over 80 chars.