mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: rklein@nvidia.com
Cc: jic23@cam.ac.uk, achew@nvidia.com, olof@lixom.net,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org, ldewangan@nvidia.com
Subject: Re: [PATCH v3] iio: light: Adding driver for ISL29018 ALS
Date: Tue, 05 Oct 2010 18:36:48 -0700	[thread overview]
Message-ID: <1286329008.2156.78.camel@Joe-Laptop> (raw)
In-Reply-To: <1286318566-9782-1-git-send-email-rklein@nvidia.com>

On Tue, 2010-10-05 at 15:42 -0700, rklein@nvidia.com wrote:
> From: Rhyland Klein <rklein@nvidia.com>

Hi again.

> diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c
[]
> +#define ISL29018_REG_ADD_DATA_LSB	0x02
> +#define ISL29018_REG_ADD_DATA_MSB	0x03
> +#define ISL29018_MAX_REGS		ISL29018_REG_ADD_DATA_MSB
> +
> +struct isl29018_chip {
> +	struct iio_dev		*indio_dev;
> +	struct i2c_client	*client;
> +	struct mutex		lock;
> +	unsigned int		range;
> +	unsigned int		adc_bit;
> +	int			prox_scheme;
> +	u8			reg_cache[ISL29018_MAX_REGS];
> +};
[]
> +static int isl29018_chip_init(struct i2c_client *client)
> +{
> +	struct isl29018_chip *chip = i2c_get_clientdata(client);
[]
> +	memset((void *)chip->reg_cache, 0, ARRAY_SIZE(chip->reg_cache));

Turns out there's only 3 of these registers.
Earlier, I believe you said 32 bytes. 

I think the normal kernel style is:

	memset(chip->reg_cache, 0, sizeof(chip->reg_cache));

ARRAY_SIZE works, but only because reg_cache is u8.

cheers, Joe


  reply	other threads:[~2010-10-06  1:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05 22:42 rklein
2010-10-06  1:36 ` Joe Perches [this message]
2010-10-06 11:47 ` Jonathan Cameron

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=1286329008.2156.78.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=achew@nvidia.com \
    --cc=jic23@cam.ac.uk \
    --cc=ldewangan@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=rklein@nvidia.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

Powered by JetHome