mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Mircea Caprioru <mircea.caprioru@analog.com>, jic23@kernel.org
Cc: Michael.Hennerich@analog.com, alexandru.ardelean@analog.com,
	gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org
Subject: Re: [RESEND PATCH] iio: adc: ad7124: Add direct reg access
Date: Wed, 29 Jan 2020 08:18:08 +0100	[thread overview]
Message-ID: <d5d1eb35-fb5f-07d6-e678-3c54709ea75f@metafoo.de> (raw)
In-Reply-To: <20200129051435.15366-1-mircea.caprioru@analog.com>

On 1/29/20 6:14 AM, Mircea Caprioru wrote:
> From: Mircea <mircea.caprioru@analog.com>
> 
> This patch adds the posibility do read and write registers from userspace
> using the kernel debug direct register access option.

Typo: possibility

> 
> Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
[...]
>   
> +static int ad7124_reg_access(struct iio_dev *indio_dev,
> +			     unsigned int reg,
> +			     unsigned int writeval,
> +			     unsigned int *readval)
> +{
> +	struct ad7124_state *st = iio_priv(indio_dev);
> +	int ret;
> +
> +
> +	if (readval)
> +		ret = ad_sd_read_reg(&st->sd, reg, ad7124_reg_size[reg],
> +				     readval);
> +	else
> +		ret = ad_sd_write_reg(&st->sd, reg, ad7124_reg_size[reg],
> +				      writeval);

Needs a bounds check to make sure that reg is less then the number of 
entries in ad7124_reg_size.

      parent reply	other threads:[~2020-01-29  7:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29  5:14 Mircea Caprioru
2020-01-29  5:51 ` Greg KH
2020-01-29  7:18 ` Lars-Peter Clausen [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=d5d1eb35-fb5f-07d6-e678-3c54709ea75f@metafoo.de \
    --to=lars@metafoo.de \
    --cc=Michael.Hennerich@analog.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mircea.caprioru@analog.com \
    /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

all inboxes | Powered by JetHome®