linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH] staging:iio:accel:lis3l02dq use regmap.
Date: Mon, 5 Sep 2011 10:57:59 -0700	[thread overview]
Message-ID: <20110905175758.GJ3889@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1315240395-6623-2-git-send-email-jic23@cam.ac.uk>

On Mon, Sep 05, 2011 at 05:33:15PM +0100, Jonathan Cameron wrote:

> +static bool lis3l02dq_reg_writeable(struct device *dev, unsigned int reg)
> +{
> +	return (reg == LIS3L02DQ_REG_OFFSET_X_ADDR ||
> +		reg == LIS3L02DQ_REG_OFFSET_Y_ADDR ||
> +		reg == LIS3L02DQ_REG_OFFSET_Z_ADDR ||

These would all look nicer as switch statements I think - this doesn't
look terribly idiomatic.

> +static bool lis3l02dq_reg_volatile(struct device *dev, unsigned int reg)
> +{
> +	return (reg == LIS3L02DQ_REG_WAKE_UP_ACK_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_X_L_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_X_H_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_Y_L_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_Y_H_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_Z_L_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_Z_H_ADDR);	
> +}
> +/* Read the data registers might result in unexpected datardy signal
> + * so they have to be marked precious */
> +static bool lis3l02dq_reg_precious(struct device *dev, unsigned int reg)
> +{
> +	return (reg == LIS3L02DQ_REG_WAKE_UP_ACK_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_X_L_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_X_H_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_Y_L_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_Y_H_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_Z_L_ADDR ||
> +		reg == LIS3L02DQ_REG_OUT_Z_H_ADDR);

These could perhaps be the same function?

      reply	other threads:[~2011-09-05 17:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-05 16:33 [PATCH] iio - first play with regmap Jonathan Cameron
2011-09-05 16:33 ` [PATCH] staging:iio:accel:lis3l02dq use regmap Jonathan Cameron
2011-09-05 17:57   ` Mark Brown [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=20110905175758.GJ3889@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@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).