lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <73E9FA09-55D6-409D-A902-29CC3F414CBF@emc.com.tw>
Date:	Sat, 26 Jul 2014 02:05:02 +0800
From:	cheng wei Lin <dusonlin@....com.tw>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:	linux-kernel@...r.kernel.org, linux-input@...r.kernel.org,
	bleung@...omium.org, agnescheng@...omium.org,
	"SRD1 &#65533;蝬踐&#65533;&#65533;?都&#65533;&#65533;&#65533;&#65533;" 
	<phoenix@....com.tw>, jeff.chuang@....com.tw
Subject: Re: [PATCH v2] Input: add i2c/smbus driver for elan touchpad

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@...il.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
> 

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ