linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti-k2GhghHVRtY@public.gmane.org>
To: "Michele De Candia (VT)"
	<michele.decandia-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] TSL2550 driver bugfix
Date: Mon, 13 Jul 2009 12:06:36 +0200	[thread overview]
Message-ID: <20090713100636.GT5823@enneenne.com> (raw)
In-Reply-To: <4A5B011F.8030507-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>


On Mon, Jul 13, 2009 at 11:40:47AM +0200, Michele De Candia (VT) wrote:
> Signed-off-by: Michele Jr De Candia <michele.decandia-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
> 
> diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/i2c/chips/tsl2550.c
> index 1a9cc13..561d7bf 100644
> --- a/drivers/i2c/chips/tsl2550.c
> +++ b/drivers/i2c/chips/tsl2550.c
> @@ -27,7 +27,7 @@
>  #include <linux/delay.h>
>  
>  #define TSL2550_DRV_NAME	"tsl2550"
> -#define DRIVER_VERSION		"1.1.1"
> +#define DRIVER_VERSION		"1.1.2"
>  
>  /*
>   * Defines
> @@ -189,13 +189,16 @@ static int tsl2550_calculate_lux(u8 ch0, u8 ch1)
>  	u8 r = 128;
>  
>  	/* Avoid division by 0 and count 1 cannot be greater than count 0 */
> -	if (c0 && (c1 <= c0))
> -		r = c1 * 128 / c0;
> +	if (c1 <= c0)
> +		if (c0) {
> +			r = c1 * 128 / c0;
> +
> +			/* Calculate LUX */
> +			lux = ((c0 - c1) * ratio_lut[r]) / 256;
> +		} else
> +			lux = 0;
>  	else
> -		return -1;
> -
> -	/* Calculate LUX */
> -	lux = ((c0 - c1) * ratio_lut[r]) / 256;
> +		return -EAGAIN;
>  
>  	/* LUX range check */
>  	return lux > TSL2550_MAX_LUX ? TSL2550_MAX_LUX : lux;

Acked-by: Rodolfo Giometti <giometti-k2GhghHVRtY@public.gmane.org>

-- 

GNU/Linux Solutions                  e-mail: giometti-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org
Linux Device Driver                          giometti-k2GhghHVRtY@public.gmane.org
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti

  parent reply	other threads:[~2009-07-13 10:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-30 15:31 [PATCH] TSL2550 driver bugfix Michele De Candia (VT)
     [not found] ` <4A4A2FBC.1060804-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
2009-06-30 16:41   ` Jonathan Cameron
     [not found]     ` <4A4A4036.3000408-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2009-07-01  8:12       ` Michele De Candia (VT)
     [not found]         ` <4A4B1A71.20101-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
2009-07-01 10:00           ` Jonathan Cameron
     [not found]             ` <4A4B7904.5010301@valueteam.com>
     [not found]               ` <4A4B7904.5010301-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
2009-07-01 16:06                 ` Jonathan Cameron
2009-07-11 18:20           ` Jean Delvare
     [not found]             ` <20090711202030.52ffbddb-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-07-12  8:52               ` Jean Delvare
     [not found]                 ` <20090712105237.01e11954-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-07-13  7:56                   ` Michele De Candia (VT)
     [not found]                     ` <4A5AE89A.8000000-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
2009-07-13  8:44                       ` Jean Delvare
     [not found]                         ` <4A5B011F.8030507@valueteam.com>
     [not found]                           ` <4A5B011F.8030507-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org>
2009-07-13 10:06                             ` Rodolfo Giometti [this message]
2009-07-13 19:17                             ` Jean Delvare

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=20090713100636.GT5823@enneenne.com \
    --to=giometti-k2ghghhvrty@public.gmane.org \
    --cc=jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=michele.decandia-EZxuzQJkuwwybS5Ee8rs3A@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).