linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: cheng wei Lin <dusonlin@emc.com.tw>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	bleung@chromium.org, agnescheng@chromium.org,
	"\"SRD1
	&#65533;蝬踐&#65533;&#65533;?都&#65533;&#65533;&#65533;&#65533;\""
	<phoenix@emc.com.tw>,
	jeff.chuang@emc.com.tw
Subject: Re: [PATCH v2] Input: add i2c/smbus driver for elan touchpad
Date: Sat, 26 Jul 2014 02:05:02 +0800	[thread overview]
Message-ID: <73E9FA09-55D6-409D-A902-29CC3F414CBF@emc.com.tw> (raw)
In-Reply-To: <20140724180516.GA26752@core.coreip.homeip.net>

Hi Dmitry,

Sorry for late to reply you and thanks for your command

Yes, I also agree, it looks great than my original code.
So, should I modify this and upstream v3 patch for you?

thank you,
duson


Dmitry Torokhov <dmitry.torokhov@gmail.com> 於 2014/7/25 上午2:05 寫道:

> Hi,
> 
> On Tue, Jan 07, 2014 at 11:08:03AM +0800, Duson Lin wrote:
>> +/*
>> + ******************************************************************
>> + * General functions
>> + ******************************************************************
>> + */
>> +/*
>> + * (value from firmware) * 10 + 790 = dpi
>> + * we also have to convert dpi to dots/mm (*10/254 to avoid floating point)
>> + */
>> +static unsigned int elan_convert_res(char val)
>> +{
>> +	int res;
>> +	if (val & 0x80) {
>> +		val = ~val + 1;
>> +		res = (790 - val * 10) * 10 / 254;
>> +	} else
>> +		res = (val * 10 + 790) * 10 / 254;
>> +	return res;
>> +}
> 
> Why isn't this simply:
> 
> 	res = ((int)val * 10 + 790) * 10 / 254;
> 
> ?
> 
> If high bit is 1 you basically do the 2 complement by hand to get to
> positive and then subtract. Which shoudl be the same as adding positive
> value.
> 
> Thanks.
> 
> -- 
> Dmitry
> 


  reply	other threads:[~2014-07-25 18:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07  3:08 [PATCH v2] Input: add i2c/smbus driver for elan touchpad Duson Lin
2014-01-10 20:30 ` Benson Leung
2014-02-07  0:21   ` Benson Leung
2014-02-19 21:48     ` Benson Leung
2014-07-24 18:05 ` Dmitry Torokhov
2014-07-25 18:05   ` cheng wei Lin [this message]
2014-07-25 18:20     ` Dmitry Torokhov
2014-07-25 20:06       ` Dmitry Torokhov
2014-07-26  8:12         ` cheng wei Lin
2014-10-03 21:03 ` Dmitry Torokhov
2014-10-03 21:06   ` Dmitry Torokhov
2014-10-06  9:24     ` Mark Rutland
2014-10-06 16:37       ` Dmitry Torokhov
2014-10-03 21:30   ` Benson Leung
  -- strict thread matches above, loose matches on Subject: below --
2013-12-18  3:46 Duson Lin
2014-02-07  0:10 ` Benson Leung

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=73E9FA09-55D6-409D-A902-29CC3F414CBF@emc.com.tw \
    --to=dusonlin@emc.com.tw \
    --cc=agnescheng@chromium.org \
    --cc=bleung@chromium.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jeff.chuang@emc.com.tw \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phoenix@emc.com.tw \
    /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).