Re: [PATCH] iio: dac: cio-dac: Migrate to the regmap API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 11, 2023 at 08:40:12AM -0500, William Breathitt Gray wrote:
> The regmap API supports IO port accessors so we can take advantage of
> regmap abstractions rather than handling access to the device registers
> directly in the driver.
> 
> Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Signed-off-by: William Breathitt Gray <william.gray@xxxxxxxxxx>

[...]

> @@ -117,8 +148,12 @@ static int cio_dac_probe(struct device *dev, unsigned int id)
>  	indio_dev->name = dev_name(dev);
>  
>  	/* initialize DAC outputs to 0V */
> -	for (i = 0; i < CIO_DAC_NUM_CHAN; i++)
> -		iowrite16(0, priv->base + i);
> +	for (i = 0; i < CIO_DAC_NUM_CHAN; i++) {
> +		offset = i * CIO_DAC_CHANNEL_STRIDE;
> +		err = regmap_write(priv->map, CIO_DAC_BASE + offset, 0);
> +		if (err)
> +			return err;
> +	}
>  
>  	return devm_iio_device_register(dev, indio_dev);
>  }

As soon as I sent this I realized this last hunk is no longer necessary
because the chan_out_states array is gone so we don't need to match its
initialized state. I'll remove this block as superfluous and submit a v2
patch shortly.

William Breathitt Gray

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux