[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B5CDD4A.5060800@iki.fi>
Date: Mon, 25 Jan 2010 01:52:42 +0200
From: Antti Palosaari <crope@....fi>
To: Jiri Slaby <jirislaby@...il.com>
CC: Jiri Slaby <jslaby@...e.cz>, linux-kernel@...r.kernel.org,
Mauro Carvalho Chehab <mchehab@...hat.com>,
linux-media@...r.kernel.org
Subject: Re: [PATCH 1/4] media: dvb/af9015, implement eeprom hashing
On 01/24/2010 06:35 PM, Jiri Slaby wrote:
> On 01/24/2010 05:16 PM, Antti Palosaari wrote:
>>> + af9015_config.eeprom_sum = 0;
>>> + for (reg = 0; reg< eeprom_size / sizeof(u32); reg++) {
>>> + af9015_config.eeprom_sum *= GOLDEN_RATIO_PRIME_32;
>>> + af9015_config.eeprom_sum += le32_to_cpu(((u32 *)eeprom)[reg]);
>>> + }
>>> +
>>> + deb_info("%s: eeprom sum=%.8x\n", __func__,
>>> af9015_config.eeprom_sum);
>>
>> Does this sum contain all 256 bytes from EEPROM? 256/4 is 64.
>
> Yes it does. It is computed as a hashed sum of 32-bit numbers (4 bytes)
> -- speed (does not matter) and larger space of hashes. Hence the
> division by 4. The cast does the trick: ((u32 *)eeprom)[reg] -- reg
> index is on a 4-byte basis.
OK, true. Anyhow, I don't know if this hashing formula is good enough -
changing it later could be really pain. I compared it to the one used
for em28xx driver and it was different. Could someone with better
knowledge check that?
Generally it is good and ready for submission.
Acked-by: Antti Palosaari <crope@....fi>
regards
Antti
--
http://palosaari.fi/
--
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