[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1286329008.2156.78.camel@Joe-Laptop>
Date: Tue, 05 Oct 2010 18:36:48 -0700
From: Joe Perches <joe@...ches.com>
To: rklein@...dia.com
Cc: jic23@....ac.uk, achew@...dia.com, olof@...om.net,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org, ldewangan@...dia.com
Subject: Re: [PATCH v3] iio: light: Adding driver for ISL29018 ALS
On Tue, 2010-10-05 at 15:42 -0700, rklein@...dia.com wrote:
> From: Rhyland Klein <rklein@...dia.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists