[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49929EB8.4020802@tremplin-utc.net>
Date: Wed, 11 Feb 2009 10:47:36 +0100
From: Éric Piel <eric.piel@...mplin-utc.net>
To: Giuseppe Bilotta <giuseppe.bilotta@...il.com>
Cc: linux-kernel@...r.kernel.org, Pavel Machek <pavel@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCHv6] lis3lv02d: support both one- and two-byte sensors
Giuseppe Bilotta schreef:
:
> Same as v5, with a couple of renames to have simpler and more meaningful
> names. The #define's for the LISxxxxx families have been renamed
> according to the actual functional distinction, and the struct member
> holding the data read function has been renamed to read_data.
>
Almost good... just a little thing more:
> @@ -254,10 +270,21 @@ static int lis3lv02d_add(struct acpi_device *device)
> strcpy(acpi_device_class(device), ACPI_MDPS_CLASS);
> device->driver_data = &adev;
>
> - lis3lv02d_acpi_read(device->handle, WHO_AM_I, &val);
> - if ((val != LIS3LV02DL_ID) && (val != LIS302DL_ID)) {
> - printk(KERN_ERR DRIVER_NAME
> - ": Accelerometer chip not LIS3LV02D{L,Q}\n");
> + lis3lv02d_acpi_read(device->handle, WHO_AM_I, &adev.whoami);
> + switch (adev.whoami) {
> + case LIS_DOUBLE_ID:
> + printk(KERN_INFO DRIVER_NAME ": 2-byte sensor found\n");
> + adev.read_data = lis3lv02d_read_16;
> + adev.mdps_max_val = 2048;
> + break;
> + case LIS_SINGLE_ID:
> + printk(KERN_INFO DRIVER_NAME ": 1-byte sensor found\n");
> + adev.read_data = lis3lv02d_read_8;
> + adev.mdps_max_val = 128;
> + break;
> + default:
> + printk(KERN_ERR DRIVER_NAME
> + ": unknown sensor type 0x%X\n", adev.whoami);
> }
In the default case, add:
return -EINVAL;
I don't want the driver to start messing with chips we have no idea what
they do!
Eric
--
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