public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Éric Piel" <eric.piel@tremplin-utc.net>
To: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Cc: linux-kernel@vger.kernel.org, Pavel Machek <pavel@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCHv6] lis3lv02d: support both one- and two-byte sensors
Date: Wed, 11 Feb 2009 10:47:36 +0100	[thread overview]
Message-ID: <49929EB8.4020802@tremplin-utc.net> (raw)
In-Reply-To: <1234314259-17922-1-git-send-email-giuseppe.bilotta@gmail.com>

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

  reply	other threads:[~2009-02-11  9:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-11  1:04 [PATCHv6] lis3lv02d: support both one- and two-byte sensors Giuseppe Bilotta
2009-02-11  9:47 ` Éric Piel [this message]
2009-02-11 10:06   ` [PATCHv7] " Giuseppe Bilotta
2009-02-11 10:17     ` Éric Piel
2009-02-11 22:38     ` Andrew Morton
2009-02-11 22:44       ` Giuseppe Bilotta
2009-02-11 22:53         ` Andrew Morton
2009-02-11 23:06           ` Giuseppe Bilotta
2009-02-11 23:27             ` Andrew Morton
2009-02-11 23:53       ` Éric Piel

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=49929EB8.4020802@tremplin-utc.net \
    --to=eric.piel@tremplin-utc.net \
    --cc=akpm@linux-foundation.org \
    --cc=giuseppe.bilotta@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    /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