Re: [PATCH v3] iio: light: Adding driver for ISL29018 ALS

From: Joe Perches
Date: Tue Oct 05 2010 - 21:36:55 EST


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

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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/