linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Breathitt Gray <william.gray@linaro.org>
To: jic23@kernel.org, lars@metafoo.de
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH] iio: dac: cio-dac: Migrate to the regmap API
Date: Sat, 11 Mar 2023 08:57:02 -0500	[thread overview]
Message-ID: <ZAyIrrLrhmMJqq2w@fedora> (raw)
In-Reply-To: <20230311134012.70822-1-william.gray@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]

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@linux.intel.com>
> Signed-off-by: William Breathitt Gray <william.gray@linaro.org>

[...]

> @@ -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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2023-03-11 14:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-11 13:40 [PATCH] iio: dac: cio-dac: Migrate to the regmap API William Breathitt Gray
2023-03-11 13:57 ` William Breathitt Gray [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZAyIrrLrhmMJqq2w@fedora \
    --to=william.gray@linaro.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).