public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: Jiri Slaby <jslaby@suse.cz>,
	linux-kernel@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@redhat.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 1/4] media: dvb/af9015, implement eeprom hashing
Date: Mon, 25 Jan 2010 01:52:42 +0200	[thread overview]
Message-ID: <4B5CDD4A.5060800@iki.fi> (raw)
In-Reply-To: <4B5C76B8.4090700@gmail.com>

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@iki.fi>

regards
Antti
-- 
http://palosaari.fi/

  reply	other threads:[~2010-01-24 23:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 20:00 [PATCH 1/1] media: dvb-usb/af9015, add IR support for digivox mini II Jiri Slaby
2010-01-14 19:09 ` Antti Palosaari
2010-01-22 15:10   ` [PATCH 1/4] media: dvb/af9015, implement eeprom hashing Jiri Slaby
2010-01-24 16:16     ` Antti Palosaari
2010-01-24 16:35       ` Jiri Slaby
2010-01-24 23:52         ` Antti Palosaari [this message]
2010-01-22 15:10   ` [PATCH 2/4] media: dvb/af9015, factor out remote setting Jiri Slaby
2010-01-24 23:53     ` Antti Palosaari
2010-01-22 15:10   ` [PATCH 3/4] media: dvb/af9015, refactor " Jiri Slaby
2010-01-24 23:54     ` Antti Palosaari
2010-01-22 15:10   ` [PATCH 4/4] media: dvb/af9015, add hashes support Jiri Slaby
2010-01-24 23:55     ` Antti Palosaari
2010-01-22 15:11   ` [PATCH 1/1] media: dvb-usb/af9015, add IR support for digivox mini II Jiri Slaby

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=4B5CDD4A.5060800@iki.fi \
    --to=crope@iki.fi \
    --cc=jirislaby@gmail.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /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